React native React本机路由器流量屏幕未在模型内显示 screen={Screen} title={'Client'} imageLeft={menuImage} // showHomeIcon={true} // onHomePress={()=>{Actions.pop()}} showBackIcon={true} onBackPress={()=>{Actions.pop()}} showAddIcon = {true} onLeftHeaderPress = {() => {Keyboard.dismiss(), this.state.Navigation.navigate('DrawerOpen'); } } onAddPress ={() => { >>Actions.AddClient() // Actions.pop() // this.routeToAddMeetingScreenForm() // Keyboard.dismiss() // if(applicationProperties.FirstSync === "true") { // } // else if(applicationProperties.FirstSync === "false"){ // this.setState({loading:false}) // Alert.alert( // "Error", // "Your first sync was unsuccessfull, please sync to add client", // [ // {text: 'OK', onPress: () => console.log('OK Pressed')}, // ], // { cancelable: true } // ) // } } } // showBackIcon={true} // onBackPress={()=>{Actions.pop()}} /> ) }
我是在文本点击中打开模型的。模型是正确打开的,但模型内部还有一个导航按钮可以打开表单。按钮不能打开表单React native React本机路由器流量屏幕未在模型内显示 screen={Screen} title={'Client'} imageLeft={menuImage} // showHomeIcon={true} // onHomePress={()=>{Actions.pop()}} showBackIcon={true} onBackPress={()=>{Actions.pop()}} showAddIcon = {true} onLeftHeaderPress = {() => {Keyboard.dismiss(), this.state.Navigation.navigate('DrawerOpen'); } } onAddPress ={() => { >>Actions.AddClient() // Actions.pop() // this.routeToAddMeetingScreenForm() // Keyboard.dismiss() // if(applicationProperties.FirstSync === "true") { // } // else if(applicationProperties.FirstSync === "false"){ // this.setState({loading:false}) // Alert.alert( // "Error", // "Your first sync was unsuccessfull, please sync to add client", // [ // {text: 'OK', onPress: () => console.log('OK Pressed')}, // ], // { cancelable: true } // ) // } } } // showBackIcon={true} // onBackPress={()=>{Actions.pop()}} /> ) },react-native,react-native-router-flux,React Native,React Native Router Flux,我是在文本点击中打开模型的。模型是正确打开的,但模型内部还有一个导航按钮可以打开表单。按钮不能打开表单 screen={Screen} title={'Client'} imageLeft={menuImage} // showHomeIcon={true} // onHomePress={()=>{Actions.pop()}} showBa
screen={Screen}
title={'Client'}
imageLeft={menuImage}
// showHomeIcon={true}
// onHomePress={()=>{Actions.pop()}}
showBackIcon={true}
onBackPress={()=>{Actions.pop()}}
showAddIcon = {true}
onLeftHeaderPress = {() => {Keyboard.dismiss(), this.state.Navigation.navigate('DrawerOpen'); } }
onAddPress ={() => {
>>Actions.AddClient()
// Actions.pop()
// this.routeToAddMeetingScreenForm()
// Keyboard.dismiss()
// if(applicationProperties.FirstSync === "true") {
// }
// else if(applicationProperties.FirstSync === "false"){
// this.setState({loading:false})
// Alert.alert(
// "Error",
// "Your first sync was unsuccessfull, please sync to add client",
// [
// {text: 'OK', onPress: () => console.log('OK Pressed')},
// ],
// { cancelable: true }
// )
// }
} }
// showBackIcon={true}
// onBackPress={()=>{Actions.pop()}}
/>
)
}
'调用模型:'
renderClientName(){
return(
<View style={{marginTop:10,backgroundColor:'#ffffff'}}>
<Text style={styles.textStyle}>Client Name</Text>
<TouchableOpacity onPress={()=>{
this.setState({showClientModal:true})
}}
disabled={this.isTouchDisabled()}>
<Text style={[styles.textStyle,styles.borderStyle,this.getClientBorderColor(),
{color: (this.state.clientName === "Client Name # (mandatory)") ? '#c6c6bb' : '#000'}]}>
{this.state.clientName}
</Text>
</TouchableOpacity>
{this.renderErrorText('CN')}
</View>
);
}
screen={Screen}
title={'Client'}
imageLeft={menuImage}
// showHomeIcon={true}
// onHomePress={()=>{Actions.pop()}}
showBackIcon={true}
onBackPress={()=>{Actions.pop()}}
showAddIcon = {true}
onLeftHeaderPress = {() => {Keyboard.dismiss(), this.state.Navigation.navigate('DrawerOpen'); } }
onAddPress ={() => {
>>Actions.AddClient()
// Actions.pop()
// this.routeToAddMeetingScreenForm()
// Keyboard.dismiss()
// if(applicationProperties.FirstSync === "true") {
// }
// else if(applicationProperties.FirstSync === "false"){
// this.setState({loading:false})
// Alert.alert(
// "Error",
// "Your first sync was unsuccessfull, please sync to add client",
// [
// {text: 'OK', onPress: () => console.log('OK Pressed')},
// ],
// { cancelable: true }
// )
// }
} }
// showBackIcon={true}
// onBackPress={()=>{Actions.pop()}}
/>
)
}
最后一段代码有一个addPress路由到Actions.AddClient(),无法运行。我通过自己的研究解决了这个问题。我在componentWillReceiveProps中调用了一个setState方法,所以在注释中注释掉这个方法,这样就可以正常工作了 我已经通过自己的研究解决了这个问题。我在componentWillReceiveProps中被称为setState方法,所以在评论中对这个方法进行了注释,这样可以很好地工作
screen={Screen}
title={'Client'}
imageLeft={menuImage}
// showHomeIcon={true}
// onHomePress={()=>{Actions.pop()}}
showBackIcon={true}
onBackPress={()=>{Actions.pop()}}
showAddIcon = {true}
onLeftHeaderPress = {() => {Keyboard.dismiss(), this.state.Navigation.navigate('DrawerOpen'); } }
onAddPress ={() => {
>>Actions.AddClient()
// Actions.pop()
// this.routeToAddMeetingScreenForm()
// Keyboard.dismiss()
// if(applicationProperties.FirstSync === "true") {
// }
// else if(applicationProperties.FirstSync === "false"){
// this.setState({loading:false})
// Alert.alert(
// "Error",
// "Your first sync was unsuccessfull, please sync to add client",
// [
// {text: 'OK', onPress: () => console.log('OK Pressed')},
// ],
// { cancelable: true }
// )
// }
} }
// showBackIcon={true}
// onBackPress={()=>{Actions.pop()}}
/>
)
}