Can React Native apps be tested in a browser?

谁说我不能喝 提交于 2019-11-28 21:21:10

问题


Realizing that React Native apps are designed to be developed / tested using simulators, is it possible to use a web browser to also test an application?

Services such as https://rnplay.org/ exist, however my concern is it's powered by https://appetize.io/ it might be limited by the # of minutes per month. I'd also like to utilize free / open-source technology to accomplish this, as compared to a paid screen streaming service.

Along these lines, in order to test the app in a browser, would the app be required to use one or more libraries which allow the app to be run in both React Native and also simply React? I'd like to find an alternative to this particular approach as I'd like to code for React Native specifically.


回答1:


No, React Native can be tested only in mobile simulators like IOS and Android

Update: Facebook has given a beautiful starter pack for React native.

Introducing Create React Native App

Using this you can run the app in your mobile using expo app(https://expo.io) .It syncs using QR code.




回答2:


You can use Expo Snack https://snack.expo.io/ to instantly test your code on a device (using QR code ) or in the browser. For more information, you can go thtrough this article. https://blog.expo.io/sketch-a-playground-for-react-native-16b2401f44a2




回答3:


Yes! That's very much possible with react-native-web. Here are a couple of related, useful resources to get started:

  • React Native Web Starter
  • A guide to combine React and ReactNative into one codebase



回答4:


from React Native Docs:

https://facebook.github.io/react-native/docs/0.60/tutorial

First of all, ES2015 (also known as ES6) is a set of improvements to JavaScript that is now part of the official standard, but not yet supported by all browsers, so often it isn't used yet in web development.



来源:https://stackoverflow.com/questions/35973914/can-react-native-apps-be-tested-in-a-browser

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!