【发布时间】:2022-01-04 05:32:15
【问题描述】:
我是原生反应的新手。 我试图使用道具将值传递给 TextInput。但是占位符没有出现。 任何人都可以帮助指出哪里出了问题?
'''
import React from 'react';
import { View,Text, TextInput } from 'react-native';
function App(){
return(
<View style={{ flex: 1, justifyContent: 'center', backgroundColor: '#ecf0f1' }}>
<InputWithLabel label="Emails"
placeholder="add text here to see in place holder"
placeholderTextColor="black"
value=" "
/>
</View>
)};
function InputWithLabel(props){
const {label,placeholder,value,onChangeText} = props;
return (
<View>
<Text>{label}</Text>
<TextInput
placeholder={placeholder}
value={value}
onChangeText={onChangeText}/>
</View>
);
}
export default App;
'''
【问题讨论】:
标签: react-native