react-native/React/Views
Nick Lockwood 848839858b Added mechanism for directly mapping JS event handlers to blocks
Summary:
Currently, the system for mapping JS event handlers to blocks is quite clean on the JS side, but is clunky on the native side. The event property is passed as a boolean, which can then be checked by the native side, and if true, the native side is supposed to send an event via the event dispatcher.

This diff adds the facility to declare the property as a block instead. This means that the event side can simply call the block, and it will automatically send the event. Because the blocks for bubbling and direct events are named differently, we can also use this to generate the event registration data and get rid of the arrays of event names.

The name of the event is inferred from the property name, which means that the property for an event called "load" must be called `onLoad` or the mapping won't work. This can be optionally remapped to a different property name on the view itself if necessary, e.g.

  RCT_REMAP_VIEW_PROPERTY(onLoad, loadEventBlock, RCTDirectEventBlock)

If you don't want to use this mechanism then for now it is still possible to declare the property as a BOOL instead and use the old mechanism (this approach is now deprecated however, and may eventually be removed altogether).
2015-09-02 06:11:24 -08:00
..
RCTActivityIndicatorViewManager.h Improved RCTActivityIndicatorView and fixed some flow errors 2015-04-26 02:17:13 -08:00
RCTActivityIndicatorViewManager.m Convert alloc/init to new to please linter 2015-08-17 08:46:00 -07:00
RCTAnimationType.h [LayoutAnimation] RCTAnimationTypeKeyboard 2015-06-25 09:17:01 -08:00
RCTAutoInsetsProtocol.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTBorderDrawing.h Implemented fast path for same borders/radii 2015-05-28 09:16:44 -08:00
RCTBorderDrawing.m Implemented fast path for same borders/radii 2015-05-28 09:16:44 -08:00
RCTComponent.h Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTComponentData.h [rn] Pass props when creating a view in RCTViewManager 2015-08-25 08:08:17 -08:00
RCTComponentData.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTConvert+CoreLocation.h [MapView] Support for annotation callouts, annotation press, callout presses and pin animation 2015-06-25 09:15:21 -08:00
RCTConvert+CoreLocation.m [MapView] Support for annotation callouts, annotation press, callout presses and pin animation 2015-06-25 09:15:21 -08:00
RCTConvert+MapKit.h [MapView] Support for annotation callouts, annotation press, callout presses and pin animation 2015-06-25 09:15:21 -08:00
RCTConvert+MapKit.m Convert alloc/init to new to please linter 2015-08-17 08:46:00 -07:00
RCTDatePicker.h Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTDatePicker.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTDatePickerManager.h Removed deprecated RCT_EXPORT + code paths 2015-06-05 09:58:25 -08:00
RCTDatePickerManager.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTMap.h Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTMap.m Convert alloc/init to new to please linter 2015-08-17 08:46:00 -07:00
RCTMapManager.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTMapManager.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTModalHostView.h Enable transparent modal presentation with <Modal /> 2015-08-14 04:47:12 -08:00
RCTModalHostView.m Ran Convert > To Modern Objective C Syntax 2015-08-25 01:08:49 -08:00
RCTModalHostViewController.h Add <Modal /> component 2015-07-28 07:21:50 -08:00
RCTModalHostViewController.m Add <Modal /> component 2015-07-28 07:21:50 -08:00
RCTModalHostViewManager.h Enable transparent modal presentation with <Modal /> 2015-08-14 04:47:12 -08:00
RCTModalHostViewManager.m Enable transparent modal presentation with <Modal /> 2015-08-14 04:47:12 -08:00
RCTNavItem.h Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTNavItem.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTNavItemManager.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTNavItemManager.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTNavigator.h Remove isValid from RCTInvalidating 2015-08-14 01:57:18 -08:00
RCTNavigator.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTNavigatorManager.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTNavigatorManager.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTPicker.h Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTPicker.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTPickerManager.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTPickerManager.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTPointerEvents.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTProgressViewManager.h Added ProgressViewIOS 2015-06-03 09:49:35 -08:00
RCTProgressViewManager.m Convert alloc/init to new to please linter 2015-08-17 08:46:00 -07:00
RCTScrollView.h [ReactNative] Implement proper event coalescing 2015-05-27 20:41:20 -08:00
RCTScrollView.m Ran Convert > To Modern Objective C Syntax 2015-08-25 01:08:49 -08:00
RCTScrollViewManager.h Removed deprecated RCT_EXPORT + code paths 2015-06-05 09:58:25 -08:00
RCTScrollViewManager.m Ran Convert > To Modern Objective C Syntax 2015-08-25 01:08:49 -08:00
RCTScrollableProtocol.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTSegmentedControl.h Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTSegmentedControl.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTSegmentedControlManager.h Add SegmentedControlIOS 2015-04-29 08:08:45 -08:00
RCTSegmentedControlManager.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTShadowView.h Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTShadowView.m Ran Convert > To Modern Objective C Syntax 2015-08-25 01:08:49 -08:00
RCTSlider.h Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTSlider.m [SliderIOS] Apply value after minimum/maximumValue in order to ensure it is properly set 2015-04-21 11:09:10 -08:00
RCTSliderManager.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTSliderManager.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTSwitch.h Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTSwitch.m [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTSwitchManager.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTSwitchManager.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTTabBar.h Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTTabBar.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTTabBarItem.h Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTTabBarItem.m Ran Convert > To Modern Objective C Syntax 2015-08-25 01:08:49 -08:00
RCTTabBarItemManager.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTTabBarItemManager.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTTabBarManager.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTTabBarManager.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTTextDecorationLineType.h <Text> module add textDecoration style attributes 2015-07-07 06:15:20 -08:00
RCTView.h Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTView.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTViewControllerProtocol.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTViewManager.h Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTViewManager.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTWebView.h Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTWebView.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTWebViewManager.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTWebViewManager.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTWrapperViewController.h Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
RCTWrapperViewController.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00
UIView+Private.h Perform clip update on RCTScrollView in increments of 50 pt 2015-08-13 07:56:41 -08:00
UIView+React.h Refactor RCTUIManager 2015-08-06 15:49:35 -08:00
UIView+React.m Added mechanism for directly mapping JS event handlers to blocks 2015-09-02 06:11:24 -08:00