segmentio / analytics-react-native

The hassle-free way to add analytics to your React-Native app.
https://segment.com/docs/sources/mobile/react-native/
MIT License
354 stars 182 forks source link

Cannot read property 'SovranStorage' of undefined #851

Closed blyszcz closed 1 year ago

blyszcz commented 1 year ago

I'm opening this issue as the previous one has been closed Platform: iOS React native version: 0.71.6 Analytics version: 2.15.0

I have successfully installed all the required dependencies, including @segment/analytics-react-native @segment/sovran-react-native react-native-get-random-values. However, when I attempt to initialize the client in my App.tsx file using the following code:

createClient({
  writeKey: SEGMENT_WRITE_KEY,
  trackAppLifecycleEvents: true,
});

I am faced with an error message stating Error: Native module not found.

Similarly, when I try to initialize the client later on and invoke the track function as shown below:

let segmentClient = createClient({
  writeKey: SEGMENT_WRITE_KEY,
  trackAppLifecycleEvents: true,
});
segmentClient.track('test', {testTwo: 'test2'});

The following error is thrown [TypeError: Cannot read property 'SovranStorage' of undefined].

I would greatly appreciate it if you could provide further assistance on how to resolve this issue and get it working properly.

I have also sent an email to friends@segment.com, providing the same details. However, I believe it would be beneficial to also address the issue here, as it can help other individuals who may encounter the same problem in the future.

PS. On a side note, I noticed a discrepancy in your documentation. The page located at https://app.segment.com/[companyName]/sources/[source-name]/overview does not mention anything about installing react-native-get-random-values, which was the first issue I encountered.