@coorpacademy/app-review 0.0.7 → 0.0.9

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (94) hide show
  1. package/es/src/actions/index.d.ts.map +1 -0
  2. package/es/src/actions/navigation.d.ts.map +1 -0
  3. package/es/src/components/__tmp-backup-vues-mobile/revision-home.d.ts.map +1 -0
  4. package/es/src/components/__tmp-backup-vues-mobile/revision-home.stories.d.ts.map +1 -0
  5. package/es/src/components/__tmp-backup-vues-mobile/revision-onboarding.d.ts.map +1 -0
  6. package/es/src/components/__tmp-backup-vues-mobile/revision-quizzer.d.ts.map +1 -0
  7. package/es/src/components/root-view.d.ts +6 -0
  8. package/es/src/components/root-view.d.ts.map +1 -0
  9. package/es/src/components/root-view.js +19 -0
  10. package/es/src/components/root-view.native.d.ts +3 -0
  11. package/es/src/components/root-view.native.d.ts.map +1 -0
  12. package/{dist/index.js → es/src/components/root-view.native.js} +2 -25
  13. package/es/src/configure-store.d.ts.map +1 -0
  14. package/es/src/configure-store.js +17 -0
  15. package/es/src/index.d.ts.map +1 -0
  16. package/es/src/index.js +26 -0
  17. package/es/src/reducers/index.d.ts.map +1 -0
  18. package/es/src/reducers/navigation.d.ts.map +1 -0
  19. package/lib/src/actions/index.d.ts +2 -0
  20. package/lib/src/actions/index.d.ts.map +1 -0
  21. package/lib/src/actions/index.js +17 -0
  22. package/lib/src/actions/navigation.d.ts +13 -0
  23. package/lib/src/actions/navigation.d.ts.map +1 -0
  24. package/lib/src/actions/navigation.js +14 -0
  25. package/lib/src/components/__tmp-backup-vues-mobile/revision-home.d.ts +9 -0
  26. package/lib/src/components/__tmp-backup-vues-mobile/revision-home.d.ts.map +1 -0
  27. package/lib/src/components/__tmp-backup-vues-mobile/revision-home.js +100 -0
  28. package/lib/src/components/__tmp-backup-vues-mobile/revision-home.stories.d.ts +2 -0
  29. package/lib/src/components/__tmp-backup-vues-mobile/revision-home.stories.d.ts.map +1 -0
  30. package/lib/src/components/__tmp-backup-vues-mobile/revision-home.stories.js +16 -0
  31. package/lib/src/components/__tmp-backup-vues-mobile/revision-onboarding.d.ts +3 -0
  32. package/lib/src/components/__tmp-backup-vues-mobile/revision-onboarding.d.ts.map +1 -0
  33. package/lib/src/components/__tmp-backup-vues-mobile/revision-onboarding.js +62 -0
  34. package/lib/src/components/__tmp-backup-vues-mobile/revision-quizzer.d.ts +18 -0
  35. package/lib/src/components/__tmp-backup-vues-mobile/revision-quizzer.d.ts.map +1 -0
  36. package/lib/src/components/__tmp-backup-vues-mobile/revision-quizzer.js +130 -0
  37. package/lib/src/components/root-view.d.ts +6 -0
  38. package/lib/src/components/root-view.d.ts.map +1 -0
  39. package/lib/src/components/root-view.js +33 -0
  40. package/lib/src/components/root-view.native.d.ts +3 -0
  41. package/lib/src/components/root-view.native.d.ts.map +1 -0
  42. package/lib/src/components/root-view.native.js +47 -0
  43. package/lib/src/configure-store.d.ts +6 -0
  44. package/lib/src/configure-store.d.ts.map +1 -0
  45. package/lib/src/configure-store.js +20 -0
  46. package/lib/src/index.d.ts +5 -0
  47. package/lib/src/index.d.ts.map +1 -0
  48. package/lib/src/index.js +40 -0
  49. package/lib/src/reducers/index.d.ts +5 -0
  50. package/lib/src/reducers/index.d.ts.map +1 -0
  51. package/lib/src/reducers/index.js +8 -0
  52. package/lib/src/reducers/navigation.d.ts +7 -0
  53. package/lib/src/reducers/navigation.d.ts.map +1 -0
  54. package/lib/src/reducers/navigation.js +32 -0
  55. package/package.json +28 -7
  56. package/readme.md +20 -3
  57. package/src/components/root-view.modules.css +8 -0
  58. package/src/components/root-view.native.tsx +69 -0
  59. package/src/components/root-view.tsx +25 -0
  60. package/src/configure-store.ts +10 -11
  61. package/src/index.tsx +1 -65
  62. package/dist/actions/index.d.ts.map +0 -1
  63. package/dist/actions/navigation.d.ts.map +0 -1
  64. package/dist/components/revision-home.d.ts.map +0 -1
  65. package/dist/components/revision-home.stories.d.ts.map +0 -1
  66. package/dist/components/revision-onboarding.d.ts.map +0 -1
  67. package/dist/components/revision-quizzer.d.ts.map +0 -1
  68. package/dist/configure-store.d.ts.map +0 -1
  69. package/dist/configure-store.js +0 -18
  70. package/dist/index.d.ts.map +0 -1
  71. package/dist/reducers/index.d.ts.map +0 -1
  72. package/dist/reducers/navigation.d.ts.map +0 -1
  73. /package/{dist → es/src}/actions/index.d.ts +0 -0
  74. /package/{dist → es/src}/actions/index.js +0 -0
  75. /package/{dist → es/src}/actions/navigation.d.ts +0 -0
  76. /package/{dist → es/src}/actions/navigation.js +0 -0
  77. /package/{dist/components → es/src/components/__tmp-backup-vues-mobile}/revision-home.d.ts +0 -0
  78. /package/{dist/components → es/src/components/__tmp-backup-vues-mobile}/revision-home.js +0 -0
  79. /package/{dist/components → es/src/components/__tmp-backup-vues-mobile}/revision-home.stories.d.ts +0 -0
  80. /package/{dist/components → es/src/components/__tmp-backup-vues-mobile}/revision-home.stories.js +0 -0
  81. /package/{dist/components → es/src/components/__tmp-backup-vues-mobile}/revision-onboarding.d.ts +0 -0
  82. /package/{dist/components → es/src/components/__tmp-backup-vues-mobile}/revision-onboarding.js +0 -0
  83. /package/{dist/components → es/src/components/__tmp-backup-vues-mobile}/revision-quizzer.d.ts +0 -0
  84. /package/{dist/components → es/src/components/__tmp-backup-vues-mobile}/revision-quizzer.js +0 -0
  85. /package/{dist → es/src}/configure-store.d.ts +0 -0
  86. /package/{dist → es/src}/index.d.ts +0 -0
  87. /package/{dist → es/src}/reducers/index.d.ts +0 -0
  88. /package/{dist → es/src}/reducers/index.js +0 -0
  89. /package/{dist → es/src}/reducers/navigation.d.ts +0 -0
  90. /package/{dist → es/src}/reducers/navigation.js +0 -0
  91. /package/src/components/{revision-home.stories.tsx → __tmp-backup-vues-mobile/revision-home.stories.tsx} +0 -0
  92. /package/src/components/{revision-home.tsx → __tmp-backup-vues-mobile/revision-home.tsx} +0 -0
  93. /package/src/components/{revision-onboarding.tsx → __tmp-backup-vues-mobile/revision-onboarding.tsx} +0 -0
  94. /package/src/components/{revision-quizzer.tsx → __tmp-backup-vues-mobile/revision-quizzer.tsx} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"root-view.native.d.ts","sourceRoot":"","sources":["../../../src/components/root-view.native.tsx"],"names":[],"mappings":"AA8CA,QAAA,MAAM,QAAQ,6BAkBb,CAAC;AAIF,eAAe,QAAQ,CAAC"}
