mirror of
https://github.com/status-im/react-native.git
synced 2025-01-10 01:25:39 +00:00
8fb9cc8fc1
Summary: Partially fixes #3316 by addressing 16 linter warnings: - Strings should be singlequote - Missing semicolon Travis build jobs 1.1 through 1.4 complete successfully. 1.5 fails through what appears to be an unrelated issue on master. Closes https://github.com/facebook/react-native/pull/3332 Reviewed By: @svcscm Differential Revision: D2531718 Pulled By: @javache fb-gh-sync-id: ca22fbeac5fe3b4f725775a72f21b6dd7a75d94b
71 lines
2.2 KiB
JavaScript
71 lines
2.2 KiB
JavaScript
/**
|
|
* Copyright 2004-present Facebook. All Rights Reserved.
|
|
*/
|
|
'use strict';
|
|
|
|
var React = require('React');
|
|
|
|
var SwitchAndroid = require('SwitchAndroid');
|
|
var Text = require('Text');
|
|
var UIExplorerBlock = require('UIExplorerBlock');
|
|
var UIExplorerPage = require('UIExplorerPage');
|
|
|
|
var SwitchAndroidExample = React.createClass({
|
|
statics: {
|
|
title: '<SwitchAndroid>',
|
|
description: 'Standard Android two-state toggle component.'
|
|
},
|
|
|
|
getInitialState : function() {
|
|
return {
|
|
trueSwitchIsOn: true,
|
|
falseSwitchIsOn: false,
|
|
colorTrueSwitchIsOn: true,
|
|
colorFalseSwitchIsOn: false,
|
|
eventSwitchIsOn: false,
|
|
};
|
|
},
|
|
|
|
render: function() {
|
|
return (
|
|
<UIExplorerPage title="<SwitchAndroid>">
|
|
<UIExplorerBlock title="Switches can be set to true or false">
|
|
<SwitchAndroid
|
|
onValueChange={(value) => this.setState({falseSwitchIsOn: value})}
|
|
style={{marginBottom: 10}}
|
|
value={this.state.falseSwitchIsOn} />
|
|
<SwitchAndroid
|
|
onValueChange={(value) => this.setState({trueSwitchIsOn: value})}
|
|
value={this.state.trueSwitchIsOn} />
|
|
</UIExplorerBlock>
|
|
<UIExplorerBlock title="Switches can be disabled">
|
|
<SwitchAndroid
|
|
disabled={true}
|
|
style={{marginBottom: 10}}
|
|
value={true} />
|
|
<SwitchAndroid
|
|
disabled={true}
|
|
value={false} />
|
|
</UIExplorerBlock>
|
|
<UIExplorerBlock title="Change events can be detected">
|
|
<SwitchAndroid
|
|
onValueChange={(value) => this.setState({eventSwitchIsOn: value})}
|
|
style={{marginBottom: 10}}
|
|
value={this.state.eventSwitchIsOn} />
|
|
<SwitchAndroid
|
|
onValueChange={(value) => this.setState({eventSwitchIsOn: value})}
|
|
style={{marginBottom: 10}}
|
|
value={this.state.eventSwitchIsOn} />
|
|
<Text>{this.state.eventSwitchIsOn ? 'On' : 'Off'}</Text>
|
|
</UIExplorerBlock>
|
|
<UIExplorerBlock title="Switches are controlled components">
|
|
<SwitchAndroid />
|
|
<SwitchAndroid value={true} />
|
|
</UIExplorerBlock>
|
|
</UIExplorerPage>
|
|
);
|
|
}
|
|
});
|
|
|
|
module.exports = SwitchAndroidExample;
|