alinz / react-native-webview-bridge

React Native Webview with Javascript Bridge
MIT License
1.37k stars 492 forks source link

TyperError: Cannot read property 'NavigationType' of undefined #223

Open znafets opened 7 years ago

znafets commented 7 years ago

Hi, I trying to use this bridge in my project, but fail to understand why I get the error above ... Assuming this lib should work as is. So why does it not? ... unless this project is not maintained anymore?

I am using the latest stable version of react-native

feixue1232 commented 7 years ago

I also have the problem, who can help me to reslove it ? thanks

gerow-x commented 7 years ago

@znafets @feixue1232 run a command such as the following: $ react-native link

rolandfromrobin commented 7 years ago

I'm running into the same issue :/ @471685249 I tried setting up a new project to verify this, linked the library, got the following result:

rnpm-install info Linking react-native-webview-bridge android dependency rnpm-install info Android module react-native-webview-bridge has been successfully linked rnpm-install info Linking react-native-webview-bridge ios dependency rnpm-install info iOS module react-native-webview-bridge has been successfully linked

However, when I run the code, I still get the same error. Whenever I compile, I get about 32 of these errors complaining about duplicate declarations in the webview-bridge module:

In file included from /Users/.../Documents/Projects/.../node_modules/react-native-webview-bridge/ios/RCTWebViewBridgeManager.m:15: ../../../node_modules/react-native/React/Base/RCTBridge.h:176:53: error: property has a previous declaration @property (nonatomic, copy, readonly) NSDictionary *launchOptions;

Any thoughts? Cheers!

ruridge commented 7 years ago

I'm stuck with the same error: Cannot read property 'NavigationType' of undefined I've run react-native link successfully which now gives the following output:

rnpm-install info iOS module react-native-touch-id is already linked
rnpm-install info Android module react-native-vector-icons is already linked
rnpm-install info iOS module react-native-vector-icons is already linked
rnpm-install info Android module react-native-webview-bridge is already linked
rnpm-install info iOS module react-native-webview-bridge is already linked
rnpm-install info Linking assets to ios project
rnpm-install info Linking assets to android project
rnpm-install info Assets have been successfully linked to your project

react 16.0.0-alpha.6 react-native 0.44.0 react-native-webview-bridge 0.33.0

QQizi commented 7 years ago

Same here, screen of the error react-native link have been successfully done

vagnerSl commented 7 years ago

=(

trops commented 7 years ago

agreed, getting the NaviationType undefined error as well.

rolandfromrobin commented 7 years ago

I was able to link the module by calling react-native link after installing. Make sure your link succeeded by checking (in XCode) that your project has the following library under the Libraries folder: React-Native-Webview-Bridge.xcodeproj. If not, add it. Then, click on your project, go to the General tab, and scroll down to Linked Frameworks and Libraries. Make sure libReact-Native-Webview-Bridge.a is on the list. If it isn't, add it using the + sign. After the link is successful, you'll still get a bunch of duplicate definition errors in iOS when trying to run from XCode (i listed it above). It looks like the project is importing some libraries that react-native is already importing, resulting in a conflict. I was able to fix these by using the following steps:

Open XCode, and make the following amendments:

1) remove #import <React/RCTView.h> from RCTView.h 2) change #import "RCTBridge.h" to #import "React/RCTBridge.h" in RCTWebViewBridgeManager.m 3) change #import <React/RCTViewManager.h> to #import "RCTViewManager.h" in RCTUIManager.h 4) change #import "RCTLog.h" to #import "React/RCTLog.h" in RCTWebViewBridge.m

I was able to run the project successfully afterwards. Hope that helps.

david-olaf commented 7 years ago

It works for me. Thanks

facuescobar commented 7 years ago

Thanks! that worked to me too!

thyzzv commented 7 years ago

Just use the latest from master also does the trick: react-native-webview-bridge "git://github.com/alinz/react-native-webview-bridge.git#master"

suwu150 commented 6 years ago

i meet it.i react-native link , But it doesn't work

  Node: 8.3.0
  Yarn: Not Found
  npm: 5.3.0
  Watchman: Not Found
  Xcode: Xcode 9.3.1 Build version 9E501
  Android Studio: 3.1 AI-173.4819257

Packages: (wanted => installed)
  react: 16.0.0 => 16.0.0
  react-native: 0.51.0 => 0.51.0