React Native – Text
Text
is used for displaying text. It supports styling, nesting, and touch handling.
Use Cases:
- Displaying static text.
- Styling different parts of text differently using nested
Text
components. - Handling text touch events.
Example:
import React from 'react';
import { Text, StyleSheet } from 'react-native';
const App = () => {
return (
<Text style={styles.text}>Hello, Text!</Text>
);
};
const styles = StyleSheet.create({
text: {
fontSize: 20,
color: 'blue',
textAlign: 'center',
marginTop: 50,
},
});
export default App;