diff --git a/.eslintrc.js b/.eslintrc.js index 4acd8ff8..898ffe6d 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -10,7 +10,8 @@ module.exports = { '@typescript-eslint/no-shadow': 'off', 'no-shadow': 'off', 'no-undef': 'off', + semi: [2, 'never'], }, }, ], -}; +} diff --git a/.prettierrc.js b/.prettierrc.js index 2b540746..15ad6f42 100644 --- a/.prettierrc.js +++ b/.prettierrc.js @@ -1,7 +1,8 @@ module.exports = { + semi: false, arrowParens: 'avoid', bracketSameLine: true, bracketSpacing: false, singleQuote: true, trailingComma: 'all', -}; +} diff --git a/README.md b/README.md index 352fc769..81f53001 100644 --- a/README.md +++ b/README.md @@ -7,8 +7,8 @@ Uses: - [React Native](https://reactnative.dev) - [React Native for Web](https://necolas.github.io/react-native-web/) - [React Navigation](https://reactnative.dev/docs/navigation#react-navigation) -- (todo) [MobX](https://mobx.js.org/README.html) and [MobX State Tree](https://mobx-state-tree.js.org/) -- (todo) [Async Storage](https://github.com/react-native-async-storage/async-storage) +- [MobX](https://mobx.js.org/README.html) and [MobX State Tree](https://mobx-state-tree.js.org/) +- [Async Storage](https://github.com/react-native-async-storage/async-storage) ## Build instructions diff --git a/__tests__/App-test.tsx b/__tests__/App-test.tsx index dab45f32..47060512 100644 --- a/__tests__/App-test.tsx +++ b/__tests__/App-test.tsx @@ -2,15 +2,15 @@ * @format */ -import 'react-native'; -import React from 'react'; -import App from '../src/App'; +import 'react-native' +import React from 'react' +import App from '../src/App' // Note: test renderer must be required after react-native. -import renderer from 'react-test-renderer'; +import renderer from 'react-test-renderer' it('renders correctly', () => { renderer.act(() => { - renderer.create(); - }); -}); + renderer.create() + }) +}) diff --git a/babel.config.js b/babel.config.js index f842b77f..cf1f9fbb 100644 --- a/babel.config.js +++ b/babel.config.js @@ -1,3 +1,3 @@ module.exports = { presets: ['module:metro-react-native-babel-preset'], -}; +} diff --git a/index.native.js b/index.native.js index c3999052..2d2c9ca4 100644 --- a/index.native.js +++ b/index.native.js @@ -2,8 +2,8 @@ * @format */ -import {AppRegistry} from 'react-native'; -import App from './src/App'; -import {name as appName} from './src/app.json'; +import {AppRegistry} from 'react-native' +import App from './src/App' +import {name as appName} from './src/app.json' -AppRegistry.registerComponent(appName, () => App); +AppRegistry.registerComponent(appName, () => App) diff --git a/metro.config.js b/metro.config.js index e91aba93..c81b3ca1 100644 --- a/metro.config.js +++ b/metro.config.js @@ -14,4 +14,4 @@ module.exports = { }, }), }, -}; +} diff --git a/package.json b/package.json index d6218613..346cbcc9 100644 --- a/package.json +++ b/package.json @@ -11,8 +11,11 @@ "lint": "eslint . --ext .js,.jsx,.ts,.tsx" }, "dependencies": { + "@react-native-async-storage/async-storage": "^1.17.6", "@react-navigation/native": "^6.0.10", "@react-navigation/native-stack": "^6.6.2", + "mobx": "^6.6.0", + "mobx-state-tree": "^5.1.5", "react": "17.0.2", "react-dom": "17.0.2", "react-native": "0.68.2", diff --git a/src/App.native.tsx b/src/App.native.tsx new file mode 100644 index 00000000..40989caf --- /dev/null +++ b/src/App.native.tsx @@ -0,0 +1,80 @@ +import React, {useState, useEffect} from 'react' +import { + SafeAreaView, + ScrollView, + StatusBar, + Text, + Button, + useColorScheme, + View, +} from 'react-native' +import {NavigationContainer} from '@react-navigation/native' +import { + createNativeStackNavigator, + NativeStackScreenProps, +} from '@react-navigation/native-stack' +import {RootStore, setupState, RootStoreProvider} from './state' + +type RootStackParamList = { + Home: undefined + Profile: {name: string} +} +const Stack = createNativeStackNavigator() + +const HomeScreen = ({ + navigation, +}: NativeStackScreenProps) => { + const isDarkMode = useColorScheme() === 'dark' + + return ( + + + + + Native +