mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-24 04:16:00 +08:00
Use requireNativeComponent with propTypes for Android components.
Reviewed By: davidaurelio Differential Revision: D2663502 fb-gh-sync-id: 550e7b7c783ec0463a6beb052c09a768a8086056
This commit is contained in:
committed by
facebook-github-bot-4
parent
ca20d710fc
commit
e6093cff04
@@ -13,6 +13,7 @@
|
||||
var NativeMethodsMixin = require('NativeMethodsMixin');
|
||||
var PropTypes = require('ReactPropTypes');
|
||||
var React = require('React');
|
||||
var View = require('View');
|
||||
|
||||
var requireNativeComponent = require('requireNativeComponent');
|
||||
|
||||
@@ -25,6 +26,7 @@ var SwitchAndroid = React.createClass({
|
||||
mixins: [NativeMethodsMixin],
|
||||
|
||||
propTypes: {
|
||||
...View.propTypes,
|
||||
/**
|
||||
* Boolean value of the switch.
|
||||
*/
|
||||
@@ -79,6 +81,11 @@ var SwitchAndroid = React.createClass({
|
||||
}
|
||||
});
|
||||
|
||||
var RKSwitch = requireNativeComponent('AndroidSwitch', null);
|
||||
var RKSwitch = requireNativeComponent('AndroidSwitch', SwitchAndroid, {
|
||||
nativeOnly: {
|
||||
on: true,
|
||||
enabled: true,
|
||||
}
|
||||
});
|
||||
|
||||
module.exports = SwitchAndroid;
|
||||
|
||||
Reference in New Issue
Block a user