Sfoglia il codice sorgente

Resolve BottomTab options before creating BottomTab icon

Guy Carmeli 6 anni fa
parent
commit
2f317da2f6

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

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

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

@@ -85,18 +85,18 @@ class WelcomeScreen extends Component {
85 85
                           title: {
86 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 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 100
                   topBar: {
101 101
                     visible: false
102 102
                   }