Core components in React Native create real native user interfaces on your phone. This means your app looks and feels like a normal app made just for that device.
0
0
Why core components build native UIs in React Native
Introduction
When you want your app to look smooth and fast on both iPhone and Android.
When you want to use buttons, text, images, and lists that behave like native apps.
When you want your app to feel familiar to users of each platform.
When you want to avoid slow or clunky interfaces that happen with web-based apps.
When you want to build apps that can access device features easily.
Syntax
React Native
import { View, Text, Button, Image } from 'react-native'; function MyComponent() { return ( <View> <Text>Hello!</Text> <Button title="Click me" onPress={() => {}} /> <Image source={{uri: 'https://example.com/pic.png'}} /> </View> ); }
Core components like , , and
You write JSX code, but React Native turns it into native widgets behind the scenes.
Examples
This renders native text on the screen using the platform's text component.
React Native
import { Text } from 'react-native'; <Text>Simple native text</Text>
This shows a native button that users can tap, triggering an alert.
React Native
import { Button, Alert } from 'react-native'; <Button title="Press me" onPress={() => Alert.alert('Pressed!')} />
<View> acts like a native box or container to hold other components.
React Native
import { View, Text } from 'react-native'; <View> <Text>Inside a native container</Text> </View>
Sample App
This app shows a centered text and a native button. When you tap the button, a native alert pops up. The UI uses native components so it feels smooth and natural on your device.
React Native
import React from 'react'; import { View, Text, Button, Alert, StyleSheet } from 'react-native'; export default function App() { return ( <View style={styles.container}> <Text style={styles.title}>Welcome to Native UI!</Text> <Button title="Say Hello" onPress={() => Alert.alert('Hello from native button!')} /> </View> ); } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: '#f0f0f0' }, title: { fontSize: 24, marginBottom: 20 } });
OutputSuccess
Important Notes
Core components are the building blocks that React Native uses to create native apps.
They help your app look and behave like apps made with platform-specific tools.
Using core components means less work to make your app run well on different devices.
Summary
Core components create real native UI elements on iOS and Android.
This makes your app feel fast, smooth, and familiar to users.
You write simple JSX code, and React Native handles the native rendering.