Skip to content
This repository was archived by the owner on Sep 10, 2022. It is now read-only.
This repository was archived by the owner on Sep 10, 2022. It is now read-only.

'withProps' on 'View' component crashes in release mode #525

@hellogerard

Description

@hellogerard

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.

screen shot 2017-09-20 at 10 03 29 pm

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"

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions