react-native/React
Nick Lockwood 62177dbb3b Removed defaultViews
Summary:When a component prop is set to null/undefined, and doesn't have a default value specified in `getDefaultProps`, the null value is sent over the bridge as a sentinel to reset to the original native value.

On iOS this is handled by creating a default view instance for each view type. The default view is then used to look up the unmodified value for any prop that is reset.

This is rather expensive however, as it means that for complex views (e.g. WebView, MapView), a minimum of two instances will be created even if only one is needed, and the default view will remain even after all actual view instances have been released.

This diff replaces the default view mechanism with a system where the default value of each prop is recorded the first time it is set. This avoids the need to keep an extra copy of the whole view.

The only exception is for props that use the `RCT_CUSTOM_VIEW_PROPERTY` macro, which includes the default view as part of the interface. To avoid a breaking change, a default view will still be created for views that use this macro, but only if they are sent a null value (so very rarely, in practice). In a future update we may deprecate or replace `RCT_CUSTOM_VIEW_PROPERTY` if there are significant benefits to doing so.

Reviewed By: javache

Differential Revision: D3012115

fb-gh-sync-id: 259348e54aa8342f444ad182b6f883d2dd684973
shipit-source-id: 259348e54aa8342f444ad182b6f883d2dd684973
2016-03-09 08:56:46 -08:00
..
Base Initialize bridge on a background queue 2016-03-07 09:31:26 -08:00
Executors Fix JS deallocation on load errors 2016-03-07 09:46:36 -08:00
Layout updated css-layout and fixed callsites 2015-12-21 10:18:41 -08:00
Modules Fix potential unused variable error 2016-03-08 10:16:30 -08:00
Profiler fix RCTPerfMonitor display unit error 2016-02-26 04:54:32 -08:00
React.xcodeproj Fix OSS iOS build 2016-02-17 07:38:33 -08:00
Views Removed defaultViews 2016-03-09 08:56:46 -08:00