TextField
A control that displays an editable text interface.
Example​
- swiftui-react-native
- SwiftUI
- React Native
const firstName = useBinding('');
<TextField placeholder="Name" text={firstName} />
@State var name: String = ""
TextField("Name", text: $name)
const [name, setName] = useState('');
<TextInput
placeholder="Name"
value={name}
onChangeText={(newName) => setName(newName)}
/>
Props​
TextField inherits all View Modifiers and Text Modifiers as props.
prop | description | type | required | default |
---|---|---|---|---|
text | The text to display and edit. | Binding<string> \| string | yes | undefined |
placeholder | The title of the text view, describing its purpose. | string | no | undefined |
onChange | Function to execute when the input text value changes | () => void | no | undefined |