@@ -0,0 +1,47 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var react_1 = require("react");
4
+ var react_native_1 = require("react-native");
5
+ // -----------------------------------------------------------------------------
6
+ var styles = react_native_1.StyleSheet.create({
7
+ rootView: {
8
+ flex: 1,
9
+ alignItems: 'center',
10
+ justifyContent: 'center'
11
+ }
12
+ });
13
+ // -----------------------------------------------------------------------------
14
+ var NavText = function (_a) {
15
+ var viewName = _a.viewName, navigateTo = _a.navigateTo;
16
+ switch (viewName) {
17
+ case 'home':
18
+ return (react_1.default.createElement(react_native_1.Pressable, { onPress: function () {
19
+ navigateTo('onboarding');
20
+ } },
21
+ react_1.default.createElement(react_native_1.Text, null, "view home")));
22
+ case 'onboarding':
23
+ return (react_1.default.createElement(react_native_1.Pressable, { onPress: function () { return navigateTo('quizzer'); } },
24
+ react_1.default.createElement(react_native_1.Text, null, "view onboarding")));
25
+ case 'quizzer':
26
+ return (react_1.default.createElement(react_native_1.Pressable, { onPress: function () { return navigateTo('home'); } },
27
+ react_1.default.createElement(react_native_1.Text, null, "view quizzer")));
28
+ default:
29
+ return react_1.default.createElement(react_native_1.Text, null, "view (none selected)");
30
+ }
31
+ };
32
+ // -----------------------------------------------------------------------------
33
+ var RootView = function (props) {
34
+ var backAction = function () {
35
+ props.navigateBack();
36
+ return true;
37
+ };
38
+ (0, react_1.useEffect)(function () {
39
+ // https://reactnative.dev/docs/backhandler
40
+ var backHandler = react_native_1.BackHandler.addEventListener('hardwareBackPress', backAction);
41
+ return function () { return backHandler.remove(); };
42
+ }, []);
43
+ return (react_1.default.createElement(react_native_1.View, { style: styles.rootView },
44
+ react_1.default.createElement(NavText, { viewName: props.viewName, navigateTo: props.navigateTo })));
45
+ };
46
+ // -----------------------------------------------------------------------------
47
+ exports.default = RootView;
@@ -0,0 +1,6 @@
1
+ export default function configureStore(services: any): import("redux").Store<import("redux").EmptyObject & {
2
+ navigation: import("./reducers/navigation").State;
3
+ }, import("redux").AnyAction> & {
4
+ dispatch: unknown;
5
+ };
6
+ //# sourceMappingURL=configure-store.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"configure-store.d.ts","sourceRoot":"","sources":["../../src/configure-store.ts"],"names":[],"mappings":"AAQA,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,QAAQ,KAAA;;;;EAc9C"}
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var redux_1 = require("redux");
4
+ var redux_thunk_1 = require("redux-thunk");
5
+ var redux_devtools_extension_1 = require("redux-devtools-extension");
6
+ var reducers_1 = require("./reducers");
7
+ var preloadedState = undefined;
8
+ function configureStore(services) {
9
+ var _compose = process.env.NODE_ENV !== 'production'
10
+ ? (0, redux_devtools_extension_1.composeWithDevTools)({
11
+ name: 'app-review',
12
+ trace: true,
13
+ traceLimit: 25
14
+ })
15
+ : redux_1.compose;
16
+ var enhancer = _compose((0, redux_1.applyMiddleware)(redux_thunk_1.default));
17
+ var store = (0, redux_1.createStore)(reducers_1.default, preloadedState, enhancer);
18
+ return store;
19
+ }
20
+ exports.default = configureStore;
@@ -0,0 +1,5 @@
1
+ declare const AppRevision: ({ services }: {
2
+ services: any;
3
+ }) => JSX.Element;
4
+ export default AppRevision;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/index.tsx"],"names":[],"mappings":"AAmBA,QAAA,MAAM,WAAW;;iBAehB,CAAC;AAIF,eAAe,WAAW,CAAC"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ var __assign = (this && this.__assign) || function () {
3
+ __assign = Object.assign || function(t) {
4
+ for (var s, i = 1, n = arguments.length; i < n; i++) {
5
+ s = arguments[i];
6
+ for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p))
7
+ t[p] = s[p];
8
+ }
9
+ return t;
10
+ };
11
+ return __assign.apply(this, arguments);
12
+ };
13
+ Object.defineProperty(exports, "__esModule", { value: true });
14
+ var react_1 = require("react");
15
+ var react_redux_1 = require("react-redux");
16
+ var configure_store_1 = require("./configure-store");
17
+ var navigation_1 = require("./actions/navigation");
18
+ var navigation_2 = require("./reducers/navigation");
19
+ var root_view_1 = require("./components/root-view");
20
+ // -----------------------------------------------------------------------------
21
+ var mapStateToProps = function (state, ownProps) {
22
+ return __assign(__assign({}, ownProps), { viewName: (0, navigation_2.getCurrentViewName)(state) });
23
+ };
24
+ var mapDispatchToProps = { navigateTo: navigation_1.navigateTo, navigateBack: navigation_1.navigateBack };
25
+ var App = (0, react_redux_1.connect)(mapStateToProps, mapDispatchToProps)(root_view_1.default);
26
+ // -----------------------------------------------------------------------------
27
+ var AppRevision = function (_a) {
28
+ var services = _a.services;
29
+ var _b = (0, react_1.useState)(null), store = _b[0], setStore = _b[1];
30
+ (0, react_1.useEffect)(function () {
31
+ var store = (0, configure_store_1.default)(services);
32
+ setStore(store);
33
+ }, []);
34
+ if (!store)
35
+ return null;
36
+ return (react_1.default.createElement(react_redux_1.Provider, { store: store },
37
+ react_1.default.createElement(App, null)));
38
+ };
39
+ // -----------------------------------------------------------------------------
40
+ exports.default = AppRevision;
@@ -0,0 +1,5 @@
1
+ declare const rootReducer: import("redux").Reducer<import("redux").CombinedState<{
2
+ navigation: import("./navigation").State;
3
+ }>, import("redux").AnyAction>;
4
+ export default rootReducer;
5
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/reducers/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,WAAW;;8BAEf,CAAC;AAEH,eAAe,WAAW,CAAC"}
@@ -0,0 +1,8 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ var redux_1 = require("redux");
4
+ var navigation_1 = require("./navigation");
5
+ var rootReducer = (0, redux_1.combineReducers)({
6
+ navigation: navigation_1.default
7
+ });
8
+ exports.default = rootReducer;
@@ -0,0 +1,7 @@
1
+ import type { $NAVIGATE_TO, $NAVIGATE_BACK } from '../actions/navigation';
2
+ export declare type State = Array<string>;
3
+ export declare const initialState: State;
4
+ declare const reducer: (state: State, action: $NAVIGATE_TO | $NAVIGATE_BACK) => State;
5
+ export declare const getCurrentViewName: (appState: any) => any;
6
+ export default reducer;
7
+ //# sourceMappingURL=navigation.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../../src/reducers/navigation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAExE,oBAAY,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;AAElC,eAAO,MAAM,YAAY,EAAE,KAAgB,CAAC;AAE5C,QAAA,MAAM,OAAO,yBAAyC,YAAY,GAAG,cAAc,UAalF,CAAC;AAEF,eAAO,MAAM,kBAAkB,wBAAkE,CAAC;AAClG,eAAe,OAAO,CAAC"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ var __spreadArray = (this && this.__spreadArray) || function (to, from, pack) {
3
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
4
+ if (ar || !(i in from)) {
5
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
6
+ ar[i] = from[i];
7
+ }
8
+ }
9
+ return to.concat(ar || Array.prototype.slice.call(from));
10
+ };
11
+ Object.defineProperty(exports, "__esModule", { value: true });
12
+ exports.getCurrentViewName = exports.initialState = void 0;
13
+ var navigation_1 = require("../actions/navigation");
14
+ exports.initialState = ['home'];
15
+ var reducer = function (state, action) {
16
+ if (state === void 0) { state = exports.initialState; }
17
+ switch (action.type) {
18
+ case navigation_1.NAVIGATE_TO: {
19
+ return __spreadArray(__spreadArray([], state, true), [action.payload], false);
20
+ }
21
+ case navigation_1.NAVIGATE_BACK: {
22
+ var newState = __spreadArray([], state, true);
23
+ newState.pop();
24
+ return newState;
25
+ }
26
+ default:
27
+ return state;
28
+ }
29
+ };
30
+ var getCurrentViewName = function (appState) { return appState.navigation[appState.navigation.length - 1]; };
31
+ exports.getCurrentViewName = getCurrentViewName;
32
+ exports.default = reducer;
package/package.json CHANGED
@@ -1,37 +1,58 @@
1
1
  {
2
2
  "name": "@coorpacademy/app-review",
3
- "version": "0.0.7",
3
+ "version": "0.0.9",
4
4
  "description": "",
5
5
  "type": "module",
6
6
  "engines": {
7
7
  "node": ">=16.15.0"
8
8
  },
9
9
  "scripts": {
10
- "test": "echo \"Error: no test specified\" && exit 1"
10
+ "start": "node scripts/start.js",
11
+ "static": "node scripts/build.js",
12
+ "poststatic": "cp -r public static",
13
+ "prepare": "npm run clean && npm run build --production",
14
+ "build:commonjs": "tsc -p tsconfig.lib.json",
15
+ "build:es": "tsc -p tsconfig.es.json",
16
+ "build": "concurrently \"npm run build:commonjs\" \"npm run build:es\"",
17
+ "clean:commonjs": "rm -rf lib",
18
+ "clean:es": "rm -rf es",
19
+ "clean": "concurrently \"npm run clean:commonjs\" \"npm run clean:es\"",
20
+ "test:unit": "echo @todo setup unit tests"
11
21
  },
12
22
  "author": "CoorpAcademy",
13
23
  "files": [
14
- "dist",
24
+ "lib",
25
+ "es",
15
26
  "src",
16
27
  "readme.md"
17
28
  ],
29
+ "main": "./es/index.js",
18
30
  "exports": {
19
31
  ".": {
20
- "import": "./dist/index.js",
21
- "types": "./dist/index.d.ts"
32
+ "import": "./es/index.js",
33
+ "commonjs": "./lib/index.js",
34
+ "types": "./es/index.d.ts"
22
35
  },
23
36
  "./package.json": "./package.json"
24
37
  },
25
38
  "dependencies": {
26
- "react": "^18.1.0",
39
+ "react": "^17.0.2",
27
40
  "react-native": "0.68.1",
28
41
  "react-redux": "^8.0.1",
29
42
  "redux": "^4.2.0"
30
43
  },
31
44
  "devDependencies": {
32
45
  "@storybook/react-native": "^5.3.25",
46
+ "chalk": "^5.0.1",
47
+ "concurrently": "^5.2.0",
48
+ "connect-history-api-fallback": "^1.6.0",
49
+ "esbuild": "^0.14.39",
50
+ "esbuild-css-modules-plugin": "^2.2.16",
51
+ "esbuild-plugin-svgr": "^1.0.1",
52
+ "live-server": "^1.2.2",
53
+ "react-dom": "^17.0.2",
33
54
  "redux-devtools-extension": "^2.13.9",
34
55
  "typescript": "^4.6.4"
35
56
  },
36
- "gitHead": "a24d0a70a741f43883f81c15d8df887a4df1b210"
57
+ "gitHead": "aedacc7a67ecdf22642fc37640e96c57aa6d836d"
37
58
  }
