Inherits from UIView
Declared in RCTRootView.h

Overview

Native view used to host React-managed views within the app. Can be used just like any ordinary UIView. You can have multiple RCTRootViews on screen at once, all controlled by the same JavaScript application.

Tasks

  • – initWithBridge:moduleName:
    • Designated initializer -
  • – initWithBundleURL:moduleName:launchOptions:
    • Convenience initializer - A bridge will be created internally. This initializer is intended to be used when the app has a single RCTRootView, otherwise create an RCTBridge and pass it in via initWithBridge:moduleName: to all the instances.
  •   moduleName

    The name of the JavaScript module to execute within the specified scriptURL (required). Setting this will not have any immediate effect, but it must be done prior to loading the script.

    property
  •   bridge

    The bridge used by the root view. Bridges can be shared between multiple root views, so you can use this property to initialize another RCTRootView.

    property
  •   initialProperties

    The default properties to apply to the view when the script bundle is first loaded. Defaults to nil/empty.

    property
  •   executorClass

    The class of the RCTJavaScriptExecutor to use with this view. If not specified, it will default to using RCTContextExecutor. Changes will take effect next time the bundle is reloaded.

    property
  •   backingViewController

    The backing view controller of the root view.

    property
  •   contentView

    The React-managed contents view of the root view.

    property
  •   loadingView

    A view to display while the JavaScript is loading, so users aren’t presented with a blank screen. By default this is nil, but you can override it with (for example) a UIActivityIndicatorView or a placeholder image.

    property
  •   loadingViewFadeDelay

    Timings for hiding the loading view after the content has loaded. Both of these values default to 0.25 seconds.

    property
  •   loadingViewFadeDuration property

Properties

backingViewController

@property (nonatomic, weak) UIViewController *backingViewController
Discussion

The backing view controller of the root view.

Declared In

RCTRootView.h

bridge

@property (nonatomic, strong, readonly) RCTBridge *bridge
Discussion

The bridge used by the root view. Bridges can be shared between multiple root views, so you can use this property to initialize another RCTRootView.

Declared In

RCTRootView.h

contentView

@property (nonatomic, strong, readonly) UIView *contentView
Discussion

The React-managed contents view of the root view.

Declared In

RCTRootView.h

executorClass

@property (nonatomic, strong) Class executorClass
Discussion

The class of the RCTJavaScriptExecutor to use with this view. If not specified, it will default to using RCTContextExecutor. Changes will take effect next time the bundle is reloaded.

Declared In

RCTRootView.h

initialProperties

@property (nonatomic, copy) NSDictionary *initialProperties
Discussion

The default properties to apply to the view when the script bundle is first loaded. Defaults to nil/empty.

Declared In

RCTRootView.h

loadingView

@property (nonatomic, strong) UIView *loadingView
Discussion

A view to display while the JavaScript is loading, so users aren’t presented with a blank screen. By default this is nil, but you can override it with (for example) a UIActivityIndicatorView or a placeholder image.

Declared In

RCTRootView.h

loadingViewFadeDelay

@property (nonatomic, assign) NSTimeInterval loadingViewFadeDelay
Discussion

Timings for hiding the loading view after the content has loaded. Both of these values default to 0.25 seconds.

Declared In

RCTRootView.h

loadingViewFadeDuration

@property (nonatomic, assign) NSTimeInterval loadingViewFadeDuration

moduleName

@property (nonatomic, copy, readonly) NSString *moduleName
Discussion

The name of the JavaScript module to execute within the specified scriptURL (required). Setting this will not have any immediate effect, but it must be done prior to loading the script.

Declared In

RCTRootView.h

Instance Methods

initWithBridge:moduleName:

- (instancetype)initWithBridge:(RCTBridge *)bridge moduleName:(NSString *)moduleName
Discussion
  • Designated initializer -

Declared In

RCTRootView.h

initWithBundleURL:moduleName:launchOptions:

- (instancetype)initWithBundleURL:(NSURL *)bundleURL moduleName:(NSString *)moduleName launchOptions:(NSDictionary *)launchOptions
Discussion
  • Convenience initializer - A bridge will be created internally. This initializer is intended to be used when the app has a single RCTRootView, otherwise create an RCTBridge and pass it in via initWithBridge:moduleName: to all the instances.

Declared In

RCTRootView.h