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