在clojurescript中使用React Navigation TabNavigation

时间:2019-08-09 12:35:16

标签: react-navigation clojurescript reagent

在与ClojureScript一起使用HeadTitle时遇到一些问题: -navigationOPtions的工作机制是什么? -如何使用TabNavigation和HeadTile编写互选项UI? -试剂可以做些什么工作才能到达HeadTitle吗?

这是一个官方示例:

class HomeScreen extends React.Component {
  static navigationOptions = ({ navigation }) => {
    return {
      header: "Hello",
    };
  render() {
    return (
      <View style={{ flex: 1, alignItems: 'center', justifyContent: 'center' }}>
        <Text>Home Screen</Text>
      </View>
    );
  }

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

const HomeStack = createStackNavigator({
  Home: HomeScreen
},{
  initialRouteName: 'Home'
});

const TabNavigator = createBottomTabNavigator({
  HomeScreen: {
    screen: HomeStack,
    navigationOptions:({naviagtion}) => ({
      tabBarLabel: 'home'
    })
  },
  DetailsScreen: {
    screen: DetailsScreen,
    navigationOptions:({naviagtion}) => ({
      tabBarLabel: 'detail'
    })
  }
}

const Appcontainer = createAppContainer(TabNavigator);


export default function App() {
  return (
    <Appcontainer />
  );
}

如何在ClojureScript中做到这一点?我已经使用reagent/create-class进行了尝试,但是没有用。我该怎么办?

0 个答案:

没有答案