mirror of
https://github.com/zhigang1992/react-native.git
synced 2026-04-29 12:45:37 +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
@@ -6,10 +6,11 @@
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
var Platform = require('Platform');
|
||||
var NativeMethodsMixin = require('NativeMethodsMixin');
|
||||
var Platform = require('Platform');
|
||||
var React = require('React');
|
||||
var StyleSheet = require('StyleSheet');
|
||||
var View = require('View');
|
||||
|
||||
var requireNativeComponent = require('requireNativeComponent');
|
||||
|
||||
@@ -23,6 +24,7 @@ type DefaultProps = {
|
||||
*/
|
||||
var Switch = React.createClass({
|
||||
propTypes: {
|
||||
...View.propTypes,
|
||||
/**
|
||||
* The value of the switch. If true the switch will be turned on.
|
||||
* Default value is false.
|
||||
@@ -115,7 +117,7 @@ var styles = StyleSheet.create({
|
||||
});
|
||||
|
||||
if (Platform.OS === 'android') {
|
||||
var RCTSwitch = requireNativeComponent('AndroidSwitch', null, {
|
||||
var RCTSwitch = requireNativeComponent('AndroidSwitch', Switch, {
|
||||
nativeOnly: { onChange: true, on: true, enabled: true }
|
||||
});
|
||||
} else {
|
||||
|
||||
Reference in New Issue
Block a user