0

I don't have any exercise with React Native, so I am considering it as a next technology to learn.

I know that it's a replacement for native Android and iOS apps, but I wonder, in the same time does the application developed with React Native, works as a web application as well?

I found React Native Web, so I wonder: will the same code written in React Native will work on the web, or it will require some additional modifications (if yes how complex are they)?

0

3 Answers 3

5

Not everything written for mobile in React-Native would work in web mode. It's not just because React Native Web is newer, but also because Web APIs are not equivalent to iOS/Android APIs - some features are simply not there for usage. Here is the compatibility list of React Native Web, in the official website.

The lack of supports for both Web and mobile together also needs to be considered here. Take react-native-maps for example: it's written on top of Google Map SDKs for Android and iOS, and MapKit in iOS. It's entirely dependent on the mobile ecosystem, so if you want your map feature to work in Web, you have to implement separate solution for Web only.

Overall, you need to know for each of your project requirements whether the related feature/library is supported in both web and mobile, and if there is not, do you have enough time and resource to implement the missing piece. If the answer is no, then you should separate your code base to handle web and mobile instead.

Sign up to request clarification or add additional context in comments.

3 Comments

"you have to implement separate solution for Web only" -> can you overwrite such a feature simply in react-native-for-web, so inject web-code directly? Or would you need to completely switch stacks? what do you mean by "do you have enough time and resource to implement the missing piece"? You mean extend the library by creating a plugin?
@FelixOlszewski react-native-web has documentation about this necolas.github.io/react-native-web/docs/multi-platform. You should create component targetting each individual platform and implement the platform-specific behaviors inside.
@FelixOlszewski your question is specifically for web - so I would add in: as long as there is Javascript-equivalent solution somewhere, I don't think you need to create any plugin to make the react-native-web component working. In my case (5 years ago), to add a missing react-native-maps for Android, I had to fork the repo, implement native feature in Java and use the forked version instead. I don't think you need to go that far for web components.
1

It looks like this library is already used by big companies like Twitter and Uber, so I would say it does work fairly well.

I could see it as a viable option if you start building your app for Android, iOS and Web. This means you have to test regularly that your additions to your application work on each platform and find workarounds if and when something doesn't work out of the box. Migrating an existing React Native project to include React Native Web would probably not be that straightforward.

With React Native you can build your app with one codebase, but it doesn't mean that you don't have to write platform specific code in some cases.

Flutter also enables developing apps for these platforms in addition to Linux, macOS and Windows. Flutter web apps are still in an early phase so it might not be as stable as React Native Web. I think that currently React Native Web is a better choice if you only want Android, iOS and Web applications from the same codebase.

Comments

0

As a developer, you should always believe that nothing is impossible whether it is coding or assigning the whole project by own. According to the market, React-Native-Web is the most demanding and upgraded version of React and React Native. Yes, it's difficult to find complex things in react native web as compared to the simple web because of fewer backers.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.