Using Configuration
With the above steps, you can now create a configuration file which will be used by rnhc to create your files with your custom config.
- To create a default configuration file run:
rnhc create --config
- This will create a
rnhc.config.jsonfile at the root of your project. The file will contain the following:
{
"withStyles": true,
"withFunctions": true,
"withProps": true,
"withTests": true,
"defaultExports": true,
"componentsRoot": "./src/components",
"screensRoot": "./src/screens",
"reduxRoot": "./src/redux",
"applyReduxThunk": true
}
withStyles: if true, createstyles.js(orstyles.ts) file for components and screens, if false, don't createstyles.js(orstyles.ts) file, default is true.withFunctions: if true, createfunctionsfolder for screens, if false, don't createfunctionsfolder, default is true.withProps: if true, create propsinterfacefor components and screens (in TS only), if false, don't create propsinterface, default is true.withTests: if true, create__tests__folder for components and screens, if false, don't create__tests__folder, default is true.defaultExports: if true, create default export for components and pages, if false, create named export for components and pages, default is true.componentsRoot: the root folder for components, default is./src/components.screensRoot: the root folder for screens, default is./src/screens.reduxRoot: the root folder for redux, default is./src/redux.applyReduxThunk: if true, applyredux-thunkmiddleware to the store, if false, don't applyredux-thunkmiddleware, default is true.
- If no configuration file is found or you don't specify some of the configuration, the default configuration will be used.