package/readme.md CHANGED
@@ -1,10 +1,27 @@
1
1
  # App Review
2
2
 
3
- tmp notes:
3
+ ## start local sandbox
4
4
 
5
- export: <https://stackoverflow.com/a/70020984/959219>
5
+ ```sh
6
+ npm start
7
+ ```
8
+
9
+ ## generate /static
10
+
11
+ ```sh
12
+ npm run static
13
+ ```
14
+
15
+ (This script is generated by lerna to publish the static web app)
6
16
 
7
- ## mobile components
17
+ ## dependencies notes
8
18
 
9
19
  `react-native` must be the same version on this package and the rootApp
10
20
  *(possible generic error "Invariant Violation: Module AppRegistry is not a registered callable module")*
21
+
22
+ `react` must also be the same version on this package and the rootApp
23
+ *(possible generic error Warning: Invalid hook call. [...] 3. You might have more than one copy of React in the same app)*
24
+
25
+ ### tmp notes
26
+
27
+ export: <https://stackoverflow.com/a/70020984/959219>
@@ -0,0 +1,8 @@
1
+ .textButton {
2
+ background-color: aquamarine;
3
+ padding: 20px;
4
+ border-radius: 10px;
5
+ user-select: none;
6
+ cursor: pointer;
7
+ font-size: 25px;
8
+ }
@@ -0,0 +1,69 @@
1
+ import React, {useEffect} from 'react';
2
+ import {Text, StyleSheet, Pressable, View, BackHandler} from 'react-native';
3
+
4
+ // -----------------------------------------------------------------------------
5
+
6
+ const styles = StyleSheet.create({
7
+ rootView: {
8
+ flex: 1,
9
+ alignItems: 'center',
10
+ justifyContent: 'center'
11
+ }
12
+ });
13
+
14
+ // -----------------------------------------------------------------------------
15
+
16
+ const NavText = ({viewName, navigateTo}) => {
17
+ switch (viewName) {
18
+ case 'home':
19
+ return (
20
+ <Pressable
21
+ onPress={() => {
22
+ navigateTo('onboarding');
23
+ }}
24
+ >
25
+ <Text>view home</Text>
26
+ </Pressable>
27
+ );
28
+ case 'onboarding':
29
+ return (
30
+ <Pressable onPress={() => navigateTo('quizzer')}>
31
+ <Text>view onboarding</Text>
32
+ </Pressable>
33
+ );
34
+ case 'quizzer':
35
+ return (
36
+ <Pressable onPress={() => navigateTo('home')}>
37
+ <Text>view quizzer</Text>
38
+ </Pressable>
39
+ );
40
+ default:
41
+ return <Text>view (none selected)</Text>;
42
+ }
43
+ };
44
+
45
+ // -----------------------------------------------------------------------------
46
+
47
+ const RootView = (props) => {
48
+ const backAction = () => {
49
+ props.navigateBack();
50
+ return true;
51
+ };
52
+
53
+ useEffect(() => {
54
+ // https://reactnative.dev/docs/backhandler
55
+ const backHandler = BackHandler.addEventListener('hardwareBackPress', backAction);
56
+
57
+ return () => backHandler.remove();
58
+ }, []);
59
+
60
+ return (
61
+ <View style={styles.rootView}>
62
+ <NavText viewName={props.viewName} navigateTo={props.navigateTo} />
63
+ </View>
64
+ );
65
+ };
66
+
67
+ // -----------------------------------------------------------------------------
68
+
69
+ export default RootView;
@@ -0,0 +1,25 @@
1
+ import React from 'react';
2
+ import styles from './root-view.modules.css';
3
+
4
+ // -----------------------------------------------------------------------------
5
+
6
+ const Button = (props) => <p {...props} className={styles.textButton} />;
7
+
8
+ // -----------------------------------------------------------------------------
9
+
10
+ const RootView = ({viewName, navigateTo}) => {
11
+ switch (viewName) {
12
+ case 'home':
13
+ return <Button onClick={() => navigateTo('onboarding')}>view home</Button>;
14
+ case 'onboarding':
15
+ return <Button onClick={() => navigateTo('quizzer')}>view onboarding</Button>;
16
+ case 'quizzer':
17
+ return <Button onClick={() => navigateTo('home')}>view quizzer</Button>;
18
+ default:
19
+ return <Button>view (none selected)</Button>;
20
+ }
21
+ };
22
+
23
+ // -----------------------------------------------------------------------------
24
+
25
+ export default RootView;
@@ -2,23 +2,22 @@ import {applyMiddleware, compose, createStore} from 'redux';
2
2
  import thunk from 'redux-thunk';
3
3
  import {composeWithDevTools} from 'redux-devtools-extension';
4
4
 
5
- import * as actionCreators from './actions';
6
5
  import rootReducer from './reducers';
7
6
 
8
7
  const preloadedState = undefined;
9
8
 
10
9
  export default function configureStore(services) {
11
- const _compose = process.env.NODE_ENV !== 'production' ? composeWithDevTools : compose;
10
+ const _compose =
11
+ process.env.NODE_ENV !== 'production'
12
+ ? composeWithDevTools({
13
+ name: 'app-review',
14
+ trace: true,
15
+ traceLimit: 25
16
+ })
17
+ : compose;
12
18
 
13
- const composeEnhancers = _compose({
14
- actionCreators,
15
- name: 'app-review',
16
- trace: true,
17
- traceLimit: 25
18
- });
19
-
20
- const composedEnhancer = composeEnhancers(applyMiddleware(thunk));
21
- const store = createStore(rootReducer, preloadedState, composedEnhancer);
19
+ const enhancer = _compose(applyMiddleware(thunk));
20
+ const store = createStore(rootReducer, preloadedState, enhancer);
22
21
 
23
22
  return store;
24
23
  }
package/src/index.tsx CHANGED
@@ -1,74 +1,10 @@
1
1
  import React, {useEffect, useState} from 'react';
2
- import {Text, StyleSheet, Pressable, View, BackHandler} from 'react-native';
3
2
  import {connect, Provider} from 'react-redux';
4
3
 
5
4
  import configureStore from './configure-store';
6
5
  import {navigateTo, navigateBack} from './actions/navigation';
7
6
  import {getCurrentViewName} from './reducers/navigation';
8
-
9
- // -----------------------------------------------------------------------------
10
-
11
- const styles = StyleSheet.create({
12
- rootView: {
13
- flex: 1,
14
- alignItems: 'center',
15
- justifyContent: 'center'
16
- }
17
- });
18
-
19
- // -----------------------------------------------------------------------------
20
-
21
- const NavText = ({viewName, navigateTo}) => {
22
- console.log({viewName});
23
- switch (viewName) {
24
- case 'home':
25
- return (
26
- <Pressable
27
- onPress={() => {
28
- navigateTo('onboarding');
29
- }}
30
- >
31
- <Text>view home</Text>
32
- </Pressable>
33
- );
34
- case 'onboarding':
35
- return (
36
- <Pressable onPress={() => navigateTo('quizzer')}>
37
- <Text>view onboarding</Text>
38
- </Pressable>
39
- );
40
- case 'quizzer':
41
- return (
42
- <Pressable onPress={() => navigateTo('home')}>
43
- <Text>view quizzer</Text>
44
- </Pressable>
45
- );
46
- default:
47
- return <Text>view (none selected)</Text>;
48
- }
49
- };
50
-
51
- // -----------------------------------------------------------------------------
52
-
53
- const RootView = (props) => {
54
- const backAction = () => {
55
- props.navigateBack();
56
- return true;
57
- };
58
-
59
- useEffect(() => {
60
- // https://reactnative.dev/docs/backhandler
61
- const backHandler = BackHandler.addEventListener('hardwareBackPress', backAction);
62
-
63
- return () => backHandler.remove();
64
- }, []);
65
-
66
- return (
67
- <View style={styles.rootView}>
68
- <NavText viewName={props.viewName} navigateTo={props.navigateTo} />
69
- </View>
70
- );
71
- };
7
+ import RootView from './components/root-view';
72
8
 
