2015-03-09 23:18:15 +00:00
|
|
|
/**
|
2015-03-26 18:24:15 +00:00
|
|
|
* The examples provided by Facebook are for non-commercial testing and
|
|
|
|
* evaluation purposes only.
|
2015-03-23 22:07:33 +00:00
|
|
|
*
|
2015-03-26 18:24:15 +00:00
|
|
|
* Facebook reserves all rights not expressly granted.
|
|
|
|
*
|
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
|
|
|
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
|
|
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL
|
|
|
|
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
|
|
|
|
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
|
|
|
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
2015-03-23 22:07:33 +00:00
|
|
|
*
|
|
|
|
* @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',
|
2015-03-26 01:19:28 +00:00
|
|
|
fontWeight: '500',
|
2015-03-09 23:18:15 +00:00
|
|
|
margin: 10,
|
|
|
|
},
|
|
|
|
});
|
|
|
|
|
2015-03-18 22:57:49 +00:00
|
|
|
exports.title = '<SliderIOS>';
|
2015-03-25 17:16:19 +00:00
|
|
|
exports.displayName = 'SliderExample';
|
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
|
|
|
}
|
|
|
|
];
|