Browse Source

renamte to Options

Daniel Zlotin 7 years ago
parent
commit
fddcebb059

+ 5
- 5
README.md View File

33
 
33
 
34
 ## v2 Roadmap
34
 ## v2 Roadmap
35
 
35
 
36
-### Current Priorities 
36
+### Current Priorities
37
 
37
 
38
 1) buttons in Android
38
 1) buttons in Android
39
 2) showOverlay in iOS
39
 2) showOverlay in iOS
40
 3) showOverlay in Android
40
 3) showOverlay in Android
41
 4) async commands
41
 4) async commands
42
-5) currentTab 
43
-6) change navigationOptions to be nested
42
+5) currentTab
43
+6) change Options to be nested
44
 7) topTabs in both platforms, with API implications
44
 7) topTabs in both platforms, with API implications
45
 
45
 
46
 ### Top API
46
 ### Top API
129
 | sideMenuVisible          |        [Contribute](/docs/docs/CONTRIBUTING.md)   | [Contribute](/docs/docs/CONTRIBUTING.md) |
129
 | sideMenuVisible          |        [Contribute](/docs/docs/CONTRIBUTING.md)   | [Contribute](/docs/docs/CONTRIBUTING.md) |
130
 
130
 
131
 
131
 
132
-## v1 vs v2 Feature Comparison  
132
+## v1 vs v2 Feature Comparison
133
 v2 currently supports most of react-native-navigation’s basic functionality but it is still behind v1.
133
 v2 currently supports most of react-native-navigation’s basic functionality but it is still behind v1.
134
 Here is the full comparison of features between v1 and v2 (will be updated regularly):
134
 Here is the full comparison of features between v1 and v2 (will be updated regularly):
135
 ### Top Level API
135
 ### Top Level API
203
 | customTransition(shared element)       |     :x:  |     WIP @bogobogo     | [Contribute](/docs/docs/CONTRIBUTING.md)|
203
 | customTransition(shared element)       |     :x:  |     WIP @bogobogo     | [Contribute](/docs/docs/CONTRIBUTING.md)|
204
 | splitViewScreen       |     :x:  |    [Contribute](/docs/docs/CONTRIBUTING.md)      | [Contribute](/docs/docs/CONTRIBUTING.md)|
204
 | splitViewScreen       |     :x:  |    [Contribute](/docs/docs/CONTRIBUTING.md)      | [Contribute](/docs/docs/CONTRIBUTING.md)|
205
 
205
 
206
-Element transitions, adding buttons and styles are not yet implemented. [Contribute](/docs/docs/CONTRIBUTING.md)  
206
+Element transitions, adding buttons and styles are not yet implemented. [Contribute](/docs/docs/CONTRIBUTING.md)
207
 
207
 

+ 1
- 1
docs/docs/Container.md View File

7
 | name | <code>string</code> | The container's registered name |
7
 | name | <code>string</code> | The container's registered name |
8
 | topTabs | [<code>Array.&lt;Container&gt;</code>](#Container) |  |
8
 | topTabs | [<code>Array.&lt;Container&gt;</code>](#Container) |  |
9
 | passProps | <code>object</code> | props |
9
 | passProps | <code>object</code> | props |
10
-| navigationOptions | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/NavigationOptions">NavigationOptions</a> |  |
10
+| options | <a href="https://wix.github.io/react-native-navigation/v2/#/docs/Options">Options</a> |  |
11
 
11
 

+ 1
- 1
lib/src/commands/LayoutTreeCrawler.js View File

33
 
33
 
34
   _applyStaticOptions(node) {
34
   _applyStaticOptions(node) {
35
     const clazz = this.store.getOriginalContainerClassForName(node.data.name) || {};
35
     const clazz = this.store.getOriginalContainerClassForName(node.data.name) || {};
36
-    const staticOptions = _.cloneDeep(clazz.navigationOptions) || {};
36
+    const staticOptions = _.cloneDeep(clazz.options) || {};
37
     const passedOptions = node.data.options || {};
37
     const passedOptions = node.data.options || {};
38
     node.data.options = _.merge({}, staticOptions, passedOptions);
38
     node.data.options = _.merge({}, staticOptions, passedOptions);
39
   }
39
   }

+ 1
- 1
lib/src/commands/LayoutTreeCrawler.test.js View File

70
       opt: 'exists only in static'
70
       opt: 'exists only in static'
71
     };
71
     };
72
     const MyContainer = class {
72
     const MyContainer = class {
73
-      static get navigationOptions() {
73
+      static get options() {
74
         return theStyle;
74
         return theStyle;
75
       }
75
       }
76
     };
76
     };

+ 3
- 3
lib/src/commands/OptionsProcessor.test.js View File

