【问题标题】:open pupop when select a tab react native选择选项卡时打开 pupop 反应原生
【发布时间】:2018-04-08 12:02:23
【问题描述】:

i'm new to react native and i want to have a tabNavigator that when 'Other' tab is selected a popup shows up .它是我的代码,但它无法识别“ModalExample”类中的“this”。 任何帮助将不胜感激。

export const Tabs = TabNavigator({
    Notifications: {
        screen: Notifications,
        navigationOptions: {
            tabBarIcon: ({ tintColor }) => <Icon name="access-alarms" size={25} color={tintColor} />
        },
    },
    Home: {
        screen: Home,
        navigationOptions: {
            tabBarIcon: ({ tintColor }) => <Icon name="home" size={25} color={tintColor} />
        },
    },

    Other: {
        screen: ModalExample,
        navigationOptions: {
            tabBarIcon: ({ tintColor }) => <Icon name="more" size={25} color={tintColor} />
        },
    },
},
{
    tabBarOptions: {
        showIcon: true,
        showLabel: false,
        scrollEnabled: false
    },
    tabBarPosition: 'bottom',
});

及其其他类:

export default class ModalExample extends Component {
constructor(props){
    super(props);

    this.popupDialog.show();
}

render() {
    return (
        <View>
            <PopupDialog
                ref={(popupDialog) => { this.popupDialog = popupDialog; }}
            >
                <View>
                    <Text>Hello</Text>
                </View>
            </PopupDialog>
        </View>
    );
}

}

【问题讨论】:

    标签: react-native popup react-native-tabnavigator


    【解决方案1】:

    我不明白您如何使用&lt;PopupDialog/&gt;。但我认为this 链接可以帮助您满足您的要求。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多