2

I noticed that create-react-native-app isn't creating an android/ subdirectory in my project. Is this normal behavior? I'm using Node 8.1.0, NPM 4.6.1. Here's my directory structure:

I need to edit the AndroidManifest.xml file, which is supposed to live in the android/ subdirectory, but apparently it doesn't even exist. Why is this happening? Thanks.

James Ko
  • 32,215
  • 30
  • 128
  • 239

3 Answers3

1

This is a normal behavior. When you need directories ios/ and android/,

yarn run eject
spitson
  • 145
  • 5
1

When you create a react-native app, its comes with Expo.

Expo is a free and open source toolchain built around React Native to help you build native iOS and Android apps using JavaScript and Reac,it lets you build with their app on both ios and android.

When you eject, you create your own files, but lose the power to build on IOS without a mac.

react-native eject should do the work if you want.

Bruno Mazzardo
  • 1,586
  • 1
  • 15
  • 27
0
react-native init ProjectName

This should create your project with ios and android folders and without depended on Expo.

Also about your question:

The init command for react-native installs all the necessary components it needs and starts up the environment to start developing in react-native. It’s required to start working in React Native, just like git init to initialize a git repo, or npm init to create a local package.

create-react-native-app is something else entirely, it’s based of the original create-react-app started by Dan Abramov (the creator of Redux). In short it’s an encapsulated and curated bundle of developer tools designed for bootstrapping projects and helping beginners learn the react-native without having to deal with all the tedious configuration usually associated with creating a React project (setting up Webpack/babel, configuring hot reloading, testing, linting, etc.).

The init command is vital to react-native, so get used to using it. If you are new to react-native I would highly suggest though you look into create-react-native-app, it’s an excellent steeping stone for learning the heart of react-native before having to deal with configuration. This comming from a guy who learned react-native the long way, I wish it would have existed when I was learning.

Source: https://forum.freecodecamp.org/t/difference-between-create-react-native-app-and-react-native-init-app/103609/2

firats
  • 496
  • 2
  • 7