97
     options.someKeyColor = 'rgb(255, 0, 255)';
97
     options.someKeyColor = 'rgb(255, 0, 255)';
98
     options.topBar = { textColor: 'red' };
98
     options.topBar = { textColor: 'red' };
99
     options.topBar.innerMostObj = { anotherColor: 'yellow' };
99
     options.topBar.innerMostObj = { anotherColor: 'yellow' };
100
-    const navigationOptionsObj = new Options(options);
100
+    const optionsObj = new Options(options);
101
 
101
 
102
-    OptionsProcessor.processOptions(navigationOptionsObj);
102
+    OptionsProcessor.processOptions(optionsObj);
103
 
103
 
104
-    expect(navigationOptionsObj.topBar.textColor).toEqual(0xffff0000);
104
+    expect(optionsObj.topBar.textColor).toEqual(0xffff0000);
105
   });
105
   });
106
 
106
 
107
   it('undefined value return undefined ', () => {
107
   it('undefined value return undefined ', () => {

+ 1
- 1
playground/src/containers/BackHandlerScreen.js View File

4
 const { View, Text, Button, BackHandler } = require('react-native');
4
 const { View, Text, Button, BackHandler } = require('react-native');
5
 
5
 
6
 class BackHandlerScreen extends Component {
6
 class BackHandlerScreen extends Component {
7
-  static get navigationOptions() {
7
+  static get options() {
8
     return {
8
     return {
9
       topBar: {
9
       topBar: {
10
         title: 'Back Handler',
10
         title: 'Back Handler',

+ 2
- 2
playground/src/containers/CustomTransitionDestination.js View File

10
     this.push = this.push.bind(this);
10
     this.push = this.push.bind(this);
11
   }
11
   }
12
 
12
 
13
-  static get navigationOptions() {
13
+  static get options() {
14
     return {
14
     return {
15
       backButtonTransition: 'custom',
15
       backButtonTransition: 'custom',
16
       topBar: {
16
       topBar: {
57
           <Text style={styles.p}>{`Lorem ipsum dolor sit amet, consectetur adipiscing elit,
57
           <Text style={styles.p}>{`Lorem ipsum dolor sit amet, consectetur adipiscing elit,
58
            sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
58
            sed do eiusmod tempor incididunt ut labore et dolore magna aliqua.
59
            Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
59
            Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris
60
-           nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit 
60
+           nisi ut aliquip ex ea commodo consequat. Duis aute irure dolor in reprehenderit
61
            in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
61
            in voluptate velit esse cillum dolore eu fugiat nulla pariatur. Excepteur sint occaecat
62
           cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum`}
62
           cupidatat non proident, sunt in culpa qui officia deserunt mollit anim id est laborum`}
63
           </Text>
63
           </Text>

+ 1
- 1
playground/src/containers/CustomTransitionOrigin.js View File

8
     super(props);
8
     super(props);
9
     this.onClickNavigationIcon = this.onClickNavigationIcon.bind(this);
9
     this.onClickNavigationIcon = this.onClickNavigationIcon.bind(this);
10
   }
10
   }
11
-  static get navigationOptions() {
11
+  static get options() {
12
     return {
12
     return {
13
       topBar: {
13
       topBar: {
14
         textFontFamily: 'HelveticaNeue-Italic',
14
         textFontFamily: 'HelveticaNeue-Italic',

+ 1
- 1
playground/src/containers/ModalScreen.js View File

9
 const testIDs = require('../testIDs');
9
 const testIDs = require('../testIDs');
10
 
10
 
11
 class ModalScreen extends Component {
11
 class ModalScreen extends Component {
12
-  static get navigationOptions() {
12
+  static get options() {
13
     return {
13
     return {
14
       orientation: ['portrait']
14
       orientation: ['portrait']
15
     };
15
     };

+ 1
- 1
playground/src/containers/OptionsScreen.js View File

11
 const BUTTON_LEFT = 'buttonLeft';
11
 const BUTTON_LEFT = 'buttonLeft';
12
 
12
 
13
 class OptionsScreen extends Component {
13
 class OptionsScreen extends Component {
14
-  static get navigationOptions() {
14
+  static get options() {
15
     return {
15
     return {
16
       topBar: {
16
       topBar: {
17
         title: 'Static Title',
17
         title: 'Static Title',

+ 1
- 1
playground/src/containers/ScrollViewScreen.js View File

7
 const testIDs = require('../testIDs');
7
 const testIDs = require('../testIDs');
8
 
8
 
9
 class ScrollViewScreen extends Component {
9
 class ScrollViewScreen extends Component {
10
-  static get navigationOptions() {
10
+  static get options() {
11
     return {
11
     return {
12
       topBar: {
12
       topBar: {
13
         translucent: false
13
         translucent: false

+ 1
- 1
playground/src/containers/TextScreen.js View File

9
 let globalFirstContainerID;
9
 let globalFirstContainerID;
10
 
10
 
11
 class TextScreen extends Component {
11
 class TextScreen extends Component {
12
-  static get navigationOptions() {
12
+  static get options() {
13
     return {
13
     return {
14
       bottomTabs: {
14
       bottomTabs: {
15
         testID: testIDs.BOTTOM_TABS_ELEMENT
15
         testID: testIDs.BOTTOM_TABS_ELEMENT

+ 1
- 1
playground/src/containers/TopTabOptionsScreen.js View File

5
 const Navigation = require('react-native-navigation');
5
 const Navigation = require('react-native-navigation');
6
 
6
 
7
 class TopTabOptionsScreen extends PureComponent {
7
 class TopTabOptionsScreen extends PureComponent {
8
-  static get navigationOptions() {
8
+  static get options() {
9
     return {
9
     return {
10
       topBar: {
10
       topBar: {
11
         title: 'Tab 1',
11
         title: 'Tab 1',

+ 1
- 1
playground/src/containers/TopTabScreen.js View File

4
 const Navigation = require('react-native-navigation');
4
 const Navigation = require('react-native-navigation');
5
 
5
 
6
 class TopTabScreen extends PureComponent {
6
 class TopTabScreen extends PureComponent {
7
-  static get navigationOptions() {
7
+  static get options() {
8
     return {
8
     return {
9
       topBar: {
9
       topBar: {
10
         textColor: 'black',
10
         textColor: 'black',

+ 7
- 7
playground/src/containers/WelcomeScreen.js View File

7
 const Navigation = require('react-native-navigation');
7
 const Navigation = require('react-native-navigation');
8
 
8
 
9
 class WelcomeScreen extends Component {
9
 class WelcomeScreen extends Component {
10
-  static get navigationOptions() {
10
+  static get options() {
11
     return {
11
     return {
12
       topBar: {
12
       topBar: {
13
         largeTitle: false
13
         largeTitle: false
54
               text: 'This is tab 1',
54
               text: 'This is tab 1',
55
               myFunction: () => 'Hello from a function!'
55
               myFunction: () => 'Hello from a function!'
56
             },
56
             },
57
-            navigationOptions: {
57
+            options: {
58
               bottomTab: {
58
               bottomTab: {
59
                 title: 'Tab 1',
59
                 title: 'Tab 1',
60
                 testID: testIDs.FIRST_TAB_BAR_BUTTON
60
                 testID: testIDs.FIRST_TAB_BAR_BUTTON
68
             passProps: {
68
             passProps: {
69
               text: 'This is tab 2'
69
               text: 'This is tab 2'
70
             },
70
             },
71
-            navigationOptions: {
71
+            options: {
72
               bottomTab: {
72
               bottomTab: {
73
                 title: 'Tab 2',
73
                 title: 'Tab 2',
74
                 testID: testIDs.SECOND_TAB_BAR_BUTTON
74
                 testID: testIDs.SECOND_TAB_BAR_BUTTON
168
             title: 'Tab 1',
168
             title: 'Tab 1',
169
             text: 'This is top tab 1'
169
             text: 'This is top tab 1'
170
           },
170
           },
171
-          navigationOptions: {
171
+          options: {
172
             topTab: {
172
             topTab: {
173
               title: 'Tab 1'
173
               title: 'Tab 1'
174
             }
174
             }
180
             title: 'Tab 2',
180
             title: 'Tab 2',
181
             text: 'This is top tab 2'
181
             text: 'This is top tab 2'
182
           },
182
           },
183
-          navigationOptions: {
183
+          options: {
184
             topTab: {
184
             topTab: {
185
               title: 'Tab 2',
185
               title: 'Tab 2',
186
               titleFontFamily: 'Dosis-Regular'
186
               titleFontFamily: 'Dosis-Regular'
193
             title: 'Tab 3',
193
             title: 'Tab 3',
194
             text: 'This is top tab 3'
194
             text: 'This is top tab 3'
195
           },
195
           },
196
-          navigationOptions: {
196
+          options: {
197
             topTab: {
197
             topTab: {
198
               title: 'Tab 3'
198
               title: 'Tab 3'
199
             }
199
             }
200
           }
200
           }
201
         }
201
         }
202
       ],
202
       ],
203
-      navigationOptions: {
203
+      options: {
204
         topTabs: {
204
         topTabs: {
205
           selectedTabColor: '#12766b',
205
           selectedTabColor: '#12766b',
206
           unselectedTabColor: 'red',
206
           unselectedTabColor: 'red',