mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
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:
committed by
facebook-github-bot-7
parent
1bc03871f3
commit
9d0242fdc3
@@ -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 (
|
||||
|
||||
Reference in New Issue
Block a user