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:
parent
1bc03871f3
commit
9d0242fdc3
|
@ -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');
|
||||
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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');
|
||||
|
|
|
@ -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 (
|
||||
|
|
Loading…
Reference in New Issue