我正在尝试创建一个登录表单,但出现此错误。
export default function LoginScreen(props) {
const [Submit, setSubmit] = React.useState('')
const windowWidth = Dimensions.get('window').width
const windowHeight = Dimensions.get('window').height
const [valuePass, setValuePass] = React.useState('')
const [valueUsername, setValueUsername] = React.useState('')
const [secureTextEntry, setSecureTextEntry] = React.useState(true)
const toggleSecureEntry = () => {
setSecureTextEntry(!secureTextEntry)
}
const AlertIcon = (props) => <Icon {...props} name='alert-circle-outline' />
const renderIcon = (props) => (
<TouchableWithoutFeedback onPress={toggleSecureEntry}>
<Icon {...props} name={secureTextEntry ? 'eye-off' : 'eye'} />
</TouchableWithoutFeedback>
)
return (
<View>
<Text>Login</Text>
<Input
placeholder='Username'
value={valueUsername}
style={{ width: windowWidth - 50, borderRadius: 16 }}
onChangeText={(nextValue) => setValueUsername(nextValue)}
size='large'
/>
<View style={{ height: 15 }}></View>
<Input
style={{ width: windowWidth - 50, borderRadius: 16 }}
size='large'
value={valuePass}
placeholder='Password'
caption='Should contain at least 8 symbols'
accessoryRight={renderIcon}
captionIcon={AlertIcon}
secureTextEntry={secureTextEntry}
onChangeText={(nextValue) => setValuePass(nextValue)}
/>
<View style={{ marginTop: 25 }}>
<Button
style={{ borderRadius: 15 }}
onPress={setSubmit(true)}
size='large'
>
Submit
</Button>
</View>
</View>
)
}
谁能解释为什么会发生这个错误?
我是本机react的新手。
忽略这个(只是为了增加音量)==我必须添加一些无用的句子,因为 StackOverflow 给了我'It looks like your post is mostly code; please add some more details.'
(对这个 stackoverflow 错误感到很沮丧)