@@ -2,29 +2,33 @@ import _ from 'lodash';
2
2
import React , { Component } from 'react' ;
3
3
import AsyncStorage from '@react-native-community/async-storage' ;
4
4
import { StyleSheet , I18nManager } from 'react-native' ;
5
- import { Colors , View , Text , Picker , Toast , Switch } from 'react-native-ui-lib' ; //eslint-disable-line
5
+ import { Colors , View , Text , Picker , Incubator , Switch } from 'react-native-ui-lib' ; //eslint-disable-line
6
6
import { navigationData } from './MenuStructure' ;
7
7
8
8
const none = { label : '[None]' , value : '' } ;
9
- const playgroundScreen = { label : 'Playground' , value : 'unicorn.PlaygroundScreen' } ;
10
9
11
10
class SettingsScreen extends Component {
12
11
constructor ( props ) {
13
12
super ( props ) ;
14
13
15
14
const data = props . navigationData || navigationData ;
16
- const playground = props . playground || playgroundScreen ;
15
+ const playground = props . playground ;
16
+
17
+ const screens = [
18
+ none ,
19
+ ..._ . flow ( _ . values ,
20
+ screens => _ . map ( screens , 'screens' ) ,
21
+ _ . flatten ,
22
+ screens => _ . map ( screens , screen => ( { label : screen . title , value : screen . screen } ) ) ) ( data )
23
+ ] ;
24
+
25
+ if ( playground ) {
26
+ screens . splice ( 1 , 0 , playground ) ;
27
+ }
17
28
18
29
this . state = {
19
30
showRefreshMessage : false ,
20
- screens : [
21
- none ,
22
- playground ,
23
- ..._ . flow ( _ . values ,
24
- screens => _ . map ( screens , 'screens' ) ,
25
- _ . flatten ,
26
- screens => _ . map ( screens , screen => ( { label : screen . title , value : screen . screen } ) ) ) ( data )
27
- ]
31
+ screens
28
32
} ;
29
33
}
30
34
@@ -107,7 +111,10 @@ class SettingsScreen extends Component {
107
111
< Text text30 grey10 >
108
112
Settings
109
113
</ Text >
110
- < Toast visible = { showRefreshMessage } position = "bottom" message = "Refresh the app!" />
114
+ < Incubator . Toast
115
+ visible = { showRefreshMessage }
116
+ message = { `Default screen set to: ${ defaultScreen ?. label } . Please refresh the app.` }
117
+ />
111
118
</ View >
112
119
) ;
113
120
}
0 commit comments