gpt4 book ai didi

reactjs - React Native IOS发布构建白屏: TypeError: n.渲染不是一个函数

转载 作者:行者123 更新时间:2023-12-03 14:26:22 27 4
gpt4 key购买 nike

在为 Release 构建 React Native 项目时,它构建成功,但在设备或模拟器上运行时,屏幕保持白色,并且 Xcode 上出现以下日志:

2018-10-08 10:28:57.199743+0200 ProjectName[24497:338417] 
libMobileGestalt MobileGestalt.c:890: MGIsDeviceOneOfType is not
supported on this platform.
2018-10-08 10:28:57.329034+0200 ProjectName[24497:338417] [Crashlytics]
Version 3.10.8 (131)
2018-10-08 10:28:57.696 [error][tid:com.facebook.react.JavaScript]
TypeError: n.render is not a function. (In 'n.render()', 'n.render' is
undefined)

This error is located at:
in i
2018-10-08 10:28:57.697854+0200 ProjectName[24497:338510] TypeError:
n.render is not a function. (In 'n.render()', 'n.render' is undefined)

This error is located at:
in i
2018-10-08 10:28:57.699 [error][tid:com.facebook.react.JavaScript]
TypeError: n.render is not a function. (In 'n.render()', 'n.render' is undefined)

This error is located at:
in i
2018-10-08 10:28:57.699468+0200 ProjectName[24497:338510] TypeError: n.render is not a function. (In 'n.render()', 'n.render' is undefined)

This error is located at:
in i
2018-10-08 10:28:57.700 [fatal]
[tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception:
TypeError: n.render is not a function. (In 'n.render()', 'n.render' is
undefined)

This error is located at:
in i
2018-10-08 10:28:57.700153+0200 ProjectName[24497:338494] Unhandled JS
Exception: TypeError: n.render is not a function. (In 'n.render()',
'n.render' is undefined)

This error is located at:
in i
2018-10-08 10:28:57.715202+0200 ProjectName[24497:338494] ***
Terminating app due to uncaught exception 'RCTFatalException: Unhandled
JS Exception: TypeError: n.render is not a function. (In 'n.render()',
'n.render' is undefined)

This error is located at:
in i', reason: 'Unhandled JS Exception: TypeError: n.render is not a
function. (In 'n.rende..., stack:
Jn@211:40538
Ur@211:56432
Ar@211:56864
si@211:61708
li@211:61128
ii@211:60256
Mr@211:59236
pi@211:66432
render@211:69043
exports@371:431
run@367:611
runApplication@367:2058
value@44:4050
<unknown>@44:889
value@44:3310
value@44:861
'
*** First throw call stack:
(
0 CoreFoundation 0x000000010dee929b
__exceptionPreprocess + 331
1 libobjc.A.dylib 0x000000010c124735
objc_exception_throw + 48
2 ProjectName 0x000000010b333d62
RCTFormatError + 0
3 ProjectName 0x000000010b330abc -
[RCTExceptionsManager reportFatalException:stack:exceptionId:] + 507
4 CoreFoundation 0x000000010def011c
__invoking___ + 140
5 CoreFoundation 0x000000010deed5b5 -
[NSInvocation invoke] + 325
6 CoreFoundation 0x000000010deeda06 -
[NSInvocation invokeWithTarget:] + 54
7 ProjectName 0x000000010b34738e -
[RCTModuleMethod invokeWithBridge:module:arguments:] + 612
8 ProjectName 0x000000010b38d145 _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 255
9 ProjectName 0x000000010b38cec3 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 78
10 libdispatch.dylib 0x000000011113d5d1 _dispatch_call_block_and_release + 12
11 libdispatch.dylib 0x000000011113e63e _dispatch_client_callout + 8
12 libdispatch.dylib 0x0000000111145b47 _dispatch_lane_serial_drain + 791
13 libdispatch.dylib 0x00000001111467c0 _dispatch_lane_invoke + 428
14 libdispatch.dylib 0x00000001111508b8 _dispatch_workloop_worker_thread + 733
15 libsystem_pthread.dylib 0x000000011152d61c _pthread_wqthread + 409
16 libsystem_pthread.dylib 0x000000011152d415 start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
(lldb)

通过 react-native run-ios --configuration Release 和通过 Xcode(使用 Release 配置)构建时都会发生这种情况。调试工作正常。

  • React 原生版本:0.56
  • react 版本:16.3.1
  • typescript :3.1.1

项目使用 Typescript!

最佳答案

问题是使用 babel.config.js 而不是 .babelrc (Jest 需要 babel.config.js,但显然这会破坏发布版本)

我最终两者兼而有之,结合 babel 7 解决了我的所有问题。

关于reactjs - React Native IOS发布构建白屏: TypeError: n.渲染不是一个函数,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/52698480/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com