react-native: Release build crashes on iOS and Android. Fatal Exeption.
Is this a bug report?
Yes
Have you read the Contributing Guidelines?
Yes
Environment
Environment: OS: macOS Sierra 10.12.6 Node: 8.4.0 Yarn: Not Found npm: 5.4.1 Watchman: 4.9.0 Xcode: Xcode 8.3.3 Build version 8E3004b Android Studio: 2.3 AI-162.4069837
Packages: (wanted => installed) react: 16.0.0-beta.5 => 16.0.0-beta.5 react-native: ^0.49.3 => 0.49.3
Target Platform: iOS (8.0) Android (26)
Steps to Reproduce
- For iOS, open xcode and open the project.
- Setup release configurations.
- Connect a device, and click on run to deploy into device.
- An exception occurs with reason as follows:
'Unhandled JS Exception: undefined is not an object (evaluating 's.View.prop..., stack:
<unknown>@663:2841
i@2:553
<unknown>@661:243
i@2:553
<unknown>@660:153
i@2:553
<unknown>@304:251
i@2:553
<unknown>@12:38
i@2:553
n@2:266
global code@671:9
- For Android, setup release configurations.
- Open the Terminal and run:
sudo react-native run-android --variant=release
. - After the build is successful, the app is deployed to the connected device, then crashes with the following message (from logs):
--------- beginning of crash
10-27 17:52:08.151 18268-18313/? E/AndroidRuntime: FATAL EXCEPTION: mqt_native_modules
Process: com.storefinder_yj, PID: 18268
com.facebook.react.common.JavascriptException: undefined is not an object (evaluating 's.View.propTypes.style'), stack:
<unknown>@659:2841
i@2:565
n@2:348
t@2:210
<unknown>@657:243
i@2:565
n@2:348
t@2:210
<unknown>@656:153
i@2:565
n@2:348
t@2:210
<unknown>@302:251
i@2:565
n@2:348
t@2:210
<unknown>@12:38
i@2:565
n@2:278
t@2:210
global code@667:9
at com.facebook.react.modules.core.ExceptionsManagerModule.showOrThrowError(ExceptionsManagerModule.java:56)
at com.facebook.react.modules.core.ExceptionsManagerModule.reportFatalException(ExceptionsManagerModule.java:40)
at java.lang.reflect.Method.invoke(Native Method)
at com.facebook.react.bridge.JavaMethodWrapper.invoke(JavaMethodWrapper.java:363)
at com.facebook.react.bridge.JavaModuleWrapper.invoke(JavaModuleWrapper.java:162)
at com.facebook.react.bridge.queue.NativeRunnable.run(Native Method)
at android.os.Handler.handleCallback(Handler.java:751)
at android.os.Handler.dispatchMessage(Handler.java:95)
at com.facebook.react.bridge.queue.MessageQueueThreadHandler.dispatchMessage(MessageQueueThreadHandler.java:31)
at android.os.Looper.loop(Looper.java:154)
at com.facebook.react.bridge.queue.MessageQueueThreadImpl$3.run(MessageQueueThreadImpl.java:194)
at java.lang.Thread.run(Thread.java:761)
10-27 17:52:08.591 18268-18312/? E/ReactNativeJS: Module AppRegistry is not a registered callable module (calling unmountApplicationComponentAtRootTag)
- Following are the dependencies in
package.json
file:
"dependencies": {
"datejs": "^1.0.0-rc3",
"prop-types": "^15.6.0",
"react": "16.0.0-beta.5",
"react-native": "^0.49.3",
"react-native-elements": "^0.17.0",
"react-native-fbsdk": "^0.6.3",
"react-native-sqlite-2": "^1.5.0",
"react-native-vector-icons": "^4.4.2",
"react-navigation": "^1.0.0-beta.15",
"rn-viewpager": "^1.2.4"
}
Expected Behavior
Application should run on the device without any crashes (in release mode).
Actual Behavior
Application builds successfully and deploys onto device. Then the app crashes once it opens. Screen shots are not available since the app crashes and closes, or is just a blank screen.
Reproducible Demo
Unable to create a reproducible demo.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 47 (1 by maintainers)
This is clearly showing that some package is still using View.propTypes. I was running into this too until I did find the offending packages. Please do the following:
The first step removes all the map files so that your grep output is not flooded. You will need to reinstall node_modules later so that you get them back.
Please check thoroughly the output of the second. You can either post output here or send them to me privately. I just went through the pain myself and would like to help you.
No worries. You have to check the entire dependency tree for
All three are illegal in React 16. The fixes for those are respectively:
My approach was this. Check each of those projects on GitHub and see:
I had to do all three 😃. The tricky part was when the direct dependency was clean, but a sub-dependency was not. I then had to fork both the direct dependency and its sub-dependency, fix the issue in the sub-dependency fork, change the my fork of the main dependency to use my fork of the sub-dependency.
As you can see, a bloody pain in the proverbial backside! But once I figured out the problem, it took me just a few hours to hit them all.
Good luck!
@ujwal-setlur I checked my own code and there’s no instances of View.propTypes.
Here’s the output:
node_modules/@ptomasroos/react-native-multi-slider/DefaultMarker.js:const ViewPropTypes = require(‘react-native’).ViewPropTypes || View.propTypes; node_modules/@ptomasroos/react-native-multi-slider/MultiSlider.js:const ViewPropTypes = require(‘react-native’).ViewPropTypes || View.propTypes; node_modules/expo/node_modules/react-native-maps/lib/components/MapView.js:const viewPropTypes = ViewPropTypes || View.propTypes; node_modules/expo/node_modules/react-native-maps/lib/components/MapView.js:MapView.propTypes = propTypes; node_modules/react/cjs/react.development.js: // ReactNative
View.propTypes
have been deprecated in favor ofViewPropTypes
. node_modules/react/umd/react.development.js: // ReactNativeView.propTypes
have been deprecated in favor ofViewPropTypes
. node_modules/react-native/docs/NativeComponentsAndroid.md: …View.propTypes // include the default view properties node_modules/react-native/docs/NativeComponentsAndroid.md:MyCustomView.propTypes = { node_modules/react-native/docs/NativeComponentsIOS.md:MapView.propTypes = { node_modules/react-native/docs/NativeComponentsIOS.md:MapView.propTypes = { node_modules/react-native/docs/NativeComponentsIOS.md:MapView.propTypes = { node_modules/react-native/Libraries/Animated/src/createAnimatedComponent.js: // ReactNativeView.propTypes
have been deprecated in favor of node_modules/react-native/Libraries/Components/WebView/WebView.ios.js: decelerationRate: ScrollView.propTypes.decelerationRate, node_modules/react-native/Libraries/Lists/ListView/ListView.js: …ScrollView.propTypes, node_modules/react-native/Libraries/ReactNative/requireNativeComponent.js: // ReactNativeView.propTypes
have been deprecated in favor of node_modules/react-native/Libraries/ReactNative/verifyPropTypes.js: // ReactNativeView.propTypes
have been deprecated in favor of node_modules/react-native-invertible-scroll-view/InvertibleScrollView.js: …ScrollView.propTypes, node_modules/react-native-maps/lib/components/MapView.js:const viewPropTypes = ViewPropTypes || View.propTypes; node_modules/react-native-maps/lib/components/MapView.js:MapView.propTypes = propTypes; node_modules/react-native-progress/Bar.js:const RNViewPropTypes = ViewPropTypes || View.propTypes; node_modules/react-native-progress/Circle.js:const RNViewPropTypes = ViewPropTypes || View.propTypes; node_modules/react-native-progress/CircleSnail.js:const RNViewPropTypes = ViewPropTypes || View.propTypes; node_modules/react-native-progress/Pie.js:const RNViewPropTypes = ViewPropTypes || View.propTypes; node_modules/react-native-scrollable-mixin/package.json: “readme”: “# ScrollableMixin\n\nScrollableMixin lets your scrollable React Native components conform to a standard interface, making it easier to compose components. This lets you compose different types of ScrollView-like components while preserving theScrollView
API, including methods likescrollTo
.\n\nSee react-native-scrollable-decorator for the decorator version of this mixin.\n\n\n\n## Installation\n\nnpm install react-native-scrollable-mixin\n
\n\n## Usage\n\nAdd ScrollableMixin to your scrollable React components and implementgetScrollResponder()
, which must return the underlying scrollable component’s scroll responder.\n\n## With JavaScript classes\n\nUseObject.assign
to copy ScrollableMixin’s functions to your class’s prototype as instance methods:\n\njs\nclass InfiniteScrollView extends React.Component {\n static propTypes = {\n ...ScrollView.propTypes,\n renderScrollComponent: PropTypes.func.isRequired\n };\n\n /**\n * IMPORTANT: You must return the scroll responder of the underlying\n * scrollable component from getScrollResponder() when using ScrollableMixin.\n */\n getScrollResponder() {\n return this._scrollView.getScrollResponder();\n }\n\n setNativeProps(props) {\n this._scrollView.setNativeProps(props);\n }\n\n render() {\n let { renderScrollComponent, ...props } = this.props;\n return React.cloneElement(renderScrollComponent(props), {\n ref: component => { this._scrollView = component; },\n });\n }\n}\n\n// Mix in ScrollableMixin's methods as instance methods\nObject.assign(InfiniteScrollView.prototype, ScrollableMixin);\n
\n\n### WithReact.createClass
\n\njs\nlet ScrollableMixin = require('react-native-scrollable-mixin');\n\nlet InfiniteScrollView = React.createClass({\n mixins: [ScrollableMixin],\n\n propTypes: {\n ...ScrollView.propTypes,\n renderScrollComponent: PropTypes.func.isRequired,\n },\n\n /**\n * IMPORTANT: You must return the scroll responder of the underlying\n * scrollable component from getScrollResponder() when using ScrollableMixin.\n */\n getScrollResponder() {\n return this._scrollView.getScrollResponder();\n },\n\n setNativeProps(props) {\n this._scrollView.setNativeProps(props);\n },\n\n render() {\n var {\n renderScrollComponent,\n ...props\n } = this.props;\n return React.cloneElement(renderScrollComponent(props), {\n ref: component => { this._scrollView = component; },\n });\n },\n});\n
\n\n## Features\n\nBy mixing in ScrollableMixin, your custom component gets theScrollView
API. For example:\n\njs\nclass App extends React.Component {\n render() {\n return (\n <ListView\n ref={component => this._scrollView = component}\n renderScrollView={props => <InfiniteScrollView {...props} />}\n dataSource={...}\n renderRow={...}\n />\n );\n }\n\n _scrollToTop() {\n // By having all scrollable components conform to ScrollableMixin's\n // standard, calling `scrollTo` on your top-level scrollable component will\n // successfully scroll the underlying scroll view.\n this._scrollView.scrollTo(0, 0);\n }\n}\n
\n”, node_modules/react-native-scrollable-mixin/README.md: …ScrollView.propTypes, node_modules/react-native-scrollable-mixin/README.md: …ScrollView.propTypes, node_modules/react-native-scrollable-tab-view/package.json: “readme”: “\n## react-native-scrollable-tab-view\n\n\nThis is probably my favorite navigation pattern on Android, I wish it\nwere more common on iOS! This is a very simple JavaScript-only\nimplementation of it for React Native. For more information about how\nthe animations behind this work, check out the Rebound section of the\nReact Native Animation Guide\n\n\n## Add it to your project\n\n1. Runnpm install react-native-scrollable-tab-view --save
\n2.var ScrollableTabView = require('react-native-scrollable-tab-view');
\n\n## Demo\n<a href="https://appetize.io/embed/6qfv7eydjtm34mhn6qwj2nt3xm?embed=true&screenOnly=false&xdocMsg=true&debug=true&scale=100&deviceColor=black&orientation=portrait&device=iphone6s&osVersion=9.3&deviceId=RGV2aWNlOjU2Y2FjNTExZWQwOTM2MTEwMGRhYTNlNg&platform=ios&width=375&height=668&phoneWidth=416&phoneHeight=870&screenOffsetLeft=21&screenOffsetTop=100¶ms={}\” target="_blank">Run this example\n\n<a href="https://raw.githubusercontent.com/brentvatne/react-native-scrollable-tab-view/master/demo_images/demo.gif\“><img src="https://raw.githubusercontent.com/brentvatne/react-native-scrollable-tab-view/master/demo_images/demo.gif\” width="350">\n<a href="https://raw.githubusercontent.com/brentvatne/react-native-scrollable-tab-view/master/demo_images/demo-fb.gif\“><img src="https://raw.githubusercontent.com/brentvatne/react-native-scrollable-tab-view/master/demo_images/demo-fb.gif\” width="350">\n\n## Basic usage\n\njavascript\nvar ScrollableTabView = require('react-native-scrollable-tab-view');\n\nvar App = React.createClass({\n render() {\n return (\n <ScrollableTabView>\n <ReactPage tabLabel=\"React\" />\n <FlowPage tabLabel=\"Flow\" />\n <JestPage tabLabel=\"Jest\" />\n </ScrollableTabView>\n );\n }\n});\n
\n\n## Injecting a custom tab bar\n\nSuppose we had a custom tab bar calledCustomTabBar
, we would inject\nit into ourScrollableTabView
like this:\n\njavascript\nvar ScrollableTabView = require('react-native-scrollable-tab-view');\nvar CustomTabBar = require('./CustomTabBar');\n\nvar App = React.createClass({\n render() {\n return (\n <ScrollableTabView renderTabBar={() => <CustomTabBar someProp={'here'} />}>\n <ReactPage tabLabel=\"React\" />\n <FlowPage tabLabel=\"Flow\" />\n <JestPage tabLabel=\"Jest\" />\n </ScrollableTabView>\n );\n }\n});\n
\nTo start you can just copy DefaultTabBar.\n\n## Examples\n\nSimpleExample.\n\nScrollableTabsExample.\n\nOverlayExample.\n\nFacebookExample.\n\n## Props\n\n-renderTabBar
(Function:ReactComponent) - accept 1 argumentprops
and should return a component to use as\n the tab bar. The component hasgoToPage
,tabs
,activeTab
and\nref
added to the props, and should implementsetAnimationValue
to\n be able to animate itself along with the tab content. You can manually pass theprops
to the TabBar component.\n-tabBarPosition
(String) Defaults to\"top\"
.\n -\"bottom\"
to position the tab bar below content.\n -\"overlayTop\"
or\"overlayBottom\"
for a semitransparent tab bar that overlays content. Custom tab bars must consume a style prop on their outer element to support this feature:style={this.props.style}
.\n-onChangeTab
(Function) - function to call when tab changes, should accept 1 argument which is an Object containing two keys:i
: the index of the tab that is selected,ref
: the ref of the tab that is selected\n-onScroll
(Function) - function to call when the pages are sliding, should accept 1 argument which is an Float number representing the page position in the slide frame.\n-locked
(Bool) - disables horizontal dragging to scroll between tabs, default is false.\n-initialPage
(Integer) - the index of the initially selected tab, defaults to 0 === first tab.\n-page
(Integer) - set selected tab(can be buggy see #126\n-children
(ReactComponents) - each top-level child component should have atabLabel
prop that can be used by the tab bar component to render out the labels. The default tab bar expects it to be a string, but you can use anything you want if you make a custom tab bar.\n-tabBarUnderlineStyle
(View.propTypes.style) - style of the default tab bar’s underline.\n-tabBarBackgroundColor
(String) - color of the default tab bar’s background, defaults towhite
\n-tabBarActiveTextColor
(String) - color of the default tab bar’s text when active, defaults tonavy
\n-tabBarInactiveTextColor
(String) - color of the default tab bar’s text when inactive, defaults toblack
\n-tabBarTextStyle
(Object) - Additional styles to the tab bar’s text. Example:{fontFamily: 'Roboto', fontSize: 15}
\n-style
(View.propTypes.style)\n-contentProps
(Object) - props that are applied to rootScrollView
/ViewPagerAndroid
. Note that overriding defaults set by the library may break functionality; see the source for details.\n-scrollWithoutAnimation
(Bool) - on tab press change tab without animation.\n-prerenderingSiblingsNumber
(Integer) - pre-render nearby # sibling,Infinity
=== render all the siblings, default to 0 === render current page.\n\n## Contribution\nIssues are welcome. Please add a screenshot of bug and code snippet. Quickest way to solve issue is to reproduce it on one of the examples.\n\nPull requests are welcome. If you want to change API or making something big better to create issue and discuss it first. Before submiting PR please runeslint .
Also all eslint fixes are welcome.\n\nPlease attach video or gif to PR’s and issues it is super helpful.\n\n<a href="http://www.abeautifulsite.net/recording-a-screencast-with-quicktime/\" target="_blank">How to make video\n\n<a href="https://github.com/jclem/gifify\" target="_blank">How to make gif from video\n\n—\n\nMIT Licensed\n", node_modules/react-native-scrollable-tab-view/README.md:-tabBarUnderlineStyle
(View.propTypes.style) - style of the default tab bar’s underline. node_modules/react-native-scrollable-tab-view/README.md:-style
(View.propTypes.style) node_modules/react-native-snap-carousel/CHANGELOG.md:* UseView.propTypes.style
instead ofPropTypes.number
in styles validation (thanks @pesakitan22) node_modules/react-native-snap-carousel/src/carousel/Carousel.js: containerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, node_modules/react-native-snap-carousel/src/carousel/Carousel.js: contentContainerCustomStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, node_modules/react-native-snap-carousel/src/carousel/Carousel.js: slideStyle: Animated.View.propTypes.style, node_modules/react-native-snap-carousel/src/pagination/Pagination.js: containerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, node_modules/react-native-snap-carousel/src/pagination/Pagination.js: dotContainerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, node_modules/react-native-snap-carousel/src/pagination/Pagination.js: dotStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, node_modules/react-native-snap-carousel/src/pagination/Pagination.js: inactiveDotStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js: containerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js: inactiveStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, node_modules/react-native-snap-carousel/src/pagination/PaginationDot.js: style: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, node_modules/react-native-snap-carousel/src/parallaximage/ParallaxImage.js: containerStyle: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style, node_modules/react-native-swipeout/dist/index.js: style: (_reactNative.ViewPropTypes || _reactNative.View.propTypes).style, node_modules/react-native-swipeout/HISTORY.md:- fix: support old version react-native, support bothView.propTypes
andViewPropTypes
node_modules/react-native-swipeout/src/index.js: style: (ViewPropTypes || View.propTypes).style, node_modules/react-native-textinput-effects/lib/BaseInput.js: style: ViewPropTypes ? ViewPropTypes.style : View.propTypes.style,I had to update my dependencies to utilize the new
ViewPropTypes
convention. Curious though why does this break in release builds and not in dev builds? Would love a deeper understanding of why i only caught this when testing on our staging environments.Still facing this issue in V. 0.53.3.
I think I don’t have any dependencies using View.PropTypes but still release variant crashes. Using RN 0.51.0
Here is my output of the grep.
node_modules/react-native/Libraries/Lists/ListView/ListView.js: …ScrollView.propTypes, node_modules/react-native/Libraries/Components/WebView/WebView.ios.js: decelerationRate: ScrollView.propTypes.decelerationRate, node_modules/react-native/Libraries/ReactNative/verifyPropTypes.js: // ReactNative
View.propTypes
have been deprecated in favor of node_modules/react-native/Libraries/ReactNative/requireNativeComponent.js: // ReactNativeView.propTypes
have been deprecated in favor of node_modules/react-native/Libraries/Animated/src/createAnimatedComponent.js: // ReactNativeView.propTypes
have been deprecated in favor ofAny help would be appreciated.
Thanks.
Update: Jan 8 2017. Downgrading to RN 0.45.1 and React 16.0.0-alpha.8 solved the issue for me.
@ujwal-setlur you are right .I have solued it. I spent too much time for this problem due to another no updated module, it’s too painful , thanks so much
modify
react/index.js
For anyone using code-push and running into app crashes on launch, see this:
https://github.com/Microsoft/react-native-code-push/issues/1064
react-native-multi-slider was the cause for me with react-native@0.53.3
How I solved this:
grep -R “View.propTypes” node_modules above command fetches me list of all packages to update in my case ex. rn-viewpager,react-native-material-ui etc.
Installed and cloned these scripts. https://github.com/reactjs/react-codemod#reactnative-view-proptypes
ran command for each module found in step 1 https://github.com/reactjs/react-codemod#reactnative-view-proptypes
No those are fine. Those are packages that are trying to be backwards compatible. They first check for ViewPropStyles and then for View.propStyles if ViewPropStyles is essentially null or undefined
In my case, upgrading react-native-admob 1.3.2 to 2.0.0-beta.2 solved situation.
I’m downgrade to RN 0.45.1 to solve this.
hahaha… I can only imagine what you went through. Thanks a lot again for saving so many hours mine 😄