react-sdk icon indicating copy to clipboard operation
react-sdk copied to clipboard

[BUG] Unable to integrate with Expo

Open erwin-wijaya opened this issue 1 year ago • 12 comments

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

  1. have an app that is managed by Expo
  2. Initialize Optimizely
  3. 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

erwin-wijaya avatar Apr 11 '24 14:04 erwin-wijaya

Hi @erwin-wijaya

Thanks for reporting your findings.

Can I suggest 2 items:

  1. Can you try v3.1.0 that we released yesterday?
  2. Can you post a (sanitized) stacktrace to see a bit more detail? ...especially around @react-native-community/netinfo which we'll need to understand the use a bit more

mikechu-optimizely avatar Apr 11 '24 14:04 mikechu-optimizely

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

erwin-wijaya avatar Apr 11 '24 16:04 erwin-wijaya

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?

mikechu-optimizely avatar Apr 12 '24 13:04 mikechu-optimizely

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

erwin-wijaya avatar Apr 12 '24 15:04 erwin-wijaya

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.

mikechu-optimizely avatar Apr 12 '24 15:04 mikechu-optimizely

hey @mikechu-optimizely do you know where I can follow the ticket along? And is there any update on this?

erwin-wijaya avatar Apr 22 '24 19:04 erwin-wijaya

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.

mikechu-optimizely avatar Apr 23 '24 13:04 mikechu-optimizely

We're still seeing a problem in React Native projects... More research needed...

mikechu-optimizely avatar Apr 23 '24 20:04 mikechu-optimizely

@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 avatar Jun 24 '24 12:06 junaed-optimizely

@junaed-optimizely

  • it was 50.0.8
  • that package is handled by expo, so nto quite sure
  • yes

erwin-wijaya avatar Jun 24 '24 13:06 erwin-wijaya

  • You have to install both @react-native-async-storage/async-storage & @react-native-community/netinfo in 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

junaed-optimizely avatar Jun 24 '24 13:06 junaed-optimizely

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.

erwin-wijaya avatar Jun 24 '24 15:06 erwin-wijaya

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!

junaed-optimizely avatar Nov 14 '24 13:11 junaed-optimizely

Hey @erwin-wijaya , Here is an example implementation of React SDK with Expo v50 - Example Repo

Let me know if it helps.

Thanks!

junaed-optimizely avatar Nov 15 '24 11:11 junaed-optimizely

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!

junaed-optimizely avatar Nov 22 '24 15:11 junaed-optimizely