DEV Community

Merlier
Merlier

Posted on • Edited on

Try react-native with docker in 5 cmd-lines

Warning : the following method is just a way to test quickly react-native. It's not a good practice to every day work.

Requirements:

  • docker >= 19 (the following cmd-lines are designed for linux platform).
  1. Init the docker
docker run --rm -ti --net host -v /dev/bus/usb:/dev/bus/usb -v $(pwd):/app reactnativecommunity/react-native-android bash 
Enter fullscreen mode Exit fullscreen mode
  1. Check device connection

You need to plug an android smartphone in developer mode. Then check if the device is connected and authorized. If not don't forget to press the authorized button on your smartphone.

adb devices
Enter fullscreen mode Exit fullscreen mode
  1. Init a default react-native project
cd /app && npx react-native init helloworld 
Enter fullscreen mode Exit fullscreen mode
  1. Run the project
cd helloworld && npx react-native run-android
Enter fullscreen mode Exit fullscreen mode
npm start
Enter fullscreen mode Exit fullscreen mode

On the smartphone, close the app and reopen it.

That's all you should have your newly created app launched!

Top comments (0)