$ npx yown @rnna/app
$ npm install rnna react-native-flipper @react-native-async-storage/async-storage
$ npm install --save-dev redux-flipper rn-async-storage-flipper
# Optional
$ npx yown @rnna/app-starter
Last active
January 24, 2022 10:49
-
-
Save eightyfive/c1e159a3566165fadc7032b746ea7e16 to your computer and use it in GitHub Desktop.
rnna app structure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Platform } from 'react-native'; | |
import AsyncStorage from '@react-native-async-storage/async-storage'; | |
const isAndroid = Platform.OS === 'android'; | |
const middlewares = []; | |
const config = { | |
middlewares, | |
persist: { | |
key: 'root', | |
storage: AsyncStorage, | |
whitelist: ['session'], | |
}, | |
}; | |
if (__DEV__) { | |
// AsyncStorage.clear(); | |
// Redux Flipper | |
const createDebugger = require('redux-flipper').default; | |
middlewares.push(createDebugger()); | |
// AsyncStorage Flipper | |
const asyncStorageFlipper = require('rn-async-storage-flipper').default; | |
asyncStorageFlipper(AsyncStorage); | |
if (isAndroid) { | |
// https://github.com/facebook/react-native/issues/14101 | |
// https://github.com/rt2zz/redux-persist/issues/717#issuecomment-437589374 | |
config.persist.timeout = 0; | |
} | |
} | |
export default config; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export default Object.assign( | |
{ | |
API_URL: 'https://example.org/api', | |
}, | |
__DEV__ && { | |
API_URL: 'http://127.0.0.1:8000/api', | |
}, | |
); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { onBoot } from 'rnna/events'; | |
export default onBoot(main); | |
function main(services) { | |
// | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import boot from "./boot"; | |
import register from "./register"; | |
import runtime from "./runtime"; | |
const events = [register, boot, ...runtime]; | |
export default events; | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { onRegister } from "rnna/events"; | |
export default onRegister(main); | |
function main(services) { | |
// | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { onAction as on } from "rnna/events"; | |
const events = [ | |
on("app/dummy", (services, payload, meta) => {}) | |
]; | |
export default events; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import createStoreAsync from "rnna/store"; | |
import epics from "./events"; | |
import reducers from "./state"; | |
import container from "./services"; | |
import storeConfig from "./config/store"; | |
const storeAsync = createStoreAsync( | |
{ ...storeConfig, epics, reducers }, | |
container | |
); | |
const app = { | |
boot() { | |
return storeAsync; | |
}, | |
}; | |
export default app; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const routes = { | |
// | |
}; | |
export default routes; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Container } from "rnna"; | |
const container = new Container(); | |
// | |
export default container; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const reducers = { | |
// | |
}; | |
export default reducers; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const screens = { | |
// | |
}; | |
export default screens; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
{ | |
"dir": "app", | |
"keywords": ["rnna", "react-native", "react-native-navigation"], | |
"dependencies": [ | |
"rnna", | |
"@react-native-community/async-storage", | |
"react-native-flipper" | |
], | |
"devDependencies": [ | |
"redux-flipper", | |
"rn-async-storage-flipper" | |
] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment