unicorn-demo-app 7.2.4 → 7.3.0
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.
- package/package.json +3 -3
- package/src/demoApp.js +5 -8
- package/src/screens/MainScreen.js +3 -3
- package/src/screens/SettingsScreen.js +7 -7
- package/src/screens/__tests__/__snapshots__/AvatarScreen.spec.js.snap +646 -393
- package/src/screens/foundationScreens/ColorsScreen.js +286 -92
- package/src/screens/incubatorScreens/PanViewScreen.tsx +2 -2
- package/src/storage.ts +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "unicorn-demo-app",
|
|
3
|
-
"version": "7.
|
|
3
|
+
"version": "7.3.0",
|
|
4
4
|
"main": "src/index.js",
|
|
5
5
|
"author": "Ethan Sharabi <ethan.shar@gmail.com>",
|
|
6
6
|
"license": "MIT",
|
|
@@ -20,8 +20,8 @@
|
|
|
20
20
|
"shell-utils": "^1.0.10"
|
|
21
21
|
},
|
|
22
22
|
"peerDependencies": {
|
|
23
|
-
"react": "^18.
|
|
24
|
-
"react-native": "^0.
|
|
23
|
+
"react": "^18.2.0",
|
|
24
|
+
"react-native": "^0.71.2",
|
|
25
25
|
"react-native-ui-lib": "*",
|
|
26
26
|
"semver": "^5.5.0"
|
|
27
27
|
}
|
package/src/demoApp.js
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
import AsyncStorage from '@react-native-community/async-storage';
|
|
2
1
|
import {Navigation} from 'react-native-navigation';
|
|
3
2
|
import {Constants, Colors, Typography} from 'react-native-ui-lib'; // eslint-disable-line
|
|
4
3
|
import {registerScreens} from './screens';
|
|
5
|
-
|
|
4
|
+
import Storage, {DEFAULT_SCREEN} from './storage';
|
|
6
5
|
|
|
7
6
|
/** Examples - uncomment when needed */
|
|
8
7
|
// Typography.loadTypographies({
|
|
@@ -115,12 +114,10 @@ function startApp(defaultScreen) {
|
|
|
115
114
|
Navigation.setRoot(rootObject);
|
|
116
115
|
}
|
|
117
116
|
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
} catch (error) {
|
|
123
|
-
console.warn(error);
|
|
117
|
+
function getDefaultScreenAndStartApp() {
|
|
118
|
+
if (Storage.contains(DEFAULT_SCREEN)) {
|
|
119
|
+
startApp(Storage.getString(DEFAULT_SCREEN));
|
|
120
|
+
} else {
|
|
124
121
|
startApp();
|
|
125
122
|
}
|
|
126
123
|
}
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import React, {Component} from 'react';
|
|
3
|
-
import AsyncStorage from '@react-native-community/async-storage';
|
|
4
3
|
import PropTypes from 'prop-types';
|
|
5
4
|
import {StyleSheet, FlatList, SectionList, ScrollView} from 'react-native';
|
|
6
5
|
import {ViewPropTypes} from 'deprecated-react-native-prop-types';
|
|
@@ -21,6 +20,7 @@ import {
|
|
|
21
20
|
Dividers
|
|
22
21
|
} from 'react-native-ui-lib'; //eslint-disable-line
|
|
23
22
|
import {navigationData} from './MenuStructure';
|
|
23
|
+
import Storage, {DEFAULT_SCREEN} from '../storage';
|
|
24
24
|
|
|
25
25
|
const settingsIcon = require('../assets/icons/settings.png');
|
|
26
26
|
const chevronIcon = require('../assets/icons/chevronRight.png');
|
|
@@ -152,7 +152,7 @@ class MainScreen extends Component {
|
|
|
152
152
|
};
|
|
153
153
|
|
|
154
154
|
setDefaultScreen = ({customValue: item}) => {
|
|
155
|
-
|
|
155
|
+
Storage.set(DEFAULT_SCREEN, item.screen);
|
|
156
156
|
this.openScreen({customValue: item});
|
|
157
157
|
};
|
|
158
158
|
|
|
@@ -269,7 +269,7 @@ class MainScreen extends Component {
|
|
|
269
269
|
onCheckViewableItems = ({viewableItems}) => {
|
|
270
270
|
const {chipsLabels, selectedSection} = this.state;
|
|
271
271
|
if (!this.hasPressItem && this.hasUserScrolled) {
|
|
272
|
-
const title = viewableItems[0]
|
|
272
|
+
const title = viewableItems[0]?.section.title;
|
|
273
273
|
const sectionIndex = _.findIndex(chipsLabels, c => {
|
|
274
274
|
return c === title;
|
|
275
275
|
});
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import _ from 'lodash';
|
|
2
2
|
import React, {Component} from 'react';
|
|
3
|
-
import AsyncStorage from '@react-native-community/async-storage';
|
|
4
3
|
import {StyleSheet, I18nManager} from 'react-native';
|
|
5
4
|
import {Colors, View, Text, Picker, Incubator, Switch} from 'react-native-ui-lib'; //eslint-disable-line
|
|
6
5
|
import {navigationData} from './MenuStructure';
|
|
6
|
+
import Storage, {DEFAULT_SCREEN, IS_RTL} from '../storage';
|
|
7
7
|
|
|
8
8
|
const none = {label: '[None]', value: ''};
|
|
9
9
|
|
|
@@ -28,17 +28,17 @@ class SettingsScreen extends Component {
|
|
|
28
28
|
|
|
29
29
|
this.state = {
|
|
30
30
|
showRefreshMessage: false,
|
|
31
|
+
isRTL: false,
|
|
31
32
|
screens
|
|
32
33
|
};
|
|
33
34
|
}
|
|
34
35
|
|
|
35
|
-
|
|
36
|
+
UNSAFE_componentWillMount() {
|
|
36
37
|
const {screens} = this.state;
|
|
37
|
-
const defaultScreenId =
|
|
38
|
+
const defaultScreenId = Storage.getString(DEFAULT_SCREEN);
|
|
38
39
|
const defaultScreen = _.find(screens, {value: defaultScreenId});
|
|
39
40
|
|
|
40
|
-
const
|
|
41
|
-
const isRTL = isRTLString === 'true';
|
|
41
|
+
const isRTL = Storage.getBoolean(IS_RTL);
|
|
42
42
|
|
|
43
43
|
this.setState({defaultScreen, isRTL});
|
|
44
44
|
}
|
|
@@ -46,7 +46,7 @@ class SettingsScreen extends Component {
|
|
|
46
46
|
onDirectionChange = () => {
|
|
47
47
|
this.setState({isRTL: !this.state.isRTL}, () => {
|
|
48
48
|
I18nManager.forceRTL(this.state.isRTL);
|
|
49
|
-
|
|
49
|
+
Storage.set(IS_RTL, this.state.isRTL);
|
|
50
50
|
setTimeout(() => {
|
|
51
51
|
this.setState({showRefreshMessage: true});
|
|
52
52
|
}, 1000);
|
|
@@ -55,7 +55,7 @@ class SettingsScreen extends Component {
|
|
|
55
55
|
|
|
56
56
|
setDefaultScreen = screen => {
|
|
57
57
|
this.setState({defaultScreen: screen});
|
|
58
|
-
|
|
58
|
+
Storage.set(DEFAULT_SCREEN, screen);
|
|
59
59
|
setTimeout(() => {
|
|
60
60
|
this.setState({showRefreshMessage: true});
|
|
61
61
|
}, 1000);
|