React native TypeError:应为动态类型'string';,但是输入了'int64';从TextInout获取文本时

React native TypeError:应为动态类型'string';,但是输入了'int64';从TextInout获取文本时,react-native,react-android,React Native,React Android,这是我的问题,我尝试了一个,但无法解决这个简单的问题 export default class LoginScene extends Component { constructor(props) { super(props); this.state = { userid: '', password: '', }; } componentWillMount() {

这是我的问题,我尝试了一个,但无法解决这个简单的问题

export default class LoginScene extends Component {
    constructor(props) {
        super(props);
        this.state = {
             userid: '',
             password: '',

        };
    }

    componentWillMount() {

        // this.fetchData();
    }




    veryfyLogin() {

        fetch(LOGIN_URL)
            .then((response) => {
                if (response.status === 200) {
                    var navigator = this.props.navigator;
                    navigator.push({
                        id: 'dashboard',
                        title: 'DashBoardScene',
                        index: 1
                    });
                }

             Alert.alert(response.status);
                 })
            .done();

    }


    render() {
        onButtonPress = () => {
           Alert.alert("userid:::"+this.state.userid+"Password:::"+this.state.password);
            this.veryfyLogin();

    };

        return (

            <View  >

                <Text> User Name: </Text>

                <TextInput
                    style={{ height: 40 }}
                    ref= {(el) => { this.userid = el; }}
                    placeholder="enter your email address"
                    onChangeText={(userid) => this.setState({ userid })}
                    value={this.state.userid}
                    />

                <Text> Password: </Text>

                <TextInput
                    ref= {(el) => { this.password = el; }}
                    style={{ height: 40 }} password={true}
                    placeholder="password"
                    onChangeText={(password) => this.setState({ password })}
                    value={this.state.password}
                    />

                <Button
                    title="Login"
                    color="#841584"
                    onPress={onButtonPress}
                    accessibilityLabel="Learn more about purple"
                    />
            </View>

        )
    }
}

LoginScene.propTypes = {
    title: PropTypes.string.isRequired,
    // onForward: PropTypes.func.isRequired,
    // onBack: PropTypes.func.isRequired,
};



AppRegistry.registerComponent('LoginScene', () => LoginScene);
导出默认类LoginScene扩展组件{
建造师(道具){
超级(道具);
此.state={
用户标识:“”,
密码:“”,
};
}
组件willmount(){
//这是fetchData();
}
veryfyLogin(){
获取(登录地址)
。然后((响应)=>{
如果(response.status==200){
var navigator=this.props.navigator;
导航器。推({
id:“仪表板”,
标题:“仪表板场景”,
索引:1
});
}
警报。警报(响应。状态);
})
.完成();
}
render(){
onButtonPress=()=>{
Alert.Alert(“userid:::”+this.state.userid+”密码:::“+this.state.Password”);
这个。veryfyLogin();
};
返回(
用户名:
{this.userid=el;}}
占位符=“输入您的电子邮件地址”
onChangeText={(userid)=>this.setState({userid})}
值={this.state.userid}
/>
密码:
{this.password=el;}}
样式={height:40}}密码={true}
占位符=“密码”
onChangeText={(密码)=>this.setState({password})}
值={this.state.password}
/>
)
}
}
LoginScene.propTypes={
标题:PropTypes.string.isRequired,
//onForward:PropTypes.func.isRequired,
//onBack:PropTypes.func.isRequired,
};
AppRegistry.registerComponent('LoginScene',()=>LoginScene);

代码中有一个小错误

veryfyLogin() {

        fetch(LOGIN_URL)
            .then((response) => {
                if (response.status === 200) {
                    var navigator = this.props.navigator;
                    navigator.push({
                        id: 'dashboard',
                        title: 'DashBoardScene',
                        index: 1
                    });
                }
警报。警报(响应。状态)

Alert.Alert(响应状态)
需要一个字符串,但这里response.status在添加了
Alert.Alert(response.status+”)之后是一个整数;这对我来说很有效

                 })
            .done();

    }