RedwoodJs and React Native

Hi all,

I’m currently working on moving away from a MERN stack application and have come across Redwood. It looks like a fantastic option but my company is predominantly focused on React Native. After doing some research I stumbled across this github issue @redwoodjs/mobile package by pepicrft · Pull Request #1711 · redwoodjs/redwood · GitHub where @thedavid suggested I make a post here.

Im a mobile developer and happy to get my hands dirty but would like to hear from anyone else who has already spent significant time thinking about the problem. Ideally brainstorming out an RFC and breaking up into tasks so a proof of concept can be constructed should be next steps.

Cheers,
-Sean

2 Likes

I’ve thought about it a bit as I have an pretty big Redwood API which talks to a pretty complex Expo app. I put a bit of time into integrating Expo as a side once, before opting for a separate repo.

There’s quite a few sets of ‘parallel but different’ systems like the Redwood Router and RN Navigation’s navigation definitions or RNW vs the Redwood Web implementation which I am unsure if they can be reasonably reconciled without ceding too much control to make a quality app.

That said, the technique which has been knocking around in my head lately is that the redwood API could generate an npm module during builds, which the app can consume to get a manifest of all the important routes/queries/types/data models. This would act as the conduit for the ‘convention’ parts of Redwood.

Then a set of client-side components for bootstrapping consistent API clients etc can be added as something like @redwood/mobile lowering the barrier for communication between the different parts of the system.

5 Likes

Thanks for jumping in here @SeanDunford! This is outside my technical knowledge but hopefully I can connect some dots for folks here. Figuring out mobile integration is going to be a decent amount of upfront work.

But having multiple clients that can easily interact with your API has been a crucial part of the larger vision of Redwood from the very beginning. It was also perennially put off as a post-v1 feature and we’re already living in the future with Redwood v2.

Prior Art on a Redwood Mobile Package

There’s been occasional discussion around the topic, but mostly in regards to the concept of what is a side in Redwood. Aside from that, the GitHub issue you linked was the first attempt at implementing the functionality.

If you haven’t seen it yet, here’s a forum discussion from @pepibumur (pepicrft on GitHub) with more of his thoughts around the potential @redwoodjs/mobile package. Pedro also opened a discussion on the React Native Community’s Discussions and Proposals Repo.

Since I have no experience with mobile, React Native, or Expo, I’m ensure of the feasibility or likelihood of any changes making it back upstream. Not sure if you’ve seen that discussion @orta, it’s over a year old, but you’d definitely have a better read on the room there than I would.

Next Steps and RFC

Either way, though, let us know Pedro if you’ve given any more thought to this or were still interested in contributing. I love @SeanDunford’s idea of an RFC and I encourage anyone else to share their thoughts here.

Right now the Redwood+Expo example Orta shared is the only other proof of concept that I’m aware of, so I would also be curious to hear from Pedro if he has any thoughts on Orta’s approach/suggestion of generating an npm module during builds.

I’ve got little to no experience with mobile app development. And even though I’m part of the RW core team, this is my own thoughts, and not representative of the Core team’s view on this.

When thinking about a mobile side, I’d focus on api+mobile and see how those two sides could work together. I wouldn’t worry about sharing routes between web and mobile for example. Basically approach this as if mobile and api were the two first sides we had. What would be the ideal DX be if that was our starting point?

3 Likes

Thanks everybody for contributing. I think @orta 's suggestions is probably the most pragmatic approach.

I’m still very new to Redwood, so not sure i’m the best to lead here. I’m going to make some sample Redwood apps to get familiar with the framework.

this is :fire:

@SeanDunford Thank you for getting this conversation started. I just messaged some others that I know are interested as well.

1 Like

Looks like there’s a project called Solito that worked on unifying navigation for web and React-native (with or without Expo). Might be worth investigating.

2 Likes

I listened to a talk at ReactSummit in Amsterdam a week ago where they mentioned GitHub - software-mansion-labs/react-native-url-router: A new way to create navigation in react-native as a way to have the same router for both web and mobile. But I think we’re pretty set on using our own router for React (web) now. So if anything the other points in that same talk about the challenges about building a router and handling navigation across both web and mobile can help us make Redwood Router work on mobile too, if that’s a path we want to explore.

This was the talk, but it’s not public yet (will be in 24 days when I write this) https://portal.gitnation.org/contents/react-native-everywhere

@SeanDunford Thanks a lot for that link to Solito

I spent some time looking more into what Solito was all about yesterday, and especially the conf talk linked from their readme

If Redwood can do an integration between Redwood’s web side and RN like what he did, I really think that would be awesome! And also totally doable. I’ll bring it up with the core team and see what they say about it.

1 Like

@Tobbe just watched the beginning of his about navigation. This already looks very similar to redwood router. This would be an awesome project to work on.

1 Like