-
Notifications
You must be signed in to change notification settings - Fork 923
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
Error: null is not an object (evaluating '_reactNative.NativeModules.RNShare.FACEBOOK') when importing library on Android. #837
Comments
I had the same problem, I linked the library manually ( |
I tried it and did'nt work. Any idea? |
I tried it... no luck... |
Same issue on both android & iOS, |
Fixed on iOS by downgrading to 3.3.3, but not on android. @MateusAndrade could you help us out ? |
Wow, I tried to reproduce this, I forgot how awfully slow npm is. Can't believe everyone doesn't use yarn, and usually I don't care at all what tools people use. But npm is just...really painfully slow. Waiting on it was the majority of the reproduction time on my machine. I was unable to reproduce with those commands (which generate an example using react-native 0.63.2, it should be noted, use I think you need to try to reproduce it with the example (and if you can reproduce it, publish that as a github project) so people can see what's wrong. Manual linking is for react-native <= 59, which is more than a year out of date, auto-linking is for everything current and stable, and seems to work for correctly configured projects, with (as far as I remember?) exactly zero reproductions of problems on correct configurations. Could be the first though: reproduce the problem in a repo and we can see |
Indeed using When comparing the new project to mine, i see that the new one contains I'm having a hard time turning my project into a minimal example (sorry about that, been trying for a few hours) because it has a lot of dependencies but it really looks like the package is not being linked correctly. |
Hi @clems36 , thanks for sharing your insights. I think we can try reproducing that with just the rn-version(which looks to be 62.2), rn-share version and other native dependencies? Would you mind sharing your Also, if you try installing the project without |
Hi @MateusAndrade , thank you for answering.
Indeed, i've tried that in the first place but then still tried to Here are my dependencies; the
|
Thank's @clems36. I saw that you are using expo, and I don't know if we are able to use But let me understand: when you remove Also, did you try the sharing module from expo? Maybe this can attend your needs while we try to find what's happening. |
Yes, no matter the version i'm facing that error when importing
Well, I just found out about that one haha, thank you! I'm guessing that module will probably work better in my environment, even though it seems to have way less features that yours (but hopefully that will be enough). I will try with that one and keep you posted! |
After hitting a few walls, i was able to successfully use |
To anyone who has this issue on bare react native, or the "bare" expo workflow, installing pods and restarting metro server resolved it. |
I got this error when I tried to include v3.8.0 in my Android project. What worked for me to overcome it:
Why 3.3.2? -> I was using this version successfully in another project a few months ago. I dunno whether it was the version, or the manual link, or something else which resolved it. Hope it helps. |
Hi, I have same issues on react-native-share@4.0.2, May I know how to link the library manually (react-native link react-native-share), I don't know how to do this? Can you teach me, thanks |
This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions. You may also mark this issue as a "discussion" and i will leave this open. |
Closing this issue after a prolonged period of inactivity. Fell free to reopen this issue, if this still affecting you. |
hey guys, on IOS, Add the following line of code to the Podfile file: |
@twp520 so you would have people ignore they have an auto-linking problem and manually link, despite that not being necessary at all over react-native 0.60? That does not seem like sound advice. Your project has a problem I think, which should be fixed, so auto-linking works |
Has anyone fixed this? |
Still not clear if this library will work in expo. I want to share post image with text on Facebook. Is there any workaround? thanks |
@karna419 if you use Expo, stick with Expo docs https://docs.expo.dev/versions/latest/react-native/share/ In general if you use Expo, whatever native module you want (this one or any other one) probably won't work unless you eject or switch to a non-managed workflow or whatever method they employ in the future. |
Hi. Thanks for your guidance. I did |
I had the same issue with android. What solved my problem was to follow the manual installation of react-native-share: |
for me, just closing the app and rebuilding using 'react-native run-android' worked. |
None of the above solutions or any others I've found work for me. |
@GieblerGary there's no other way to say it: your auto-linking is broken on android then, or you somehow are not building out the native code that you think you are building out, for android. If autolinking is working and you have actually built and installed react-native with this module installed, the native module will be there. Carefully examine the top and bottom of your build.gradle to make sure auto-linking is there https://github.com/facebook/react-native/blob/e23520bb567f5956b59fb5381ff4de3f1caaaf4f/template/android/app/build.gradle#L84 |
Steps to reproduce
Expected behaviour
It should have no problem importing it.
Actual behaviour
It triggers an error: Error: TypeError: null is not an object (evaluating '_reactNative.NativeModules.RNShare.FACEBOOK')
Environment
react-native-share
Version: 3.7.0/
The text was updated successfully, but these errors were encountered: