Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-native-slider

Package Overview
Dependencies
Maintainers
1
Versions
21
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-slider

A pure JavaScript <Slider /> component for react-native

  • 0.7.0
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
37K
decreased by-10.12%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-slider

npm version npm downloads npm licence Platform

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

It is a drop-in replacement for Slider.

Install

npm i --save react-native-slider

Note: For react-native < 0.25 use npm i --save "react-native-slider@<0.7"

Usage

'use strict';

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

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

PropTypeOptionalDefaultDescription
valuenumberYes0Initial value of the slider
disabledboolYesfalseIf true the user won't be able to move the slider
minimumValuenumberYes0Initial minimum value of the slider
maximumValuenumberYes1Initial maximum value of the slider
stepnumberYes0Step value of the slider. The value should be between 0 and maximumValue - minimumValue)
minimumTrackTintColorstringYes'#3f3f3f'The color used for the track to the left of the button
maximumTrackTintColorstringYes'#b3b3b3'The color used for the track to the right of the button
thumbTintColorstringYes'#343434'The color used for the thumb
thumbTouchSizeobjectYes{width: 40, height: 40}The size of the touch area that allows moving the thumb. The touch area has the same center as the visible thumb. This allows to have a visually small thumb while still allowing the user to move it easily.
onValueChangefunctionYesCallback continuously called while the user is dragging the slider
onSlidingStartfunctionYesCallback called when the user starts changing the value (e.g. when the slider is pressed)
onSlidingCompletefunctionYesCallback called when the user finishes changing the value (e.g. when the slider is released)
stylestyleYesThe style applied to the slider container
trackStylestyleYesThe style applied to the track
thumbStylestyleYesThe style applied to the thumb
debugTouchAreaboolYesfalseSet this to true to visually see the thumb touch rect in green.

MIT Licensed

Keywords

FAQs

Package last updated on 12 May 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc