Top Related Projects
An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
Flutter makes it easy and fast to build beautiful apps for mobile and beyond
⚡ Empowering JavaScript with native platform APIs. ✨ Best of all worlds (TypeScript, Swift, Objective C, Kotlin, Java, Dart). Use what you love ❤️ Angular, Capacitor, Ionic, React, Solid, Svelte, Vue with: iOS (UIKit, SwiftUI), Android (View, Jetpack Compose), Dart (Flutter) and you name it compatible.
A framework for building native Windows apps with React.
Quick Overview
React Native is an open-source mobile application development framework created by Facebook. It allows developers to build mobile apps for both iOS and Android platforms using JavaScript and React. React Native enables the creation of truly native apps and doesn't compromise on users' experience.
Pros
- Cross-platform development: Write code once and deploy on both iOS and Android
- Large community and ecosystem: Extensive libraries, tools, and third-party plugins
- Hot reloading: See changes instantly without rebuilding the entire app
- Native performance: Utilizes the device's GPU and provides a native look and feel
Cons
- Learning curve: Requires knowledge of React and mobile development concepts
- Debugging can be challenging: Errors may be difficult to trace in complex apps
- Native modules: Some features may require platform-specific native code
- Updates and maintenance: Keeping up with React Native updates can be time-consuming
Code Examples
- Creating a simple component:
import React from 'react';
import { Text, View } from 'react-native';
const HelloWorld = () => {
return (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>Hello, World!</Text>
</View>
);
};
export default HelloWorld;
- Handling user input:
import React, { useState } from 'react';
import { TextInput, Button, View } from 'react-native';
const InputExample = () => {
const [text, setText] = useState('');
return (
<View>
<TextInput
value={text}
onChangeText={setText}
placeholder="Enter text here"
/>
<Button title="Submit" onPress={() => console.log(text)} />
</View>
);
};
- Using the FlatList component:
import React from 'react';
import { FlatList, Text, View } from 'react-native';
const data = [
{ id: '1', title: 'Item 1' },
{ id: '2', title: 'Item 2' },
{ id: '3', title: 'Item 3' },
];
const ListExample = () => {
return (
<FlatList
data={data}
renderItem={({ item }) => <Text>{item.title}</Text>}
keyExtractor={item => item.id}
/>
);
};
Getting Started
-
Install React Native CLI:
npm install -g react-native-cli
-
Create a new React Native project:
npx react-native init MyApp
-
Navigate to the project directory:
cd MyApp
-
Start the development server:
npx react-native start
-
Run the app on iOS or Android:
npx react-native run-ios # or npx react-native run-android
Competitor Comparisons
An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
Pros of Expo
- Simplified development process with a managed workflow
- Easier access to native device features without additional configuration
- Rapid prototyping and quick setup for new projects
Cons of Expo
- Limited customization options for native modules
- Larger app size due to included libraries and features
- Dependency on Expo's ecosystem and update cycle
Code Comparison
React Native (basic setup):
import React from 'react';
import { View, Text } from 'react-native';
export default function App() {
return (
<View>
<Text>Hello, React Native!</Text>
</View>
);
}
Expo (basic setup):
import React from 'react';
import { View, Text } from 'react-native';
import { StatusBar } from 'expo-status-bar';
export default function App() {
return (
<View>
<Text>Hello, Expo!</Text>
<StatusBar style="auto" />
</View>
);
}
The main difference in the code is the inclusion of Expo-specific components and modules, such as the StatusBar from expo-status-bar. Expo provides a more streamlined approach with pre-configured components, while React Native offers more flexibility but requires additional setup for certain features.
A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
Pros of Ionic Framework
- Uses standard web technologies (HTML, CSS, JavaScript), making it easier for web developers to transition
- Offers a wide range of pre-built UI components and native-like styling
- Supports multiple platforms from a single codebase, including web, iOS, and Android
Cons of Ionic Framework
- Performance can be slower compared to React Native, especially for complex applications
- Less direct access to native APIs, often requiring plugins or additional wrappers
- Smaller community and ecosystem compared to React Native
Code Comparison
Ionic Framework (Angular):
import { Component } from '@angular/core';
@Component({
selector: 'app-home',
template: '<ion-button>Click me</ion-button>'
})
export class HomeComponent {}
React Native:
import React from 'react';
import { Button } from 'react-native';
const HomeScreen = () => (
<Button title="Click me" onPress={() => {}} />
);
export default HomeScreen;
Both frameworks aim to simplify cross-platform mobile development, but they take different approaches. Ionic Framework leverages web technologies and provides a more web-like development experience, while React Native uses a JavaScript runtime to render native components, offering better performance for complex apps. The choice between them often depends on the developer's background, project requirements, and performance needs.
Flutter makes it easy and fast to build beautiful apps for mobile and beyond
Pros of Flutter
- Single codebase for multiple platforms (iOS, Android, web, desktop)
- Faster development with hot reload and extensive widget library
- Smooth, high-performance animations and UI
Cons of Flutter
- Larger app size compared to native applications
- Less mature ecosystem and fewer third-party libraries
- Steeper learning curve for developers new to Dart language
Code Comparison
Flutter:
import 'package:flutter/material.dart';
class MyApp extends StatelessWidget {
@override
Widget build(BuildContext context) {
return MaterialApp(
home: Scaffold(
appBar: AppBar(title: Text('Flutter App')),
body: Center(child: Text('Hello, World!')),
),
);
}
}
React Native:
import React from 'react';
import { View, Text } from 'react-native';
const App = () => (
<View style={{ flex: 1, justifyContent: 'center', alignItems: 'center' }}>
<Text>Hello, World!</Text>
</View>
);
export default App;
Both frameworks offer declarative UI development, but Flutter uses Dart and its own widget system, while React Native leverages JavaScript and React components. Flutter's approach provides more consistency across platforms, while React Native allows for easier integration with native modules and existing web development skills.
⚡ Empowering JavaScript with native platform APIs. ✨ Best of all worlds (TypeScript, Swift, Objective C, Kotlin, Java, Dart). Use what you love ❤️ Angular, Capacitor, Ionic, React, Solid, Svelte, Vue with: iOS (UIKit, SwiftUI), Android (View, Jetpack Compose), Dart (Flutter) and you name it compatible.
Pros of NativeScript
- Uses standard web technologies (JavaScript, CSS, XML) for a familiar development experience
- Provides direct access to native APIs without plugins or wrappers
- Supports Angular, Vue.js, and plain JavaScript for flexibility in framework choice
Cons of NativeScript
- Smaller community and ecosystem compared to React Native
- Less mature tooling and third-party library support
- Steeper learning curve for developers new to mobile development
Code Comparison
NativeScript (XML):
<StackLayout>
<Label text="Hello, NativeScript!" />
<Button text="Click Me" tap="onButtonTap" />
</StackLayout>
React Native (JSX):
import React from 'react';
import { View, Text, Button } from 'react-native';
const App = () => (
<View>
<Text>Hello, React Native!</Text>
<Button title="Click Me" onPress={onButtonPress} />
</View>
);
Both frameworks aim to create native mobile apps using web technologies, but they differ in syntax and approach. NativeScript uses XML-like markup for UI, while React Native uses JSX. React Native has a larger community and more extensive third-party support, making it easier to find resources and libraries. However, NativeScript offers more direct access to native APIs and supports multiple frameworks, providing greater flexibility for developers familiar with Angular or Vue.js.
A framework for building native Windows apps with React.
Pros of React Native Windows
- Native Windows UI components and APIs integration
- Support for Windows-specific features and hardware
- Optimized performance for Windows devices
Cons of React Native Windows
- Smaller community and ecosystem compared to React Native
- Potential compatibility issues with some React Native libraries
- Limited to Windows platform development
Code Comparison
React Native (for iOS/Android):
import { Platform } from 'react-native';
const styles = StyleSheet.create({
container: {
marginTop: Platform.OS === 'ios' ? 20 : 0,
},
});
React Native Windows:
import { Platform } from 'react-native';
const styles = StyleSheet.create({
container: {
marginTop: Platform.OS === 'windows' ? 30 : 0,
},
});
Key Differences
- React Native focuses on iOS and Android, while React Native Windows targets Windows platforms
- React Native Windows provides access to Windows-specific APIs and UI components
- React Native has a larger community and more third-party libraries
- React Native Windows requires separate development and maintenance for Windows apps
Use Cases
- React Native: Cross-platform mobile app development for iOS and Android
- React Native Windows: Developing native Windows applications using React Native paradigms
Community and Support
- React Native: Large, active community with extensive documentation and resources
- React Native Windows: Smaller but growing community, backed by Microsoft
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual CopilotREADME
React Native
Learn once, write anywhere:
Build mobile apps with React.
Getting Started · Learn the Basics · Showcase · Contribute · Community · Support
React Native brings React's declarative UI framework to iOS and Android. With React Native, you use native UI controls and have full access to the native platform.
- Declarative. React makes it painless to create interactive UIs. Declarative views make your code more predictable and easier to debug.
- Component-Based. Build encapsulated components that manage their state, then compose them to make complex UIs.
- Developer Velocity. See local changes in seconds. Changes to JavaScript code can be live reloaded without rebuilding the native app.
- Portability. Reuse code across iOS, Android, and other platforms.
React Native is developed and supported by many companies and individual core contributors. Find out more in our ecosystem overview.
Contents
- Requirements
- Building your first React Native app
- Documentation
- Upgrading
- How to Contribute
- Code of Conduct
- License
ð Requirements
React Native apps may target iOS 15.1 and Android 7.0 (API 24) or newer. You may use Windows, macOS, or Linux as your development operating system, though building and running iOS apps is limited to macOS. Tools like Expo can be used to work around this.
ð Building your first React Native app
Follow the Getting Started guide. The recommended way to install React Native depends on your project. Here you can find short guides for the most common scenarios:
ð Documentation
The full documentation for React Native can be found on our website.
The React Native documentation discusses components, APIs, and topics that are specific to React Native. For further documentation on the React API that is shared between React Native and React DOM, refer to the React documentation.
The source for the React Native documentation and website is hosted on a separate repository, @facebook/react-native-website.
ð Upgrading
Upgrading to new versions of React Native may give you access to more APIs, views, developer tools, and other goodies. See the Upgrading Guide for instructions.
React Native releases are discussed in this discussion repo.
ð How to Contribute
The main purpose of this repository is to continue evolving React Native core. We want to make contributing to this project as easy and transparent as possible, and we are grateful to the community for contributing bug fixes and improvements. Read below to learn how you can take part in improving React Native.
Code of Conduct
Facebook has adopted a Code of Conduct that we expect project participants to adhere to. Please read the full text so that you can understand what actions will and will not be tolerated.
Contributing Guide
Read our Contributing Guide to learn about our development process, how to propose bugfixes and improvements, and how to build and test your changes to React Native.
Open Source Roadmap
You can learn more about our vision for React Native in the Roadmap.
Good First Issues
We have a list of good first issues that contain bugs which have a relatively limited scope. This is a great place to get started, gain experience, and get familiar with our contribution process.
Discussions
Larger discussions and proposals are discussed in @react-native-community/discussions-and-proposals.
ð License
React Native is MIT licensed, as found in the LICENSE file.
React Native documentation is Creative Commons licensed, as found in the LICENSE-docs file.
Top Related Projects
An open-source framework for making universal native apps with React. Expo runs on Android, iOS, and the web.
A powerful cross-platform UI toolkit for building native-quality iOS, Android, and Progressive Web Apps with HTML, CSS, and JavaScript.
Flutter makes it easy and fast to build beautiful apps for mobile and beyond
⚡ Empowering JavaScript with native platform APIs. ✨ Best of all worlds (TypeScript, Swift, Objective C, Kotlin, Java, Dart). Use what you love ❤️ Angular, Capacitor, Ionic, React, Solid, Svelte, Vue with: iOS (UIKit, SwiftUI), Android (View, Jetpack Compose), Dart (Flutter) and you name it compatible.
A framework for building native Windows apps with React.
Convert designs to code with AI
Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.
Try Visual Copilot