From c7d9d3bee5590337aae9ce66aeb976298012b12b Mon Sep 17 00:00:00 2001 From: James Ide Date: Tue, 24 Mar 2015 23:52:50 -0700 Subject: [PATCH] [Exports] Expose more modules for authors of custom components Added some more exports to React that are either necessary or often useful for component authors. I also exported React itself so that you can write just one destructuring assignment expression: ``` var { React, StyleSheet, View, } = require('react-native'); ``` --- Libraries/react-native/react-native.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/Libraries/react-native/react-native.js b/Libraries/react-native/react-native.js index 1aa978f46caab7..1a44d4cd25ef30 100644 --- a/Libraries/react-native/react-native.js +++ b/Libraries/react-native/react-native.js @@ -10,14 +10,18 @@ */ 'use strict'; +var React = require('React'); + // Export React, plus some native additions. // // The use of Object.create/assign is to work around a Flow bug (#6560135). // Once that is fixed, change this back to // -// var ReactNative = {...require('React'), /* additions */} +// var ReactNative = {...React, /* additions */} // -var ReactNative = Object.assign(Object.create(require('React')), { +var ReactNative = Object.assign(Object.create(React), { + React, + // Components ActivityIndicatorIOS: require('ActivityIndicatorIOS'), DatePickerIOS: require('DatePickerIOS'), @@ -29,6 +33,7 @@ var ReactNative = Object.assign(Object.create(require('React')), { Navigator: require('Navigator'), ScrollView: require('ScrollView'), SliderIOS: require('SliderIOS'), + StaticContainer: require('StaticContainer.react'), SwitchIOS: require('SwitchIOS'), TabBarIOS: require('TabBarIOS'), Text: require('Text'), @@ -60,10 +65,15 @@ var ReactNative = Object.assign(Object.create(require('React')), { DeviceEventEmitter: require('RCTDeviceEventEmitter'), NativeModules: require('NativeModules'), + // Prop Types + EdgeInsetsPropType: require('EdgeInsetsPropType'), + PointPropType: require('PointPropType'), + addons: { LinkedStateMixin: require('LinkedStateMixin'), Perf: undefined, PureRenderMixin: require('ReactComponentWithPureRenderMixin'), + StaticRenderer: require('StaticRenderer'), TestModule: require('NativeModules').TestModule, TestUtils: undefined, batchedUpdates: require('ReactUpdates').batchedUpdates,