software-mansion-labs / react-native-turbo-demo

React Native Turbo - an open source library that can bring your turbo-enabled web application into the React Native world.
MIT License
95 stars 12 forks source link

is there a working version? #125

Closed cspeer closed 5 months ago

cspeer commented 5 months ago

Hi,

I absolutely love the idea of this project and am very grateful for all the work you've already put into this. I cannot, however, seem to make it work. I've almost everything I could find, but was unable to get it to work with either your example/, @pklatka's example project, nor in my own code. The errors thrown, if any, are vastly different. Right now I'm at a point where the app will launch and then just throw a white/blank screen without apprently loading the turbo native demo website. Nothing is shown in the console, so I'm at a complete loss here.

I understand that this is a work in progress, but from the docs and other users here I can see that it is working in some cases. So, is there some kind of a proven way to make this work? I'd really love to use this!

Thanks a bunch!

pfeiffer commented 5 months ago

Hey! We're sponsoring the maintainer's development of this package and using it in an almost complete app, so I can confirm that it indeed is working. The app is relatively complex in terms of navigation patterns and uses Strada components to handle a lot of native features (IAP, Push etc.), so it's definitely feasible to get a proper working app.

We're extracting a lot of the changes and fixes that we've made back into the library as we go. For now, using the main branch is recommended; the released packages are not stable.

We've found that Turbo Native (be that the native iOS or Android or the React Native implementation) requires some customization the Rails side as well; we're considering releasing those customizations as a gem or at least wrap up a wiki/blog that outlines those changes. To name a few examples is to use the "magic" URL redirects (recede_historical_location, ..) from Turbo as well as customize redirection behaviors quite a bit, so that every redirect_to .. redirects by outputting a HTML page that triggers Turbo.visit(..), as otherwise the Turbo Native libraries are not able to properly handle redirects.

cspeer commented 5 months ago

Hi @pfeiffer ,

thanks for the speedy reply.

Yes, I'm currently using these commits in my package.json:

"react-native-turbo": "https://gitpkg.now.sh/software-mansion-labs/react-native-turbo-demo/packages/turbo?e5a61f5ada83c7cdae1e3ce7b56411cda6c0bb8f",
"react-native-web-screen": "https://gitpkg.now.sh/software-mansion-labs/react-native-turbo-demo/packages/navigation?e5a61f5ada83c7cdae1e3ce7b56411cda6c0bb8f",

Would you recommend I use a different commit?

antonborgstrom commented 5 months ago

I agree, very grateful for the hard work you are putting into this project! Good job!

We are using an older version from last year in production, so it is indeed working. However, it is a bit problematic and unpredictable to use the main branch in production. Do you plan on tagging a stable release anytime soon @pfeiffer?

pfeiffer commented 5 months ago

We are using an older version from last year in production, so it is indeed working. However, it is a bit problematic and unpredictable to use the main branch in production. Do you plan on tagging a stable release anytime soon @pfeiffer?

Yup, I expect at least an initial "stable" version will be available soon™️ :-)

pfeiffer commented 5 months ago
"react-native-turbo": "https://gitpkg.now.sh/software-mansion-labs/react-native-turbo-demo/packages/turbo?e5a61f5ada83c7cdae1e3ce7b56411cda6c0bb8f",
"react-native-web-screen": "https://gitpkg.now.sh/software-mansion-labs/react-native-turbo-demo/packages/navigation?e5a61f5ada83c7cdae1e3ce7b56411cda6c0bb8f",

Would you recommend I use a different commit?

We're using these for the time being:

"react-native-turbo": "https://gitpkg.now.sh/software-mansion-labs/react-native-turbo-demo/packages/turbo?193c1c6",
"react-native-web-screen": "https://gitpkg.now.sh/software-mansion-labs/react-native-turbo-demo/packages/navigation?193c1c6",

.. bumping these as we land new patches to the main branch.

cspeer commented 5 months ago

Thanks a lot @pfeiffer. Very much looking forward to a (somwhat) stable release! Would you mind sharing your package.json? I'm now using the above mentioned commits but am still running into exceptions, the latest of which is

TypeError: Cannot read property 'getSessionHandles' of null, js engine: hermes

So, taking a look at the other packages, especially the react-native one, would be great. Thanks!

pfeiffer commented 5 months ago

That sounds to me like a missing pod install? We're using Expo SDK 50, eg:

"expo": "~50.0.7",
"react-native-turbo": "https://gitpkg.now.sh/software-mansion-labs/react-native-turbo-demo/packages/turbo?193c1c6",
"react-native-web-screen": "https://gitpkg.now.sh/software-mansion-labs/react-native-turbo-demo/packages/navigation?193c1c6",
"react-native": "0.73.4",

and building via npx expo run:ios.

I've seen from time to time that using the packages via gitpkg can cause some inconsistencies, in that case I typically remove both the node_modules folder and ios/android folders and refetch all dependencies via yarn install and do a clean Expo build using the above command.

cspeer commented 5 months ago

It's finally working! I think the problem was a whole bunch of outdated expo packages and probably an older node version. I've been trying to get it to work in my existing project, so lots of legacy code and packages. Thanks a bunch @pfeiffer!