【问题标题】:React Native Router Flux Screen not showing inside the ModelReact Native Router Flux Screen 未在模型内显示
【发布时间】:2019-06-20 11:47:45
【问题描述】:

我在文本点击中打开模型。模型正确打开,但在模型内部还有导航按钮已打开表单。按钮未打开表单。

'调用模型:'

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

'渲染模型:'

    renderClientModal() {
    return(
        <Modal visible={this.state.showClientModal}
            //onRequestClose={() => { }}
            onRequestClose={() => this.setState({ showClientModal: false })}
            animationType="slide">
            <ClientScreen all_clients = {get_all_clients()} 
                onBack={()=>{this.setState({showClientModal:false})}} 
                onAddClient={this.addClientScreen.bind(this)} 
                onPressClient={this.closeModal.bind(this)} 
                selectClient state={this.baseState}
                addClient={true} />
        </Modal>
    )
}

'客户端屏幕': 返回(

            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()}}
    />
    )
}

最后一个代码的 onAddPress 路由到 Actions.AddClient() 不起作用。

【问题讨论】:

    标签: react-native react-native-router-flux


    【解决方案1】:

    我已经通过自己的研究解决了。我在 componentWillReceiveProps 中调用了一个 setState 方法,所以注释掉这个方法以便正常工作。

    【讨论】:

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