$ npx yown @rnna/app-starter
Last active
September 29, 2021 08:42
-
-
Save eightyfive/14dd7da76d609392230b03402703d187 to your computer and use it in GitHub Desktop.
rnna app starter
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(({ router }) => { | |
router.go('main/Home'); | |
}); |
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
function home({ db }) { | |
const actionCount = db.getActionCount(); | |
return { | |
actionCount, | |
name: "World" | |
}; | |
} | |
const routes = { | |
"main/Home": home, | |
}; | |
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"; | |
import DbBundle from "@rnna/bundle-db"; | |
import RouterBundle from "@rnna/bundle-router"; | |
import routes from "../routes"; | |
import screens from "../views/screens"; | |
import * as selectors from "./selectors"; | |
const container = new Container(); | |
// DB | |
container.constant("db.selectors", selectors); | |
container.service("bundles.db", DbBundle); | |
// Router | |
container.constant("router.screens", screens); | |
container.constant("router.routes", routes); | |
container.service("bundles.router", RouterBundle); | |
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
import { createSelector as $ } from "@rnna/db"; | |
export const getActionCount = $('actionCount'); |
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 = { | |
actionCount: (count = 0, action) => count + 1, | |
}; | |
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
export { ActivityIndicator, Button, TextInput } from 'react-native'; | |
export * from 'rnna/views/atoms'; |
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 React from 'react'; | |
import { Text, View } from 'react-native'; | |
import { m, p } from '../theme'; | |
export default function Home({ actionCount, name }) { | |
return ( | |
<View style={p[3]}> | |
<Text style={m.b3}>Hello {name} !</Text> | |
<Text>{actionCount} actions executed so far</Text> | |
</View> | |
); | |
} |
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 Login from './login'; | |
import Home from './home'; | |
export default { | |
// auth: { | |
// Login, | |
// }, | |
main: { | |
Home, | |
}, | |
}; |
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 { createMargin, createPadding } from 'rnna/views'; | |
// Spacing | |
const sizes = [0, 4, 8, 16, 32, 64]; | |
export const m = createMargin(sizes); | |
export const p = createPadding(sizes); | |
// Colors | |
// https://www.materialpalette.com/indigo/red | |
const primary = '#3F51B5'; | |
const primaryDark = '#303F9F'; | |
const primaryLight = '#C5CAE9'; | |
const accent = '#FF5252'; | |
const black = '#212121'; | |
const white = '#FFFFFF'; | |
const grey = '#757575'; | |
const greyLight = '#BDBDBD'; | |
export const colors = { | |
primary, | |
primaryVariant: primaryDark, | |
accent, | |
background: primary, | |
surface: white, | |
error: 'red', | |
text: black, | |
textSecondary: grey, | |
divider: greyLight, | |
on: { | |
primary: white, | |
accent: white, | |
background: white, | |
surface: black, | |
error: white, | |
}, | |
}; | |
export const roundness = 15; |
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"], | |
"dependencies": ["immer"] | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment