React Native iOS and Android folders not present

人盡茶涼 提交于 2019-12-20 08:56:14

问题


I'm new to react native, and I've been having some trouble understanding the folder structure of the app which should supposedly be present in the project folder on creation. Basically, when creating the project with npm, I get some starting files (App.js etc.) and a node_modules folder. I've got it up and running with expo, which created the .expo folder as well.

However, when I go to react's official documentation or look into plugins/addons on git they talk several times about an android and an iOS folder in the project root. But they are nowhere to be seen. I then got some hints that I could install and run react-native-upgrade-git, which allegedly would generate these missing folders. But that didn't work either.

So what have I missed? Where are those folders located?

Edit: Here is a screen dump from a Youtube tutorial showing the project structure I'm looking for:


回答1:


One of the points of Expo on top of React Native is that you don't go down to android or ios code. Expo deals with those folders for you, you don't need to interact with them. Is there a reason you need those folders? if so, you will have to eject. Here's the documentation to do so: Ejecting with ExpoKit




回答2:


You can get to that project structure by running:

npm run eject

However, it removes the app from the Expo framework, which adds a lot of nice benefits and abstraction from the Android/iOS code.




回答3:


i think if you want to develop app with ReactNative you start follow this : Getting Started use React Native.

If you create project with ReactNative just write on your terminal like:

react-native init YourProjectName
cd YourProjectName
react-native run-ios //for iOS

I hope my answer helping you to create project with ReactNative. thanks..




回答4:


Try this to generate the Android and iOS folder

react-native eject

react-native link



回答5:


I think I am little late but follow this steps if you don't want to read any document.

android and ios folder are not present when react native project is created with expo. so you have to detach expo from your project to create android and ios folder.

first add required package name in app.json file

    ios: {
       bundleIdentifier: "com.yourcompany.yourappname",
    },
    android: {
       package: "com.yourcompany.yourappname",
    }

then run below command in terminal

exp detach

after command is successfully executed you will find android and ios folder




回答6:


in the begining install react native, after run expo init YourProject , choose minimal (Typescript) . after that go to YourProject directory and do not run npm start. but run npm run android. hope this help




回答7:


The simplest way I know

1) Take your app name from your current app.json, let's say the name is "mynativeapp"

2) make a new folder somewhere outside of your current project folder

3) start in it:

react-native init mynativeapp

4) the command above will make android and ios folders internally compatible by name with your project

5) copy android/ios folders into your project folder

Now you can try to start your native project. I checked that for Android:

react-native run-android

enjoy!

P.S. "react": "16.9.0", "react-native": "0.61.4"



来源:https://stackoverflow.com/questions/44270504/react-native-ios-and-android-folders-not-present

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