This one is a doozy. I had a simple block component built by styling a standard View
component. This was the basic idea:
const Block = withProps({ style: { height: 100, width: 100, backgroundColor: 'blue' }, })(View); export default Block;
This worked fine in debug mode. In release mode, withProps
caused a crash. Here is the trace from Xcode:
2017-09-20 21:55:25.918 [error][tid:com.facebook.react.JavaScript] undefined is not an object (evaluating 'this._currentElement = element')
2017-09-20 21:55:25.921 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: undefined is not an object (evaluating 'this._currentElement = element')
2017-09-20 21:55:25.929 RecomposeBug[67656:3088671] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: undefined is not an object (evaluating 'this._currentElement = element')', reason: 'Unhandled JS Exception: undefined is not an object (evaluating 'this._curre..., stack:
RCTView@32853:13
mountComponent@31640:44
mountComponent@31358:53
mountChildren@32740:66
initializeChildren@32819:45
Here is the same trace when running in debug mode, but with NODE_ENV = production
.
It also works if I use a different component (i.e. Text
, ScrollView
). So this is probably a super-edge case, but still I found it in the wild. The fact that it only occurs in release mode made this one very hard to track down.
I have a repo you can use to reproduce. If you open it in Xcode and hit Play, it will crash. But you can also just wrap a View
in withProps
anywhere and it seems to crash. I also noticed that wrapping a View
in onlyUpdateForPropTypes
also has this same issue.
https://github.com/hellogerard/RecomposeBug
EDIT: Meant to add my packages:
"react": "16.0.0-alpha.12",
"react-native": "0.48.3",
"recompose": "^0.25.0"
vinnyjth, burkeshartsis, conrad-vanl, davidwoody, Lepozepo and 5 more
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4