0
0
React Nativemobile~5 mins

Text component in React Native - Cheat Sheet & Quick Revision

Choose your learning style9 modes available
Recall & Review
beginner
What is the purpose of the <Text> component in React Native?
The <Text> component is used to display text on the screen in a React Native app. It can show simple or styled text and supports nesting other <Text> components.
Click to reveal answer
beginner
How do you apply styles to a <Text> component in React Native?
You apply styles by passing a style object or array to the style prop of the component, for example: Hello.
Click to reveal answer
intermediate
Can you nest <Text> components inside each other in React Native? Why?
Yes, nesting <Text> components is allowed and useful to apply different styles to parts of the text or to combine text with inline elements.
Click to reveal answer
intermediate
What accessibility feature should you consider when using <Text> components?
Use the accessibilityLabel prop to provide a descriptive label for screen readers, especially if the text is not clear or is an icon substitute.
Click to reveal answer
intermediate
How does the <Text> component handle long text that doesn't fit on one line?
By default, <Text> wraps text to the next line. You can control this with props like numberOfLines to limit lines or ellipsizeMode to show '...' when text is cut off.
Click to reveal answer
Which prop is used to style a <Text> component in React Native?
AclassName
BtextStyle
Ccss
Dstyle
What happens if you nest multiple <Text> components inside each other?
AYou can apply different styles to parts of the text
BOnly the outermost text is shown
CIt causes an error
DText components cannot be nested
How do you limit a <Text> component to show only 2 lines of text?
AUse maxLines={2}
BUse lineLimit={2}
CUse numberOfLines={2}
DUse lines={2}
Which prop helps screen readers understand the purpose of a <Text> component?
AaccessibilityLabel
BariaLabel
Clabel
DscreenReaderText
What is the default behavior of <Text> when the text is too long for one line?
AIt cuts off the text
BIt wraps the text to the next line
CIt scrolls horizontally
DIt shows an error
Explain how you would display a styled sentence with one word in bold using the component.
Think about putting a <Text> inside another <Text> and styling the inner one.
You got /3 concepts.
    Describe how to make text accessible for screen readers in React Native using the component.
    Consider what helps a screen reader understand what the text means.
    You got /3 concepts.