Skip to content

Commit

Permalink
Replace deprecated platform-specific switches with Switch
Browse files Browse the repository at this point in the history
  • Loading branch information
cooperka committed Nov 8, 2016
1 parent da1da6c commit 5ab4217
Showing 1 changed file with 6 additions and 15 deletions.
21 changes: 6 additions & 15 deletions widgets/SwitchWidget.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@ var React = require('react');
var {
View,
Text,
SwitchIOS,
SwitchAndroid,
Switch,
Platform,
PixelRatio
} = require('react-native')
Expand All @@ -12,19 +11,11 @@ var WidgetMixin = require('../mixins/WidgetMixin.js');

var GiftedSwitch = React.createClass({
_getSwitch() {
if (Platform.OS === 'android') {
return (
<SwitchAndroid
{...this.props}
/>
);
} else {
return (
<SwitchIOS
{...this.props}
/>
);
}
return (
<Switch
{...this.props}
/>
);
},
render() {
return (
Expand Down

0 comments on commit 5ab4217

Please sign in to comment.