Skip to content
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

Feature req: Expo support for React Native library #1174

Closed
paolodamico opened this issue Jul 8, 2020 · 23 comments
Closed

Feature req: Expo support for React Native library #1174

paolodamico opened this issue Jul 8, 2020 · 23 comments
Labels
enhancement New feature or request libraries Related to client libraries (except posthog-js)

Comments

@paolodamico
Copy link
Contributor

**Is your feature request related to a problem? The React Native library cannot run on Expo's stand-alone apps because as mentioned here, managed apps cannot link native dependencies.

Describe the solution you'd like Direct integration via the Expo SDK.

Describe alternatives you've considered Doing a manual integration via the API, but it would take too much time and most of the benefits of the capturing library would be lost.

Additional context Building with Expo is a very convenient way to deploy native apps, I would imagine a number of apps run on their managed workflow.

Thank you for your feature request - we love each and every one!

@paolodamico paolodamico added the enhancement New feature or request label Jul 8, 2020
@timgl
Copy link
Collaborator

timgl commented Jul 13, 2020

Thanks for creating this issue! Expo support would be awesome

@mariusandra Any idea what would be required to do this?

@mariusandra
Copy link
Collaborator

Hi @timgl - We should totally do this, yet it's a non-trivial amount of work to get a RN library that's at parity with the current native client libraries with regards to autocapture.

The native libraries provide us with a stream of tap and screenview events, which we won't be able to get with RN alone.

Heap had to do quite a bit of innovative engineering to add this support. We could do something similar though. I'm pretty comfortable with AST trees by now :).

Alternatively, it should be possible to use the existing posthog-node library to manually capture events... and with a bit of tinkering the upcoming posthog-js-lite library should also work. However those will not give the autocapture or feature flag options.

@Immortalin
Copy link

@adjwills
Copy link

adjwills commented Jan 18, 2021

Hi just wanted to add a vote on this req. Would be really useful for us to have Expo integration, trying the posthog-node lib on expo but obviously this misses some really great features like auto-capture.

Also FYI, papercups got a fair few requests for expo integration https://news.ycombinator.com/item?id=24226979 and prioritised it pretty quick https://news.ycombinator.com/item?id=24226979. Expo is attractive for smaller teams wanting to avoid codebase fragmentation. On the assumption that posthog appeals to a similar base it would be a win.

@mariusandra
Copy link
Collaborator

Hey @adjwills , thanks for the vote! I think we don't have enough bandwidth to squeeze this into the current sprint/release, as it's quite a bit of work to get done, especially for autocapture (see what heap had to do to get this working), but we'll definitely take note of this!

@adjwills
Copy link

adjwills commented Jan 18, 2021

Hey @mariusandra , thanks for the response! Totally understand that this is a fair bit of work, it will certainly be really useful to us if/when it's available.

For now we'll look at a more minimal implementation with the existing posthog-node library, that looks like the best route to me. Assuming that works well we'd be keen to capture more value from the autocapture features etc. (I've tested all those with a react-js web build and am super impressed with what you guys have built!)

@paolodamico
Copy link
Contributor Author

+1 from user request.

@anandvc
Copy link

anandvc commented Apr 6, 2021

+1 for Expo support with autocapture/session-recordings from my team's side as well.

@krschacht
Copy link

+1 for Expo support

@Chapnik13
Copy link

+1 For Expo support

@tachyon-ops
Copy link

+1 for Expo support

2 similar comments
@dqii
Copy link

dqii commented Oct 13, 2021

+1 for Expo support

@Eric-Hei
Copy link

+1 for Expo support

@paolodamico
Copy link
Contributor Author

Looks like we have some interest thing @yakkomajuri

@paolodamico paolodamico added libraries Related to client libraries (except posthog-js) and removed team-platform feature/ingestion labels Feb 23, 2022
@krschacht
Copy link

FYI for others: we got it working in Expo for the time being by creating two of our own server endpoint (in ruby). Our expo client hits our endpoint to get a distinct key, the front-end saves this. Then each time we want to log an event, we hit our own API endpoint. Our server uses the Ruby PostHog client and creates a PostHog event using this server-side system.

It was about 20 lines of code total. Not the most elegant but it got things working!

@dakshshah96
Copy link

+1 for Expo support

@jokull
Copy link

jokull commented May 26, 2022

Expo support would be huge.

@TijsM
Copy link

TijsM commented Jun 14, 2022

+1 for Expo support

@kovilsingh
Copy link

@paolodamico would we have this anytime soon?

+1 for expo support!

@mariusandra
Copy link
Collaborator

YES! We're actively working on it: PostHog/posthog-js-lite#4

CC @benjackwhite

@benjackwhite
Copy link
Contributor

Ooh I didn't see this issue 😅 I am indeed hot on the heels of this issue and will be looking for testers shortly.

Stay tuned... I'll post here once we have something on npm for testing 💪

@benjackwhite
Copy link
Contributor

For anybody who is subscribed to this issue - it's here! [email protected] is out and is 100% pure React Native, utilizing only standard expo libraries to get access to the bits of native functionality it needs to do its job.
It has all the important stuff it used to have as well as...

  • Better feature flags implementation including authentication persistence and helpful hooks
  • Much better Screen tracking hooking into @react-native-navigation/native
  • Autocapture for touches
  • Support for managed Expo projects (no ejecting!)

Now that this is fully JS (well, Typescript) based it is easier than ever for us to improve things and iterate so speak up if there's something missing!

Check out the docs for more info

🙌

@paolodamico
Copy link
Contributor Author

Amazing news @benjackwhite! Guess we can close this now 🎊

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request libraries Related to client libraries (except posthog-js)
Projects
None yet
Development

No branches or pull requests