- React Native Blueprints
- Emilio Rodriguez Martinez
- 304字
- 2021-07-02 15:19:58
Setting up the folder structure
Our app only comprises of two screens: Shopping List and Add Products. Since the state for such a simple app should be easy to manage, we won't add any library for state management (for example, Redux), as we will send the shared state through the navigation component. This should make our folder structure rather simple:

We have to create an src folder where we will store all our React code. The self-created file index.js will have the following code:
/*** index.js ***/
import { AppRegistry } from 'react-native';
import App from './src/main';
AppRegistry.registerComponent('GroceriesList', () => App);
In short, these files will import the common root code for our app, store it in a variable named App and later pass this variable to the AppRegistry through the registerComponent method. AppRegistry is the component to which we should register our root components. Once we do this, React Native will generate a JS bundle for our app and then run the app when it's ready by invoking AppRegistry.runApplication.
Most of the code we will be writing, will be placed inside the src folder. For this app, we will create our root component (main.js) in this folder, and a screens subfolder, in which we will store our two screens (ShoppingList and AddProduct).
Now let's install all the initial dependencies for our app before continue coding. In our project's root folder, we will need to run the following command:
npm install
Running that command will install all the basic dependencies for every React Native project. Let's now install the three packages we will be using for this specific app:
npm install native-base --save
npm install react-native-prompt-android --save
npm install react-navigation --save
Further ahead in this chapter, we will explain what each package will be used for.
- Linux操作系統基礎
- 鴻蒙生態:開啟萬物互聯的智慧新時代
- Mobile-first Bootstrap
- Linux內核完全注釋(20周年版·第2版)
- Linux網絡操作系統與實訓(第三版)
- Hands-On DevOps with Vagrant
- Haskell Financial Data Modeling and Predictive Analytics
- Extending Bootstrap
- 高性能Linux服務器構建實戰:系統安全、故障排查、自動化運維與集群架構
- 巧學活用Windows 7
- Windows 7中文版從入門到精通(修訂版)
- Joomla! 3 Template Essentials
- 云原生落地:產品、架構與商業模式
- Kali Linux高級滲透測試
- Advanced Infrastructure Penetration Testing