react-native/React/Views
Spencer Ahrens 1ef4e00fba [ReactNative] Introduce onLayout events
Summary:
Simply add an `onLayout` callback to a native view component, and the callback
will be invoked with the current layout information when the view is mounted and
whenever the layout changes.

The only limitation is that scroll position and other stuff the layout system
isn't aware of is not taken into account.  This is because onLayout events
wouldn't be triggered for these changes and if they are desired they should be
tracked separately (e.g. with `onScroll`) and combined.

Also fixes some bugs with LayoutAnimation callbacks.

@public

Test Plan:
- Run new LayoutEventsExample in UIExplorer and see it work correctly.
- New integration test passes internally (IntegrationTest project seems busted).
- New jest test case passes.

{F22318433}

```
2015-05-06 15:45:05.848 [info][tid:com.facebook.React.JavaScript] "Running application "UIExplorerApp" with appParams: {"rootTag":1,"initialProps":{}}. __DEV__ === true, development-level warning are ON, performance optimizations are OFF"
2015-05-06 15:45:05.881 [info][tid:com.facebook.React.JavaScript] "received text layout event
", {"target":27,"layout":{"y":123,"x":12.5,"width":140.5,"height":18}}
2015-05-06 15:45:05.882 [info][tid:com.facebook.React.JavaScript] "received image layout event
", {"target":23,"layout":{"y":12.5,"x":122,"width":50,"height":50}}
2015-05-06 15:45:05.883 [info][tid:com.facebook.React.JavaScript] "received view layout event
", {"target":22,"layout":{"y":70.5,"x":20,"width":294,"height":204}}
2015-05-06 15:45:05.897 [info][tid:com.facebook.React.JavaScript] "received text layout event
", {"target":27,"layout":{"y":206.5,"x":12.5,"width":140.5,"height":18}}
2015-05-06 15:45:05.897 [info][tid:com.facebook.React.JavaScript] "received view layout event
", {"target":22,"layout":{"y":70.5,"x":20,"width":294,"height":287.5}}
2015-05-06 15:45:09.847 [info][tid:com.facebook.React.JavaScript] "layout animation done."
2015-05-06 15:45:09.847 [info][tid:com.facebook.React.JavaScript] "received image layout event
", {"target":23,"layout":{"y":12.5,"x":82,"width":50,"height":50}}
2015-05-06 15:45:09.848 [info][tid:com.facebook.React.JavaScript] "received view layout event
", {"target":22,"layout":{"y":110.5,"x":60,"width":214,"height":287.5}}
2015-05-06 15:45:09.862 [info][tid:com.facebook.React.JavaScript] "received text layout event
", {"target":27,"layout":{"y":206.5,"x":12.5,"width":120,"height":68}}
2015-05-06 15:45:09.863 [info][tid:com.facebook.React.JavaScript] "received image layout event
", {"target":23,"layout":{"y":12.5,"x":55,"width":50,"height":50}}
2015-05-06 15:45:09.863 [info][tid:com.facebook.React.JavaScript] "received view layout event
", {"target":22,"layout":{"y":128,"x":60,"width":160,"height":337.5}}
```
2015-05-07 12:27:44 -08:00
..
RCTActivityIndicatorViewManager.h Improved RCTActivityIndicatorView and fixed some flow errors 2015-04-26 02:17:13 -08:00
RCTActivityIndicatorViewManager.m Improved RCTActivityIndicatorView and fixed some flow errors 2015-04-26 02:17:13 -08:00
RCTAnimationType.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTAutoInsetsProtocol.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTConvert+CoreLocation.h MapView to support MKPointAnnotation using new attribute annotate in Map... 2015-04-14 18:03:37 -08:00
RCTConvert+CoreLocation.m MapView to support MKPointAnnotation using new attribute annotate in Map... 2015-04-14 18:03:37 -08:00
RCTConvert+MapKit.h MapView to support MKPointAnnotation using new attribute annotate in Map... 2015-04-14 18:03:37 -08:00
RCTConvert+MapKit.m MapView to support MKPointAnnotation using new attribute annotate in Map... 2015-04-14 18:03:37 -08:00
RCTDatePickerManager.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTDatePickerManager.m Added non-class-scanning-based approach fror registering js methods 2015-04-08 05:45:20 -08:00
RCTMap.h MapView to support MKPointAnnotation using new attribute annotate in Map... 2015-04-14 18:03:37 -08:00
RCTMap.m Fixed map annotation crash 2015-04-16 04:29:35 -08:00
RCTMapManager.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTMapManager.m [catlyst|madman] make map fire onRegionChange for user zoom in/out again 2015-04-21 10:32:44 -08:00
RCTNavItem.h [Nav] Add support for bar button icons and left buttons 2015-05-07 08:03:21 -08:00
RCTNavItem.m [Nav] Add support for bar button icons and left buttons 2015-05-07 08:03:21 -08:00
RCTNavItemManager.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTNavItemManager.m [Nav] Add support for bar button icons and left buttons 2015-05-07 08:03:21 -08:00
RCTNavigator.h [ReactNative] Use a single DisplayLink held by the bridge 2015-04-15 07:07:48 -08:00
RCTNavigator.m Update RCTNavigator.m 2015-05-05 08:32:14 -08:00
RCTNavigatorManager.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTNavigatorManager.m [ReactNative] Use a single DisplayLink held by the bridge 2015-04-15 07:07:48 -08:00
RCTPicker.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTPicker.m [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTPickerManager.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTPickerManager.m Added non-class-scanning-based approach fror registering js methods 2015-04-08 05:45:20 -08:00
RCTPointerEvents.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTScrollView.h Fixed broken listview header alignment 2015-05-06 10:48:24 -08:00
RCTScrollView.m Fixed broken listview header alignment 2015-05-06 10:48:24 -08:00
RCTScrollViewManager.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTScrollViewManager.m Fixed broken listview header alignment 2015-05-06 10:48:24 -08:00
RCTScrollableProtocol.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTSegmentedControl.h Add SegmentedControlIOS 2015-04-29 08:08:45 -08:00
RCTSegmentedControl.m Add SegmentedControlIOS 2015-04-29 08:08:45 -08:00
RCTSegmentedControlManager.h Add SegmentedControlIOS 2015-04-29 08:08:45 -08:00
RCTSegmentedControlManager.m Add SegmentedControlIOS 2015-04-29 08:08:45 -08:00
RCTShadowView.h [ReactNative] Introduce onLayout events 2015-05-07 12:27:44 -08:00
RCTShadowView.m [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTSlider.h [SliderIOS] Apply value after minimum/maximumValue in order to ensure it is properly set 2015-04-21 11:09:10 -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 Add minimumTrackTintColor and maximumTrackTintColor to SliderIOS 2015-04-23 05:57:15 -08:00
RCTSwitch.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42: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 [ReactNative] use requireNativeComponent to clean up a bunch of boilerplate 2015-04-21 21:06:48 -08:00
RCTTabBar.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTTabBar.m [React Native] Remove RKCustomTabBarController 2015-04-30 07:59:59 -08:00
RCTTabBarItem.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTTabBarItem.m MapView to support MKPointAnnotation using new attribute annotate in Map... 2015-04-14 18:03:37 -08:00
RCTTabBarItemManager.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTTabBarItemManager.m [ReactNative] use requireNativeComponent to clean up a bunch of boilerplate 2015-04-21 21:06:48 -08:00
RCTTabBarManager.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTTabBarManager.m [React Native] RCT_EXPORT lvl.2 2015-04-08 08:34:10 -08:00
RCTTextField.h Added placeholderTextColor property for TextInput class 2015-04-27 10:43:10 -08:00
RCTTextField.m Add support for multiline TextInput via UITextView 2015-04-29 01:33:58 -08:00
RCTTextFieldManager.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTTextFieldManager.m Added placeholderTextColor property for TextInput class 2015-04-27 10:43:10 -08:00
RCTView.h [React Native] Update RCTView border implementation 2015-04-27 04:10:43 -08:00
RCTView.m [React Native] Update RCTView border implementation 2015-04-27 04:10:43 -08:00
RCTViewControllerProtocol.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTViewManager.h Bump .buckversion to 6cdb82cb7493a86c39d0f0dc3c102d0f470f55de. 2015-04-23 08:24:08 -08:00
RCTViewManager.m [ReactNative] Introduce onLayout events 2015-05-07 12:27:44 -08:00
RCTViewNodeProtocol.h [react-native] Fix capitalization of "REact" 2015-04-27 13:52:57 -08:00
RCTWebView.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTWebView.m Adds `opaque` and `underlayColor` to WebView. 2015-04-20 18:11:37 -08:00
RCTWebViewManager.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTWebViewManager.m Adds `opaque` and `underlayColor` to WebView. 2015-04-20 18:11:37 -08:00
RCTWrapperViewController.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
RCTWrapperViewController.m [Nav] Add support for bar button icons and left buttons 2015-05-07 08:03:21 -08:00
UIView+React.h [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00
UIView+React.m [ReactNative] s/ReactKit/React/g 2015-03-26 02:42:24 -08:00