PostHog / posthog-js-lite

Reimplementation of posthog-js to be as light and modular as possible.
https://posthog.com/docs/libraries
MIT License
70 stars 36 forks source link

React native - ReferenceError: Property 'React' doesn't exist #298

Closed blrichards closed 1 month ago

blrichards commented 1 month ago

Bug description

As of version 3.3.7, posthog-react-native package throws the following error:

ReferenceError: Property 'React' doesn't exist
  at PostHogProvider (/node_modules/posthog-react-native/lib/posthog-react-native/src/PostHogProvider.js:1:3637)
  at renderWithHooks (/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:3657:22)
  at beginWork (/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:8752:32)
  at performUnitOfWork (/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:8317:23)
  at workLoopSync (/node_modules/react-native/Libraries/Renderer/implementations/ReactNativeRenderer-prod.js:8210:54)
...
(20 additional frame(s) were not displayed)

How to reproduce

  1. Install posthog-react-native 3.3.7 or 3.3.8 into an expo project
  2. Run the app on simulator or on device

Related sub-libraries

Additional context

Our team reverted back to version 3.3.6 and everything works fine.

Thank you for your bug report – we love squashing them!

marandaneto commented 1 month ago

hey @blrichards thanks for raising this issue and sorry about that. I think https://github.com/PostHog/posthog-js-lite/pull/299 should resolve it although everything works well locally.

marandaneto commented 1 month ago

https://github.com/PostHog/posthog-js-lite/releases/tag/posthog-react-native-v3.3.9 should fix it hopefully 🤞