73
9
  // -----------------------------------------------------------------------------
74
10
 
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/actions/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/actions/navigation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,aAAa,EAAC,MAAM,OAAO,CAAC;AAEpC,eAAO,MAAM,WAAW,6BAA6B,CAAC;AACtD,eAAO,MAAM,aAAa,+BAA+B,CAAC;AAE1D,oBAAY,YAAY,GAAG;IACzB,IAAI,EAAE,0BAA0B,CAAC;IACjC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,oBAAY,cAAc,GAAG;IAC3B,IAAI,EAAE,4BAA4B,CAAC;CACpC,CAAC;AAEF,eAAO,MAAM,UAAU,EAAE,aAAa,CAAC,YAAY,CAGjD,CAAC;AAEH,eAAO,MAAM,YAAY,EAAE,aAAa,CAAC,cAAc,CAErD,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"revision-home.d.ts","sourceRoot":"","sources":["../../src/components/revision-home.tsx"],"names":[],"mappings":"AAWA,UAAU,KAAK;IACb,cAAc,EAAE;QAAC,KAAK,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAC,EAAE,CAAC;CACnD;AAoGD,QAAA,MAAM,YAAY,UAAW,KAAK,gBASjC,CAAC;AAEF,eAAe,YAAY,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"revision-home.stories.d.ts","sourceRoot":"","sources":["../../src/components/revision-home.stories.tsx"],"names":[],"mappings":""}
@@ -1 +0,0 @@
1
- {"version":3,"file":"revision-onboarding.d.ts","sourceRoot":"","sources":["../../src/components/revision-onboarding.tsx"],"names":[],"mappings":"AAkEA,QAAA,MAAM,kBAAkB,mBAevB,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"revision-quizzer.d.ts","sourceRoot":"","sources":["../../src/components/revision-quizzer.tsx"],"names":[],"mappings":"AASA,oBAAY,QAAQ,GAAG;IACrB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,QAAQ,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF,oBAAY,OAAO,GAAG;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,WAAW,EAAE,MAAM,CAAC;IACpB,IAAI,EAAE,gBAAgB,GAAG,iBAAiB,GAAG,aAAa,CAAC;IAC3D,OAAO,CAAC,EAAE,QAAQ,EAAE,CAAC;CACtB,CAAC;AAEF,UAAU,KAAK;IACb,KAAK,EAAE,OAAO,CAAC;IACf,GAAG,EAAE,MAAM,CAAC;CACb;AA2ID,QAAA,MAAM,eAAe,cAAa,KAAK,gBAStC,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"configure-store.d.ts","sourceRoot":"","sources":["../src/configure-store.ts"],"names":[],"mappings":"AASA,MAAM,CAAC,OAAO,UAAU,cAAc,CAAC,QAAQ,KAAA;;;;EAc9C"}
@@ -1,18 +0,0 @@
1
- import { applyMiddleware, compose, createStore } from 'redux';
2
- import thunk from 'redux-thunk';
3
- import { composeWithDevTools } from 'redux-devtools-extension';
4
- import * as actionCreators from './actions';
5
- import rootReducer from './reducers';
6
- const preloadedState = undefined;
7
- export default function configureStore(services) {
8
- const _compose = process.env.NODE_ENV !== 'production' ? composeWithDevTools : compose;
9
- const composeEnhancers = _compose({
10
- actionCreators,
11
- name: 'app-review',
12
- trace: true,
13
- traceLimit: 25
14
- });
15
- const composedEnhancer = composeEnhancers(applyMiddleware(thunk));
16
- const store = createStore(rootReducer, preloadedState, composedEnhancer);
17
- return store;
18
- }
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAmFA,QAAA,MAAM,WAAW;;iBAehB,CAAC;AAIF,eAAe,WAAW,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/reducers/index.ts"],"names":[],"mappings":"AAGA,QAAA,MAAM,WAAW;;8BAEf,CAAC;AAEH,eAAe,WAAW,CAAC"}
@@ -1 +0,0 @@
1
- {"version":3,"file":"navigation.d.ts","sourceRoot":"","sources":["../../src/reducers/navigation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAC,YAAY,EAAE,cAAc,EAAC,MAAM,uBAAuB,CAAC;AAExE,oBAAY,KAAK,GAAG,KAAK,CAAC,MAAM,CAAC,CAAC;AAElC,eAAO,MAAM,YAAY,EAAE,KAAgB,CAAC;AAE5C,QAAA,MAAM,OAAO,yBAAyC,YAAY,GAAG,cAAc,UAalF,CAAC;AAEF,eAAO,MAAM,kBAAkB,wBAAkE,CAAC;AAClG,eAAe,OAAO,CAAC"}
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes