包裹在App和Redux中时,选项卡导航不起作用

时间:2019-02-05 19:47:41

标签: react-native

我有此标签导航,我想将其包装在我的redux中,以便所有redux都可用于整个应用程序。 但是,我无法在React Native中使用TabNavigator做到这一点。还有一种方法可以使标签保持在顶部吗?

代码如下:

   import React from 'react';
   import { Provider } from 'react-redux';
   import { StyleSheet, Text, View } from 'react-native';
   import store from './store';

   import { StackNavigator, TabNavigator } from 'react-navigation';

    import { createBottomTabNavigator, createAppContainer, 
      createStackNavigator, } from 'react-navigation';

    class HomeScreen extends React.Component {
      render() {
         return (
          <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' ,backgroundColor:'blue'}}>
         <Text>Home!</Text>
        </View>
       );
      }
     }

   class SettingsScreen extends React.Component {
       render() {
         return (
        <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
         <Text>Settings!</Text>
      </View>
     );
     }
    }

   const Tab =  createBottomTabNavigator({
      Home: HomeScreen,
     Settings: SettingsScreen,
  });
   const TabNavigation=createAppContainer(TabNavigator);



    class App extends React.Component {
      render() {
       console.disableYellowBox=true;
        return (
      <Provider store={store}>
          <TabNavigation/>
        </Provider>

      );
   }
 }
  const styles = StyleSheet.create({
     container: {
      flex: 1,
    justifyContent:'center',
    alignItems:'center',
   }
   });
export default App;

0 个答案:

没有答案