hotwired / turbo-android

Android framework for making Turbo native apps
MIT License
408 stars 51 forks source link

React Native #245

Closed lazaronixon closed 1 year ago

lazaronixon commented 1 year ago

Hello @jayohms, sorry I couldn't find your email so I'm trying to contact you here... I'm working in POC for a react-native wrapper for turbo, It is working fine with IOS and now I'm trying to implement it on android, but the problem I'm facing is that react-native just share a simple view, not fragments, navhost or nothing like that... Do you know if it's possible to implement it just using turboview and sessions ???

https://github.com/lazaronixon/react-native-turbo-poc/blob/master/android/src/main/java/com/reactnativeturbo/TurboViewManager.kt

pfeiffer commented 1 year ago

Hey! We are also working on using Turbo with React Native together with Software Mansion (of react-navigation, expo etc.), and currently have both iOS and Android running in a PoC. See https://github.com/software-mansion-labs/react-native-turbo-demo/

Android has proven to be significantly harder to implement than iOS, mainly due to TurboSession being marked as internal https://github.com/hotwired/turbo-android/blob/8e753ef9a2660ddf02f970e1278c7d7f866e5e1c/turbo/src/main/kotlin/dev/hotwire/turbo/session/TurboSession.kt#L40 and thus not accessible from outside code. At the moment we are using a patched version of turbo-android for the PoC.

If there's an interest in supporting this from the repo maintainer here, we'd be thrilled to submit a PR making a React Native integration possible without patches.

lazaronixon commented 1 year ago

😂 the first thing I did was remove that internal session constructor. https://github.com/lazaronixon/react-native-turbo-poc/blob/e2d5807c309170d44009d7c674c65bbb0e25344a/android/build.gradle#L138

keithrfung commented 1 year ago

Following along with this issue too looking to support React Native. Seems like the open PR's correctly help open up this library.