使用React声明转换const时出错

时间:2018-03-04 12:10:31

标签: javascript reactjs react-native

我需要声明以下常量:@translate(["home", "common"], { wait: true })和:const { t, i18n } = this.props;,但它会返回错误。

这是我的代码;我需要这些常量来改变图标的​​语言:

const Main = TabNavigator(
  {
    HomePage: { screen: HomePage },
    CATEGORIES: { screen: CATEGORIES },
    LOGINHOME: { screen: LOGINHOME },
    NOTIFICATIONS: { screen: NOTIFICATIONS },
    BAG: { screen: BAG }
  },
  {
    tabBarPosition: "bottom",
    tabBarComponent: props => {
      return (
        <Footer
          style={{
            marginHorizontal: -10,
            position: "absolute",
            bottom: 0,
            flexDirection: "row-reverse"
          }}>
          <FooterTab>
            <Button
              active={props.navigation.state.index === 0 ? true : false}
              onPress={() => props.navigation.navigate("HomePage")}>
              <IconSLI name="home" />
              <Text>home</Text>
            </Button>
            <Button active={props.navigation.state.index === 1 ? true : false}
              onPress={() => props.navigation.navigate("CATEGORIES")} >
              <IconSLI name="grid" />
              <Text>CATEGORIES</Text>
            </Button>
            <Button active={props.navigation.state.index === 2 ? true : false}
              onPress={() => props.navigation.navigate("LOGINHOME")}>
              <IconFA name="user-o" />
              <Text>LOGINHOME</Text>
            </Button>
            <Button active={props.navigation.state.index === 3 ? true : false}
                onPress={() => props.navigation.navigate("NOTIFICATIONS")}>
              <IconFA name="bell-o" />
              <Text>NOTIFICATIONS</Text>
            </Button>
            <Button active={props.navigation.state.index === 4 ? true : false}
              onPress={() => props.navigation.navigate("BAG")}>
              <IconSLI name="handbag" />
              <Text>BAG</Text>
            </Button>
          </FooterTab>
        </Footer>
      );
    }
  }
);
export default Main;

0 个答案:

没有答案