0
0
React Nativemobile~5 mins

TextInput component in React Native - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the <TextInput> component in React Native?
The <TextInput> component allows users to enter and edit text in a React Native app, similar to a text box in web forms.
Click to reveal answer
beginner
How do you capture the text entered by a user in a <TextInput>?
You use the onChangeText prop to provide a function that receives the current text value whenever it changes.
Click to reveal answer
beginner
Which prop controls the placeholder text shown inside a <TextInput> before the user types?
The placeholder prop sets the light text shown inside the input when it is empty, guiding the user what to enter.
Click to reveal answer
intermediate
How can you make a <TextInput> secure for entering passwords?
Set the secureTextEntry prop to true to hide the text input, showing dots or asterisks instead of the actual characters.
Click to reveal answer
intermediate
What is the difference between controlled and uncontrolled <TextInput> components?
A controlled <TextInput> has its value managed by React state via the value prop, while an uncontrolled one manages its own internal state without React controlling it.
Click to reveal answer
Which prop do you use to update React state when the user types in a <TextInput>?
Avalue
BonChangeText
Cplaceholder
DsecureTextEntry
How do you show a hint inside a <TextInput> before the user types?
Aplaceholder
BdefaultValue
ChintText
Dlabel
What prop makes a <TextInput> hide the entered text for passwords?
AsecureTextEntry
Bpassword
Chidden
DmaskText
Which prop sets the current text shown inside a controlled <TextInput>?
Atext
Bcontent
Cvalue
DdefaultValue
What happens if you omit the onChangeText prop in a controlled <TextInput>?
AThe input shows placeholder text
BThe input clears automatically
CThe input crashes the app
DThe input becomes read-only
Explain how to create a controlled in React Native and why it is useful.
Think about how React state keeps the input text in sync.
You got /4 concepts.
    Describe how to make a password input field using and what prop you need.
    It’s a simple boolean prop that changes how text is displayed.
    You got /3 concepts.