-1

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>
    );
}

}

4

1 回答 1

0

没看懂你是怎么用的<PopupDialog/>。但我认为这个链接可以帮助你满足你的要求。

于 2018-04-09T12:22:20.290 回答