📜 ⬆️ ⬇️

Quick start on React Native

What horizons does React open? Single Page Application (both web and desktop applications on Electron) are flowers. Mobile application development on React Native looks very tempting. The slogan "learn once, write anywhere" is worth the effort. Go!


March 13 announced a stable miracle solution:


Many developers are faced with the problem of installing and configuring existing React Native dependencies, especially for Android. With the Create React Native App, you do not need to use Xcode or Android Studio, and you can develop for your iOS device using Linux or Windows. This is achieved using the Expo application, which loads and runs CRNA projects written in pure JavaScript without compiling any native code.


CRNA repeats the idea of ​​the Create React App (CRA). No environment settings - everything is ready "out of the box": test launch, launch in development mode, combat assembly and deployment.


$ npm i -g create-react-native-app $ create-react-native-app my-app $ cd my-app $ npm start 


As you can see, you need to fulfill several conditions: install the Expo control shell on a mobile phone, run the application under test via a QR code, while the mobile phone must be in the same local network with your developer’s computer.


Can be even simpler. Connect the mobile phone with a USB lanyard, and run:


 $ npm run android 

It will automatically put the Expo shell on a mobile phone and launch the application under test. Then the hot reboot works almost as fast as when developing a web application on the CRA. Magic!


On Ubuntu / Windows, it is available only for connected Android / iOS devices; but on the Mac, it works without a mobile phone at all - on the iOS simulator:


 $ npm run ios 



Optionally, you can install on the Expo XDE computer:




Using this tool, you can also launch a test application, while the log is displayed from a mobile device - a fat plus; but the hot reboot is slow, apparently the application is rebuilt completely each time. UPDATE You need to bring up the developer menu (literally shake the cell phone), and select "Enable Hot Reloading". At the same time, turn off Live Reload - both options are not supported together .


Original React Native blog post


UPDATE Mac is not needed to develop an iOS version; just plug in your iOS device and enjoy the process on Ubuntu / Windows (thanks, andreylat ).


')

Source: https://habr.com/ru/post/327668/


All Articles