react-native/docs/ComponentsAndAPIs.md

9.4 KiB

id title layout category permalink next previous
components-and-apis Components and APIs docs Guides docs/components-and-apis.html platform-specific-code more-resources

React Native provides a number of built-in components. You will find a full list of components and APIs on the sidebar to the left. If you're not sure where to get started, take a look at the following categories:

You're not limited to the components and APIs bundled with React Native. React Native is a community of thousands of developers. If you're looking for a library that does something specific, search the npm registry for packages mentioning react-native, or check out Awesome React Native for a curated list.

Basic Components

Most apps will end up using one of these basic components. You'll want to get yourself familiarized with all of these if you're new to React Native.

View

The most fundamental component for building a UI.

Text

A component for displaying text.

Image

A component for displaying images.

TextInput

A component for inputting text into the app via a keyboard.

ScrollView

Provides a scrolling container that can host multiple components and views.

StyleSheet

Provides an abstraction layer similar to CSS stylesheets.

User Interface

Render common user interface controls on any platform using the following components. For platform specific components, keep reading.

Button

A basic button component for handling touches that should render nicely on any platform.

Picker

Renders the native picker component on iOS and Android.

Slider

A component used to select a single value from a range of values.

Switch

Renders a boolean input.

List Views

Unlike the more generic ScrollView, the following list view components only render elements that are currently showing on the screen. This makes them a great choice for displaying long lists of data.

FlatList

A component for rendering performant scrollable lists.

SectionList

Like FlatList, but for sectioned lists.

iOS Components and APIs

Many of the following components provide wrappers for commonly used UIKit classes.

ActionSheetIOS

API to display an iOS action sheet or share sheet.

AlertIOS

Create an iOS alert dialog with a message or create a prompt for user input.

DatePickerIOS

Renders a date/time picker (selector) on iOS.

ImagePickerIOS

Renders a image picker on iOS.

NavigatorIOS

A wrapper around UINavigationController, enabling you to implement a navigation stack.

ProgressViewIOS

Renders a UIProgressView on iOS.

PushNotificationIOS

Handle push notifications for your app, including permission handling and icon badge number.

SegmentedControlIOS

Renders a UISegmentedControl on iOS.

TabBarIOS

Renders a UITabViewController on iOS. Use with TabBarIOS.Item.

Android Components and APIs

Many of the following components provide wrappers for commonly used Android classes.

BackHandler

Detect hardware button presses for back navigation.

DatePickerAndroid

Opens the standard Android date picker dialog.

DrawerLayoutAndroid

Renders a DrawerLayout on Android.

PermissionsAndroid

Provides access to the permissions model introduced in Android M.

ProgressBarAndroid

Renders a ProgressBar on Android.

TimePickerAndroid

Opens the standard Android time picker dialog.

ToastAndroid

Create an Android Toast alert.

ToolbarAndroid

Renders a Toolbar on Android.

ViewPagerAndroid

Container that allows to flip left and right between child views.

Others

These components may come in handy for certain applications. For an exhaustive list of components and APIs, check out the sidebar to the left.

ActivityIndicator

Displays a circular loading indicator.

Alert

Launches an alert dialog with the specified title and message.

Animated

A library for creating fluid, powerful animations that are easy to build and maintain.

CameraRoll

Provides access to the local camera roll / gallery.

Clipboard

Provides an interface for setting and getting content from the clipboard on both iOS and Android.

Dimensions

Provides an interface for getting device dimensions.

KeyboardAvoidingView

Provides a view that moves out of the way of the virtual keyboard automatically.

Linking

Provides a general interface to interact with both incoming and outgoing app links.

Modal

Provides a simple way to present content above an enclosing view.

PixelRatio

Provides access to the device pixel density.

RefreshControl

This component is used inside a ScrollView to add pull to refresh functionality.

StatusBar

Component to control the app status bar.

WebView

A component that renders web content in a native view.