react-sdk
react-sdk copied to clipboard
[BUG] Unable to integrate with Expo
Is there an existing issue for this?
- [X] I have searched the existing issues
SDK Version
3.0.1
Current Behavior
Having an issue with @react-native-community/netinfo package. It keeps asking to be linked and still didn't work even after that
Expected Behavior
THere isn't a need to do manually linking since the latest package should able to automatically linked
Steps To Reproduce
- have an app that is managed by Expo
- Initialize Optimizely
- run the app
React Framework
react native
Browsers impacted
No response
Link
No response
Logs
No response
Severity
Blocking development
Workaround/Solution
No response
Recent Change
No response
Conflicts
No response
Hi @erwin-wijaya
Thanks for reporting your findings.
Can I suggest 2 items:
- Can you try v3.1.0 that we released yesterday?
- Can you post a (sanitized) stacktrace to see a bit more detail? ...especially around
@react-native-community/netinfowhich we'll need to understand the use a bit more
hi @mikechu-optimizely
Sounds good. I just updated the package and sitll seeing the error.
Here's the error
• Run `react-native link @react-native-community/netinfo` in the project root.
• Rebuild and re-run the app.
• If you are using CocoaPods on iOS, run `pod install` in the `ios` directory and then rebuild and re-run the app. You may also need to re-open Xcode to get the new pods.
• Check that the library was linked correctly when you used the link command by running through the manual installation instructions in the README.
* If you are getting this error while unit testing you need to mock the native module. Follow the guide in the README.
If none of these fix the issue, please open an issue on the Github repository: https://github.com/react-native-community/react-native-netinfo, js engine: hermes
Hmm 🤔 My react native knowledge is still growing. I'm not sure what the command react-native link @react-native-community/netinfo is doing.
Is there an error that shows an @optimizely reference above the provided error to give me some context?
If you remove the ReactSDK from your project, do you still get the error?
My belief is that the command react-native link @react-native-community/netinfo is an automatic way for installing native dependencies
There aren't any errors pertaining to @optimizely and also no error if I remove the SDK
Thanks @erwin-wijaya. I've created our internal work ticket FSSDK-10121 to dig deeper. We'll create a contrived Expo React Native app and pull in the latest React SDK version to test.
hey @mikechu-optimizely do you know where I can follow the ticket along? And is there any update on this?
Hi @erwin-wijaya The work ticket is internal, but I include it here for other employees to reference.
Let me ping one of our solutions architects who was working on a React Native project and see if they're seeing similar output.
We're still seeing a problem in React Native projects... More research needed...
@erwin-wijaya could you please provide some details about followings -
- Expo SDK version
- @react-native-community/netinfo package version in package.json
- Are you using dev client?
@junaed-optimizely
- it was
50.0.8 - that package is handled by expo, so nto quite sure
- yes
- You have to install both
@react-native-async-storage/async-storage&@react-native-community/netinfoin your project to setup the sdk . See Official Doc. - Then You have to build the dev client again to link dependencies automatically.
Let me know if you have done all of these and still facing issues
I had done it before, and tried linking it as well. None of that work.
As mentioned before, with expo, specifically the EAS product, we don't manage much of the packages.
Furthermore, as mentioned above, @react-native-community/netinfo doesn't require linking (please refer to this link ). Either way, I tried to link it and not linking it, and both didn't work.
UPDATE:
Sorry its been a while.
I have started working on it and I am in the process of making a POC with expo and our SDK.
I will share more details along the way.
Thanks!
Hey @erwin-wijaya , Here is an example implementation of React SDK with Expo v50 - Example Repo
Let me know if it helps.
Thanks!
Closing with the hope that the example repo would be a good enough guide / ref on how to integrate with Expo.
If you still face issues while integrating for a specific version of either Expo or netinfo, please feel free to open another issue!
Thanks!