AppRegistry is the JS entry point to running all React Native apps. App root components should register themselves with AppRegistry.registerComponent, then the native system can load the bundle for the app and run it when ready by invoking AppRegistry.runApplication.
Methods
registerComponent()
appKey: String name for the applicationcomponentProvider: Function that returns a React componentsection: Optional boolean to register as a section
- The
appKeythat was registered
runApplication()
appKey: The string name of the app to runappParameters: Object containing:initialProps: Props to pass to the root componentrootTag: The native root view tagfabric: Whether Fabric renderer is enabled
displayMode: Optional display mode configuration
unmountApplicationComponentAtRootTag()
runApplication.
Parameters:
rootTag: The root tag that was passed torunApplication
registerHeadlessTask()
taskKey: Unique string identifier for the tasktaskProvider: Function that returns an async task function
registerCancellableHeadlessTask()
taskKey: Unique string identifier for the tasktaskProvider: Function that returns an async task functiontaskCancelProvider: Function that returns a cancellation function
startHeadlessTask()
taskId: Numeric ID for this task instancetaskKey: The registered task keydata: Data to pass to the task
cancelHeadlessTask()
taskId: The task instance IDtaskKey: The registered task key
setSurfaceProps()
appKey: The registered app keyappParameters: New parameters/propsdisplayMode: Optional display mode
getAppKeys()
- Array of registered application keys
getRunnable()
appKey: The app key to look up
- The runnable function or undefined if not found
Typical Usage
In your app’s entry file (usuallyindex.js):