Opinionated resources generator for React Native
1. Generate files for a new screen with boilerplate code for each file
npx rnx-gen g screen UserProfile
src
| -screens
| -UserProfileScreen
| -__tests__
| -UserProfileScreen.test.ts
| -UserProfileScreen.tsx
| -UserProfileScreen.types.ts
| -UserProfileScreen.styles.ts
| -UserProfileScreen.constants.ts
| -index.ts
Option
Descriptions
--no-test
Do not create the tests folder and the test file
--no-const
Do not create the constants file
--no-style
Do not create the styles file
--path
Custom path beginning with src (example --path=src/screens/auth)
--keep-name
Use the resource name provided as an option without modification
--dry-run
Simulate command execution without creating any files
2. Generate files for a new component with boilerplate code for each file
npx rnx-gen g component AlertModal
src
| -components
| -AlertModal
| -__tests__
| -AlertModal.test.ts
| -AlertModal.tsx
| -AlertModal.styles.ts
| -index.ts
Option
Descriptions
--no-test
Do not create the tests folder and the test file
--no-dir
Do not create a separate folder for the component
--no-style
Do not create the styles file
--path
Custom path beginning with src (example --path=src/components/cards)
--keep-name
Use the resource name provided as an option without modification
--dry-run
Simulate command execution without creating any files
3. Generate a new hook file with boilerplate code
npx rnx-gen g hook profileData
src
| -hooks
| -useProfileData
| -useProfileData.ts
| -useProfileData.test.ts
| -index.ts
Option
Descriptions
--no-test
Do not create the test file
--no-dir
Do not create a separate folder for the hook
--path
Custom path beginning with src (example --path=src/hooks/data)
--keep-name
Use the resource name provided as an option without modification
--dry-run
Simulate command execution without creating any files
4. Generate a new Redux slice with boilerplate code
npx rnx-gen g slice users
src
| -redux
| -slices
| -usersSlice.ts
Option
Descriptions
--path
Custom path beginning with src (example --path=src/redux/reducers)
--keep-name
Use the resource name provided as an option without modification
--dry-run
Simulate command execution without creating any files
5. Set up Redux files (Redux toolkit) with boilerplate code for each file
src
| -redux
| -slices
| -appSlice.ts
| -selectors
| -appSelectors.ts
| -rootReducer.ts
| -store.ts
| -store.utils.ts
Option
Descriptions
--dry-run
Simulate command execution without creating any files
Execute any command with the --dry-run option to simulate file creation
npx rnx-gen g screen Splash --dry-run