2015-03-09 23:18:15 +00:00
|
|
|
/**
|
2015-03-23 22:07:33 +00:00
|
|
|
* Copyright (c) 2015-present, Facebook, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This source code is licensed under the BSD-style license found in the
|
|
|
|
* LICENSE file in the root directory of this source tree. An additional grant
|
|
|
|
* of patent rights can be found in the PATENTS file in the same directory.
|
|
|
|
*
|
|
|
|
* @flow
|
2015-03-09 23:18:15 +00:00
|
|
|
*/
|
|
|
|
'use strict';
|
|
|
|
|
|
|
|
var React = require('react-native');
|
|
|
|
var {
|
2015-03-18 22:57:49 +00:00
|
|
|
SliderIOS,
|
2015-03-09 23:18:15 +00:00
|
|
|
Text,
|
|
|
|
StyleSheet,
|
|
|
|
View,
|
|
|
|
} = React;
|
|
|
|
|
|
|
|
var SliderExample = React.createClass({
|
|
|
|
getInitialState() {
|
|
|
|
return {
|
|
|
|
value: 0,
|
|
|
|
};
|
|
|
|
},
|
|
|
|
|
|
|
|
render() {
|
|
|
|
return (
|
|
|
|
<View>
|
|
|
|
<Text style={styles.text} >
|
|
|
|
{this.state.value}
|
|
|
|
</Text>
|
2015-03-18 22:57:49 +00:00
|
|
|
<SliderIOS
|
2015-03-09 23:18:15 +00:00
|
|
|
style={styles.slider}
|
|
|
|
onValueChange={(value) => this.setState({value: value})} />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
}
|
|
|
|
});
|
|
|
|
|
|
|
|
var styles = StyleSheet.create({
|
|
|
|
slider: {
|
|
|
|
height: 10,
|
|
|
|
margin: 10,
|
|
|
|
},
|
|
|
|
text: {
|
|
|
|
fontSize: 14,
|
|
|
|
textAlign: 'center',
|
|
|
|
fontWeight: 'bold',
|
|
|
|
margin: 10,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2015-03-18 22:57:49 +00:00
|
|
|
exports.title = '<SliderIOS>';
|
2015-03-09 23:18:15 +00:00
|
|
|
exports.description = 'Slider input for numeric values';
|
|
|
|
exports.examples = [
|
|
|
|
{
|
2015-03-18 22:57:49 +00:00
|
|
|
title: 'SliderIOS',
|
2015-03-23 22:07:33 +00:00
|
|
|
render(): ReactElement { return <SliderExample />; }
|
2015-03-09 23:18:15 +00:00
|
|
|
}
|
|
|
|
];
|