React-native: TypeError: undefined is not an object (evaluating 'e._children.forEach')

Created on 8 Oct 2019  路  9Comments  路  Source: facebook/react-native

Application is working as expected in debug mode but in release, app is crashed. Why can it happen? Any idea?

React Native version:

Steps To Reproduce

  1. I updated react native version from 0.59.9 to 0.61.2
  2. Application is working on debug mode but crash in release mode

Error from bugsnag:
Screenshot at Oct 08 12-14-04

Error from Xcode
<--
2019-10-08 12:08:01.529 [error][tid:com.facebook.react.JavaScript] TypeError: undefined is not an object (evaluating 'e._children.forEach')

This error is located at:
in y
in c
in RCTView
in n
in RCTView
in RCTView
in u
in TouchableOpacity
in h
in RCTView
in withTouchableScale(n)
in h
in RCTView
in RCTView
in RCTSafeAreaView
in SafeAreaView
in c
in n
in _
in t
in withNavigationFocus(t)
in withNavigation(withNavigationFocus(t))
in p
in RCTView
in u
in RCTView
in u
in n
in n
in E
in RCTView
in n
in RCTView
in u
in PanGestureHandler
in n
in L
in RCTView
in n
in t
in P
in v
in p
in RCTView
in RCTView
in l
in RCTView
in n
in RCTView
in u
in RCTView
in u
in PanGestureHandler
in n
in S
in P
in A
in RCTView
in h
in RCTView
in n
in _
in p
in withDeviceRegistration(p)
in _
in RCTView
in n
in f
in b
in n
in RCTView
in RCTView
in h
2019-10-08 12:08:01.548 [error][tid:com.facebook.react.JavaScript] TypeError: undefined is not an object (evaluating 'e._children.forEach')

This error is located at:
in A
in RCTView
in h
in RCTView
in n
in _
in p
in withDeviceRegistration(p)
in _
in RCTView
in n
in f
in b
in n
in RCTView
in RCTView
in h
2019-10-08 12:08:01.556 [error][tid:com.facebook.react.JavaScript] TypeError: undefined is not an object (evaluating 'e._children.forEach')

This error is located at:
INFO : BSG_KSCrashReport.c (1557): void bsg_kscrashreport_writeStandardReport(BSG_KSCrash_Context const, const char *const): Writing crash report to /Users/michael/Library/Developer/CoreSimulator/Devices/D03AA692-4863-4625-BD1D-6DEEA07C3242/data/Containers/Data/Application/B42CF986-7D0E-439D-8B49-7EA817DE7028/Library/Caches/KSCrashReports/LINK Hotel/LINK Hotel-CrashReport-7E00B6D1-74B3-4B5D-97CD-88E896696691-e-u-TypeError.json
INFO : BSG_KSCrashReport.c (1557): void bsg_kscrashreport_writeStandardReport(BSG_KSCrash_Context *const, const char *const): Writing crash report to /Users/michael/Library/Developer/CoreSimulator/Devices/D03AA692-4863-4625-BD1D-6DEEA07C3242/data/Containers/Data/Application/B42CF986-7D0E-439D-8B49-7EA817DE7028/Library/Caches/KSCrashReports/LINK Hotel
/LINK Hotel*-CrashReport-A27194C1-044B-4664-91AD-CF8296BE26D6-e-u-TypeError.json
2019-10-08 12:08:01.772 [error][tid:com.facebook.react.JavaScript] TypeError: undefined is not an object (evaluating 'e._children.forEach')

This error is located at:
in A
in RCTView
in h
in RCTView
in n
in _
in p
in withDeviceRegistration(p)
in _
in RCTView
in n
in f
in b
in n
in RCTView
in RCTView
in h
2019-10-08 12:08:01.775 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'e._children.forEach')

This error is located at:
in A
in RCTView
in h
in RCTView
in n
in _
in p
in withDeviceRegistration(p)
in _
in RCTView
in n
in f
in b
in n
in RCTView
in RCTView
in h
2019-10-08 12:08:01.778621+0300 LINK Hotel[39086:5423184] ** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'e._children.forEach')

This error is located at:
in A
in RCTView
in h
in RCTView
in n
in _
in p
in withDeviceRegistration(p)
in _
in RCTView
in n
in f
in b
in n
in RCTView
in RCTView
in h', reason: 'Unhandled JS Exception: TypeError: undefined is not an object (evaluating 'e._children.forEach')

This error is located at:
in A
in RCTView
in h
in RCTView
..., stack:
gt@96:22301
forEach@:
gt@96:22309
Di@96:60682
Fl@96:76271
Fl@:
unstable_runWithPriority@171:3915
Dl@96:74539
Dl@:
Pl@96:65839
Pl@:
@96:25495
unstable_runWithPriority@171:3915
sn@96:25442
cn@96:25377
_e@96:88610
Ne@96:13582
Ue@96:13755
receiveTouches@96:14547
value@38:3685
@38:841
value@38:2939
value@38:813
value@:
'
* First throw call stack:
(
0 CoreFoundation 0x00000001142766fb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x000000011246dac5 objc_exception_throw + 48
2 LINK Hotel* 0x000000010ddb6076 RCTFormatError + 0
3 LINK Hotel* 0x000000010de2b961 -[RCTExceptionsManager reportFatalException:stack:exceptionId:] + 508
4 CoreFoundation 0x000000011427d4cc __invoking___ + 140
5 CoreFoundation 0x000000011427aa45 -[NSInvocation invoke] + 325
6 CoreFoundation 0x000000011427ae96 -[NSInvocation invokeWithTarget:] + 54
7 LINK Hotel* 0x000000010dde9e80 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 578
8 LINK Hotel* 0x000000010ddec12e _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 246
9 LINK Hotel* 0x000000010ddebeb6 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 78
10 libdispatch.dylib 0x0000000116c6dd7f _dispatch_call_block_and_release + 12
11 libdispatch.dylib 0x0000000116c6edb5 _dispatch_client_callout + 8
12 libdispatch.dylib 0x0000000116c76225 _dispatch_lane_serial_drain + 778
13 libdispatch.dylib 0x0000000116c76e9c _dispatch_lane_invoke + 425
14 libdispatch.dylib 0x0000000116c80ea3 _dispatch_workloop_worker_thread + 733
15 libsystem_pthread.dylib 0x000000011704f611 _pthread_wqthread + 421
16 libsystem_pthread.dylib 0x000000011704f3fd start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
-->

Bug Stale

Most helpful comment

Found the problem.
Its react-native-text-gradient patch which meddled with the code.
After fixing it myself the above problem vanished. And it's now good to go.

All 9 comments

also what I see for example project in release mode (for debug mode - all good)

Screenshot at Oct 08 15-22-20

I'm seeing a similar crash in release when upgrading from 59.4 -> 60.5

Based on the stack trace, it looks like it has to do with react-navigation. What navigation version are you using?

Edit: Still working through this, but doesn't seem to be an issue with react-navigation. Having just a basic view renders fine in release mode, but when i have my view that's more complex and includes a FlatList, it crashes immediately and doesn't render any text

Seeing the same crash. Just after launching the splash screen in only release mode. Debug seems to do fine. Reproduced in simulator to find this same error.
Here is my log:
`2019-10-22 12:43:40.360 [error][tid:com.facebook.react.JavaScript] TypeError: undefined is not an object (evaluating 'e._children.forEach')

This error is located at:
in Connect(n)
in p
in p
in C
in P
in n
in Connect(n)
in RCTView
in l
in l
in RCTView
in RCTView
in h

This error is located at:
in P
in n
in Connect(n)
in RCTView
..., stack:
gt@94:22301
forEach@:
gt@94:22309
forEach@:
gt@94:22309
forEach@:
gt@94:22309
forEach@:
gt@94:22309
Di@94:60682
Fl@94:76271
Fl@:
unstable_runWithPriority@169:3915
Dl@94:74539
Dl@:
Pl@94:65839
Pl@:
@94:25495
unstable_runWithPriority@169:3915
sn@94:25442
cn@94:25377
kl@94:64831
enqueueSetState@94:31251
setState@61:2074
dispatch@452:1477
@416:741
syncData@1223:654
@1223:1035
y@112:661
callTimers@112:2718
value@24:3685
@24:841
value@24:2939
value@24:813
value@:
'
* First throw call stack:
(
0 CoreFoundation 0x000000010b7db6fb __exceptionPreprocess + 331
1 libobjc.A.dylib 0x000000010bf3dac5 objc_exception_throw + 48
2 ProjectName 0x0000000104011132 RCTFormatError + 0
3 ProjectName 0x0000000104086e61 -[RCTExceptionsManager reportFatalException:stack:exceptionId:] + 508
4 CoreFoundation 0x000000010b7e24cc __invoking___ + 140
5 CoreFoundation 0x000000010b7dfa45 -[NSInvocation invoke] + 325
6 CoreFoundation 0x000000010b7dfe96 -[NSInvocation invokeWithTarget:] + 54
7 ProjectName 0x0000000104045350 -[RCTModuleMethod invokeWithBridge:module:arguments:] + 578
8 ProjectName 0x00000001040475fe _ZN8facebook5reactL11invokeInnerEP9RCTBridgeP13RCTModuleDatajRKN5folly7dynamicE + 246
9 ProjectName 0x0000000104047386 ___ZN8facebook5react15RCTNativeModule6invokeEjON5folly7dynamicEi_block_invoke + 78
10 libdispatch.dylib 0x000000010e67dd7f _dispatch_call_block_and_release + 12
11 libdispatch.dylib 0x000000010e67edb5 _dispatch_client_callout + 8
12 libdispatch.dylib 0x000000010e686225 _dispatch_lane_serial_drain + 778
13 libdispatch.dylib 0x000000010e686e9c _dispatch_lane_invoke + 425
14 libdispatch.dylib 0x000000010e690ea3 _dispatch_workloop_worker_thread + 733
15 libsystem_pthread.dylib 0x000000010ea66611 _pthread_wqthread + 421
16 libsystem_pthread.dylib 0x000000010ea663fd start_wqthread + 13
)
libc++abi.dylib: terminating with uncaught exception of type NSException
`

Found that the Text component is making the problem. After removing it app works but no text components present. Can anyone help to solve this problem. Thank you. I will try on my end as well.

Found the problem.
Its react-native-text-gradient patch which meddled with the code.
After fixing it myself the above problem vanished. And it's now good to go.

@cybersgk great catch! Totally forgot this project was patching the renderer for react-native-gradient-text

updated patch snippet

@cybersgk thanks a lot!

Hey there, it looks like there has been no activity on this issue recently. Has the issue been fixed, or does it still require the community's attention? This issue may be closed if no further activity occurs. You may also label this issue as a "Discussion" or add it to the "Backlog" and I will leave it open. Thank you for your contributions.

Closing this issue after a prolonged period of inactivity. If this issue is still present in the latest release, please feel free to create a new issue with up-to-date information.

Was this page helpful?
0 / 5 - 0 ratings