-
Notifications
You must be signed in to change notification settings - Fork 1.8k
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
import NativeMethodsMixin & requireNativeComponent failed #507
Comments
Hmm, React Native doesn't export |
Yeah, RN packager supports haste ( with providesModule declare ). And I agree with you that the APIs don't make sense. |
I'm going to close this because a) RN doesn't explicitly export |
I think a custom webpack plugin that resolves I have mixed feelings about |
@L1fescape , WRT " it'd still be very convenient to use libraries that don't currently target web". You were right...
Seems like I have rewrite my app to remove usage of RNMK (at least for the web). |
It's used in popular library react-native-svg and it's really not possible not use svg. Any work around for by pass this error? |
Fixes #13 for real Fixes react-navigation/react-navigation#5004 Use different `index.js` files for supported and unsupported platforms. Tested on iOS and on an existing web project that uses react-navigation. --- !['react-native' does not contain an export named 'requireNativeComponent'.](https://user-images.githubusercontent.com/619186/46323012-8164e300-c5c2-11e8-964e-b6f233776dab.png) Necolas explained here that this import should not be on any file that runs on web: necolas/react-native-web#507 (comment)
@hiteshagja I had same problem, I used babel module resolver and react-native-svg-web in my babel.config.js to overcome this. module.exports = (api) => { |
Below can fix requireNativeComponent, and you can also modify it to fix NativeMethodsMixin too npm install --save-dev react-app-rewired Create a
Also create a
Now you can just run |
Fixes #13 for real Fixes react-navigation/react-navigation#5004 Use different `index.js` files for supported and unsupported platforms. Tested on iOS and on an existing web project that uses react-navigation. --- !['react-native' does not contain an export named 'requireNativeComponent'.](https://user-images.githubusercontent.com/619186/46323012-8164e300-c5c2-11e8-964e-b6f233776dab.png) Necolas explained here that this import should not be on any file that runs on web: necolas/react-native-web#507 (comment)
Fixes #13 for real Fixes react-navigation/react-navigation#5004 Use different `index.js` files for supported and unsupported platforms. Tested on iOS and on an existing web project that uses react-navigation. --- !['react-native' does not contain an export named 'requireNativeComponent'.](https://user-images.githubusercontent.com/619186/46323012-8164e300-c5c2-11e8-964e-b6f233776dab.png) Necolas explained here that this import should not be on any file that runs on web: necolas/react-native-web#507 (comment)
It turns out to be error when use:
Is there any better way to access the private class( never export ) such as
NativeMethodsMixin
?eg:
Thanks
The text was updated successfully, but these errors were encountered: