2015-07-21 14:10:59 +02:00
2015-07-21 14:10:46 +02:00
2015-07-21 14:10:59 +02:00
2015-07-21 12:33:59 +02:00
2015-07-21 12:33:59 +02:00
2015-07-21 12:33:59 +02:00
2015-07-21 12:44:24 +02:00
2015-07-21 14:10:59 +02:00
2015-07-21 12:33:59 +02:00

react-native-slider

npm version npm version Issue Stats Issue Stats

A pure JavaScript <Slider> component for react-native. This is still very much a work in progress, ideas and contributions are very welcome.

Demo

Install

npm i --save react-native-slider

Usage

'use strict';

var React = require('react-native');
var Slider = require('react-native-slider');
var {
  AppRegistry,
  StyleSheet,
  View,
  Text,
} = React;

var SliderExample = React.createClass({
  getInitialState() {
    return {
      value: 0.2,
    };
  },

  render() {
    return (
      <View style={styles.container}>
        <Slider
          value={this.state.value}
          onValueChange={(value) => this.setState({value})} />
        <Text>Value: {this.state.value}</Text>
      </View>
    );
  }
});

var styles = StyleSheet.create({
  container: {
    flex: 1,
    marginLeft: 10,
    marginRight: 10,
    alignItems: 'stretch',
    justifyContent: 'center',
  },
});

AppRegistry.registerComponent('SliderExample', () => SliderExample);

Props

Prop Type Optional Default Description
value number Yes 0 Initial value of the slider
minimumValue number Yes 0 Initial minimum value of the slider
maximumValue number Yes 1 Initial maximum value of the slider
minimumTrackTintColor string Yes '#3f3f3f' The color used for the track to the left of the button
maximumTrackTintColor string Yes '#b3b3b3' The color used for the track to the right of the button
thumbTintColor string Yes '#343434' The color used for the thumb
onValueChange function Yes Callback continuously called while the user is dragging the slider
onSlidingComplete function Yes Callback called when the user finishes changing the value (e.g. when the slider is released)

MIT Licensed

Description
No description provided
Readme MIT 1.1 MiB
Languages
JavaScript 74%
Objective-C 16.6%
Starlark 5%
Java 4.4%