Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

IOS: [tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: undefined is not an object (evaluating 'a.View.propTypes.style') #294

Open
NazarK opened this issue Jan 16, 2018 · 18 comments

Comments

@NazarK
Copy link

NazarK commented Jan 16, 2018

this line caused my app to crash (strangely worked fine in debug build and crashed in release), seems they renamed View.propTypes.style (as temporary fix I just removed this line in my ./node_modules/)

style: View.propTypes.style,

@NazarK NazarK changed the title [tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: undefined is not an object (evaluating 'a.View.propTypes.style') IOS: [tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: undefined is not an object (evaluating 'a.View.propTypes.style') Jan 16, 2018
@kayzenkayzen
Copy link

Some issue.

How to fix it without node modules changes?

@aramkarapetian
Copy link

Fork and set source to your repo instead.

@NazarK
Copy link
Author

NazarK commented Jan 17, 2018

Yes, I forked for myself and edited package.json, like this

 "dependencies": {

    "react-native-facebook-login": "git+https://git@github.com/NazarK/react-native-facebook-login.git",

  }

@catchkuo
Copy link

catchkuo commented Feb 2, 2018

I use simulator was fine, but build to IOS device got same issue.

System group container for systemgroup.com.apple.configurationprofiles path is /private/var/containers/Shared/SystemGroup/systemgroup.com.apple.configurationprofiles
2018-02-02 17:14:25.159121+0800 YesEvent[5854:2890540] [MC] Reading from public effective user settings.
2018-02-02 17:14:25.164172+0800 YesEvent[5854:2890640] Missing server connection for kCTConnectionInvalidatedNotification
2018-02-02 17:14:25.252 [error][tid:com.facebook.react.JavaScript] undefined is not an object (evaluating 'u.View.propTypes.style')
2018-02-02 17:14:25.253616+0800 YesEvent[5854:2890650] undefined is not an object (evaluating 'u.View.propTypes.style')
2018-02-02 17:14:25.256 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: undefined is not an object (evaluating 'u.View.propTypes.style')
2018-02-02 17:14:25.256173+0800 YesEvent[5854:2890639] Unhandled JS Exception: undefined is not an object (evaluating 'u.View.propTypes.style')
2018-02-02 17:14:25.260825+0800 YesEvent[5854:2890639] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: undefined is not an object (evaluating 'u.View.propTypes.style')', reason: 'Unhandled JS Exception: undefined is not an object (evaluating 'u.View.prop..., stack:

@NazarK
Copy link
Author

NazarK commented Feb 2, 2018

this error appeared for me when I was testing "Release" build on simulator, "Debug" build didn't show this error

@acro5piano
Copy link

acro5piano commented Mar 11, 2018

I got the same error. Finally I run this script after installation (or before Release build):

# Update react-native-facebook-login
# refs:
#     - https://github.com/react-navigation/react-navigation/issues/1352
#     - https://github.com/magus/react-native-facebook-login/issues/294
perl -i -pe 's/View,$/View, ViewPropTypes,/' ./node_modules/react-native-facebook-login/index.ios.js
perl -i -pe 's/View.propTypes.style,$/ViewPropTypes,/' ./node_modules/react-native-facebook-login/index.ios.js

This is undesirable Hack but temporarily solution here.

@magus
Copy link
Owner

magus commented Mar 13, 2018

Thanks for reporting this, the fix is out in version 1.6.1!

@Soren-Knudsen
Copy link

I'm using 1.6.1 and the issue [error][tid:com.facebook.react.JavaScript] undefined is not an object (evaluating 'd.View.propTypes.style') is still present.

@acro5piano
Copy link

acro5piano commented Apr 1, 2018

@Soren-Knudsen I had this issue on 1.6.0 but after I upgraded to 1.6.1 the error disappeared.
Did you run the following commands after upgrading?

rm -rf node_modules
yarn install # or npm install
yarn start --reset-cache

@Soren-Knudsen
Copy link

@acro5piano: Thanks for a quick response. I haven't tried yarn start --reset-cache. I'll give that a go.

@Soren-Knudsen
Copy link

@acro5piano : Tried yarn cache clean && rm -fr node_modules/ && yarn && yarn start --reset-cache without luck. Still getting the error when building my project in Xcode in Release mode :(

@acro5piano
Copy link

@Soren-Knudsen Did you succeed when building in Debug mode?

@Soren-Knudsen
Copy link

@acro5piano : Yes without problems. Somehow the issue seems to persist when building it in release mode even though I cleaned out the yarn cache and reinstalled all my node modules.

@acro5piano
Copy link

acro5piano commented Apr 1, 2018

@Soren-Knudsen Hmmm that is strange.
Xcode cache might remain so ⌘ + k and ⌘ + ⇧ + k and rm -rf ~/Library/Developer/Xcode/DerivedData can help.
Also if you succeed when building Debug mode, then your problem sounds nothing to do with react-native-facebook-login.

@Soren-Knudsen
Copy link

Soren-Knudsen commented Apr 1, 2018

@acro5piano: I'm able to build it in both in Debug and Release mode, but it throws an unhandled exception in Release mode when the app starts (See snippet below).

2018-04-01 18:10:09.671 [error][tid:com.facebook.react.JavaScript] undefined is not an object (evaluating 'd.View.propTypes.style')
2018-04-01 18:10:09.674117+0200 XXXX[14390:65434] undefined is not an object (evaluating 'd.View.propTypes.style')
2018-04-01 18:10:09.677 [fatal][tid:com.facebook.react.ExceptionsManagerQueue] Unhandled JS Exception: undefined is not an object (evaluating 'd.View.propTypes.style')
2018-04-01 18:10:09.677184+0200 XXXX[14390:65389] Unhandled JS Exception: undefined is not an object (evaluating 'd.View.propTypes.style')
2018-04-01 18:10:09.678 [error][tid:com.facebook.react.JavaScript] Module AppRegistry is not a registered callable module (calling runApplication)
2018-04-01 18:10:09.678015+0200 XXXX[14390:65434] Module AppRegistry is not a registered callable module (calling runApplication)
2018-04-01 18:10:09.696658+0200 XXXX[14390:65389] *** Terminating app due to uncaught exception 'RCTFatalException: Unhandled JS Exception: undefined is not an object (evaluating 'd.View.propTypes.style')', reason: 'Unhandled JS Exception: undefined is not an object (evaluating 'd.View.prop..., stack:

Tried the following:

  • yarn cache clean && rm -fr node_modules/ && yarn && yarn start --reset-cache
  • Xcode build clean
  • rm -rf Library/Developer/Xcode/DerivedData
  • Rebooted my computer and did everything over again.

I also tried using git+https://git@github.com/NazarK/react-native-facebook-login.git without luck. Do you have any other suggestions I could try?

@acro5piano
Copy link

acro5piano commented Apr 1, 2018

@Soren-Knudsen Thanks for the detail information. I saw the error when I used 1.6.0.

At first, please ensure you successfully installed and using 1.6.1. If you run

grep viewPropTypes -r node_modules/react-native-facebook-login/

in your project root and the output is something like

node_modules/react-native-facebook-login//example/components/facebook/FBLoginMock.js:const viewPropTypes = ViewPropTypes || View.propTypes;
node_modules/react-native-facebook-login//example/components/facebook/FBLoginMock.js:    style: viewPropTypes.style,
node_modules/react-native-facebook-login//index.ios.js:const viewPropTypes = ViewPropTypes || View.propTypes;
node_modules/react-native-facebook-login//index.ios.js:  style: viewPropTypes.style,

then it's ok.

Second, which is your RN version? View.propTypes deprecated after v44 so something bad might happen before v44 (though I couldn't find anything wrong within the code).

refs:

Third, if the error cannot be delete...
Were I you I would create a script that delete the following line in node_modules/react-native-facebook-login/index.ios.js with perl or something, and run the script before Release build just for temporally solution.

style: viewPropTypes.style,

Or you can use this library, I just found.

https://github.com/reactjs/react-codemod#reactnative-view-proptypes

@Soren-Knudsen
Copy link

Steps

  1. Output from: grep viewPropTypes -r node_modules/react-native-facebook-login/
node_modules/react-native-facebook-login//example/components/facebook/FBLoginMock.js:const viewPropTypes = ViewPropTypes || View.propTypes;
node_modules/react-native-facebook-login//example/components/facebook/FBLoginMock.js:    style: viewPropTypes.style,
node_modules/react-native-facebook-login//index.ios.js:const viewPropTypes = ViewPropTypes || View.propTypes;
node_modules/react-native-facebook-login//index.ios.js:  style: viewPropTypes.style,
  1. Which is your RN version?
    • node: 9.9.0
    • react-native: 0.54.4
    • react-native-facebook-login: 1.6.1

@acro5piano: Are you able to build and run your application in release mode when using react-native ^0.54.4 with react-native-facebook-login ^1.6.1? Or are you using an older version of react-native?

@acro5piano
Copy link

@Soren-Knudsen My environment is:

  • node: 8.4.0
  • react-native: 0.52.0
  • react-native-facebook-login: ^1.6.1

Little bit older than your version of react-native.

I am able to build and run my application both in Debug mode and Release mode.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

7 participants