Replace direct access of NativeModules.UIManager with require('UIManager')

Summary:
public
Due to the cross-platform polyfills we have added (and will add in future) to `UIManager.js`, accessing UIManager directly via NativeModules instead of importing the wrapper is discouraged.

This diff fixes a few places where we were doing this inside our own modules.

Note: As a general policy, we should avoid accessing modules via NativeModules anyway. Using wrapper classes allows us to provide static declarations for all the native methods and properties, which can be checked at build time by flow. If we access the modules directly, those interfaces are only known at runtime.

Reviewed By: vjeux

Differential Revision: D2881300

fb-gh-sync-id: 6737358ea8ea6d722cc1941a4b9fa0123a87fc29
This commit is contained in:
Nick Lockwood 2016-01-30 07:35:36 -08:00 committed by facebook-github-bot-7
parent 1bc03871f3
commit 9d0242fdc3
4 changed files with 6 additions and 4 deletions

View File

@ -16,7 +16,7 @@
var NativeMethodsMixin = require('NativeMethodsMixin');
var PropTypes = require('ReactPropTypes');
var React = require('React');
var RCTDatePickerIOSConsts = require('NativeModules').UIManager.RCTDatePicker.Constants;
var RCTDatePickerIOSConsts = require('UIManager').RCTDatePicker.Constants;
var StyleSheet = require('StyleSheet');
var View = require('View');

View File

@ -17,8 +17,9 @@ var RCTDeviceEventEmitter = require('RCTDeviceEventEmitter');
var React = require('React');
var Subscribable = require('Subscribable');
var TextInputState = require('TextInputState');
var UIManager = require('UIManager');
var { UIManager, ScrollViewManager } = require('NativeModules');
var { ScrollViewManager } = require('NativeModules');
var invariant = require('invariant');
var warning = require('warning');

View File

@ -13,7 +13,8 @@
var React = require('React');
var StyleSheet = require('StyleSheet');
var { TestModule, UIManager } = require('NativeModules');
var { TestModule } = require('NativeModules');
var UIManager = require('UIManager');
var View = require('View');
var requireNativeComponent = require('requireNativeComponent');

View File

@ -302,7 +302,7 @@ Since all our native react views are subclasses of `UIView`, most style attribut
```javascript
// DatePickerIOS.ios.js
var RCTDatePickerIOSConsts = require('react-native').NativeModules.UIManager.RCTDatePicker.Constants;
var RCTDatePickerIOSConsts = require('react-native').UIManager.RCTDatePicker.Constants;
...
render: function() {
return (