2017-03-27 10 views
0

からテキストを取得しながら、ここでは」が、` int64' モードを入力していた私の私が解決していないが、できるしようとしたこの単純な小さなミスがである1はTypeError:期待される動的な型 `文字列がTextInout

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

答えて

0

コード

Alert.alert(response.status);

    }) 
      .done(); 

    } 

文字列が、ここでのResponse.Statusを期待Alert.alert(response.status);は0を追加した後の整数であり、;それは私のために働いた。

関連する問題