Browse Source

Resolve BottomTab options before creating BottomTab icon

Guy Carmeli 6 years ago
parent
commit
2f317da2f6

+ 1
- 1
lib/android/app/src/main/java/com/reactnativenavigation/viewcontrollers/bottomtabs/BottomTabsController.java View File

130
         List<BottomTabOptions> bottomTabOptionsList = new ArrayList<>();
130
         List<BottomTabOptions> bottomTabOptionsList = new ArrayList<>();
131
         for (int i = 0; i < tabs.size(); i++) {
131
         for (int i = 0; i < tabs.size(); i++) {
132
             tabs.get(i).setParentController(this);
132
             tabs.get(i).setParentController(this);
133
-            BottomTabOptions tabOptions = tabs.get(i).options.bottomTabOptions;
133
+            BottomTabOptions tabOptions = tabs.get(i).resolveCurrentOptions().bottomTabOptions;
134
             if (!tabOptions.icon.hasValue()) {
134
             if (!tabOptions.icon.hasValue()) {
135
                 throw new RuntimeException("BottomTab must have an icon");
135
                 throw new RuntimeException("BottomTab must have an icon");
136
             }
136
             }

+ 6
- 6
playground/src/screens/WelcomeScreen.js View File

85
                           title: {
85
                           title: {
86
                             text: 'React Native Navigation!'
86
                             text: 'React Native Navigation!'
87
                           }
87
                           }
88
+                        },
89
+                        bottomTab: {
90
+                          text: 'Tab 1',
91
+                          icon: require('../images/one.png'),
92
+                          selectedIcon: require('../images/one.png'),
93
+                          testID: testIDs.FIRST_TAB_BAR_BUTTON
88
                         }
94
                         }
89
                       }
95
                       }
90
                     }
96
                     }
91
                   }
97
                   }
92
                 ],
98
                 ],
93
                 options: {
99
                 options: {
94
-                  bottomTab: {
95
-                    text: 'Tab 1',
96
-                    icon: require('../images/one.png'),
97
-                    selectedIcon: require('../images/one.png'),
98
-                    testID: testIDs.FIRST_TAB_BAR_BUTTON
99
-                  },
100
                   topBar: {
100
                   topBar: {
101
                     visible: false
101
                     visible: false
102
                   }
102
                   }