【发布时间】:2019-04-08 10:28:31
【问题描述】:
每当我尝试输入 TextInput 时,我都会收到以下警告: 提供给“textinput”预期“字符串”的“对象”类型的“道具”类型无效的道具“值”失败
LoginForm.js
import React, { Component } from 'react';
import { Card, CardSection, Button, Input } from './common';
class LoginForm extends Component {
state = { email: '', password: '', error: '' };
render() {
return (
<Card>
<CardSection>
<Input
label='Email'
placeholder='user@gmail.com'
value={this.state.email}
onChangeText={(email) => this.setState({ email: email } )}
/>
</CardSection>
Input.js
import React from 'react';
import { TextInput, View, Text } from 'react-native';
const Input = ({ label, value, onChangeText, placeholder, secureTextEntry }) => {
return (
<View style={styles.containerStyle}>
<Text style={styles.labelStyle}>{ label }</Text>
<TextInput
secureTextEntry={secureTextEntry}
placeholder={placeholder}
style={styles.inputStyle}
value={value}
onChange={onChangeText}
autoCorrect={false}
/>
</View>
);
};
你能帮我找出问题吗?
【问题讨论】:
标签: react-native