Inherits from NSObject
Conforms to RCTBridgeModule
Declared in RCTViewManager.h

Tasks

  •   bridge

    The bridge can be used to access both the RCTUIIManager and the RCTEventDispatcher, allowing the manager (or the views that it manages) to manipulate the view hierarchy and send events back to the JS context.

    property
  • – view

    This method instantiates a native view to be managed by the module. Override this to return a custom view instance, which may be preconfigured with default properties, subviews, etc. This method will be called many times, and should return a fresh instance each time. The view module MUST NOT cache the returned view and return the same instance for subsequent calls.

  • – shadowView

    This method instantiates a shadow view to be managed by the module. If omitted, an ordinary RCTShadowView instance will be created, which is typically fine for most view types. As with the view method, the -shadowView method should return a fresh instance each time it is called.

  • – customBubblingEventTypes

    Returns a dictionary of config data passed to JS that defines eligible events that can be placed on native views. This should return bubbling directly-dispatched event types and specify what names should be used to subscribe to either form (bubbling/capturing).

  • – customDirectEventTypes

    Returns a dictionary of config data passed to JS that defines eligible events that can be placed on native views. This should return non-bubbling directly-dispatched event types.

  • – uiBlockToAmendWithShadowView:

    Called to notify manager that layout has finished, in case any calculated properties need to be copied over from shadow view to view.

  • – uiBlockToAmendWithShadowViewRegistry:

    Called after view hierarchy manipulation has finished, and all shadow props have been set, but before layout has been performed. Useful for performing custo layout logic or tasks that involve walking the view hierarchy. To be deprecated, hopefully.

  • + getPropConfigView_

    These macros can be used when you need to provide custom logic for setting view properties. The macro should be followed by a method body, which can refer to “json”, “view” and “defaultView” to implement the required logic.

  • – set_

    Used for when view property names change. Will log an error when used.

Properties

bridge

@property (nonatomic, weak) RCTBridge *bridge
Discussion

The bridge can be used to access both the RCTUIIManager and the RCTEventDispatcher, allowing the manager (or the views that it manages) to manipulate the view hierarchy and send events back to the JS context.

Declared In

RCTViewManager.h

Class Methods

getPropConfigView_

+ (NSString *)getPropConfigView_
Discussion

These macros can be used when you need to provide custom logic for setting view properties. The macro should be followed by a method body, which can refer to “json”, “view” and “defaultView” to implement the required logic.

Declared In

RCTViewManager.h

Instance Methods

customBubblingEventTypes

- (NSDictionary *)customBubblingEventTypes
Discussion

Returns a dictionary of config data passed to JS that defines eligible events that can be placed on native views. This should return bubbling directly-dispatched event types and specify what names should be used to subscribe to either form (bubbling/capturing).

Returned dictionary should be of the form: @{ @“onTwirl”: { @“phasedRegistrationNames”: @{ @“bubbled”: @“onTwirl”, @“captured”: @“onTwirlCaptured” } } }

Note that this method is not inherited when you subclass a view module, and you should not call [super customBubblingEventTypes] when overriding it.

Declared In

RCTViewManager.h

customDirectEventTypes

- (NSDictionary *)customDirectEventTypes
Discussion

Returns a dictionary of config data passed to JS that defines eligible events that can be placed on native views. This should return non-bubbling directly-dispatched event types.

Returned dictionary should be of the form: @{ @“onTwirl”: { @“registrationName”: @“onTwirl” } }

Note that this method is not inherited when you subclass a view module, and you should not call [super customDirectEventTypes] when overriding it.

Declared In

RCTViewManager.h

set_

- (void)set_
Discussion

Used for when view property names change. Will log an error when used.

Declared In

RCTViewManager.h

shadowView

- (RCTShadowView *)shadowView
Discussion

This method instantiates a shadow view to be managed by the module. If omitted, an ordinary RCTShadowView instance will be created, which is typically fine for most view types. As with the view method, the -shadowView method should return a fresh instance each time it is called.

Declared In

RCTViewManager.h

uiBlockToAmendWithShadowView:

- (RCTViewManagerUIBlock)uiBlockToAmendWithShadowView:(RCTShadowView *)shadowView
Discussion

Called to notify manager that layout has finished, in case any calculated properties need to be copied over from shadow view to view.

Declared In

RCTViewManager.h

uiBlockToAmendWithShadowViewRegistry:

- (RCTViewManagerUIBlock)uiBlockToAmendWithShadowViewRegistry:(RCTSparseArray *)shadowViewRegistry
Discussion

Called after view hierarchy manipulation has finished, and all shadow props have been set, but before layout has been performed. Useful for performing custo layout logic or tasks that involve walking the view hierarchy. To be deprecated, hopefully.

Declared In

RCTViewManager.h

view

- (UIView *)view
Discussion

This method instantiates a native view to be managed by the module. Override this to return a custom view instance, which may be preconfigured with default properties, subviews, etc. This method will be called many times, and should return a fresh instance each time. The view module MUST NOT cache the returned view and return the same instance for subsequent calls.

Declared In

RCTViewManager.h