react-native/Examples/UIExplorer/SliderIOSExample.js

57 lines
948 B
JavaScript
Raw Normal View History

2015-03-09 14:42:55 -07:00
/**
* Copyright 2004-present Facebook. All Rights Reserved.
2015-03-23 11:36:57 -07:00
* @flow
2015-03-09 14:42:55 -07:00
*/
'use strict';
var React = require('react-native');
var {
SliderIOS,
2015-03-09 14:42:55 -07:00
Text,
StyleSheet,
View,
} = React;
var SliderExample = React.createClass({
getInitialState() {
return {
value: 0,
};
},
render() {
return (
<View>
<Text style={styles.text} >
{this.state.value}
</Text>
<SliderIOS
2015-03-09 14:42:55 -07: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,
},
});
exports.title = '<SliderIOS>';
2015-03-09 14:42:55 -07:00
exports.description = 'Slider input for numeric values';
exports.examples = [
{
title: 'SliderIOS',
2015-03-23 11:36:57 -07:00
render(): ReactElement { return <SliderExample />; }
2015-03-09 14:42:55 -07:00
}
];