Socket
Socket
Sign inDemoInstall

@jesster2k10/react-native-range-slider

Package Overview
Dependencies
0
Maintainers
1
Versions
7
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @jesster2k10/react-native-range-slider

React native cross platform range slider


Version published
Weekly downloads
383
decreased by-27.19%
Maintainers
1
Created
Weekly downloads
 

Readme

Source

React Native Range Slider

A high-quality, cross platform, native iOS range slider for react native. A slider, similar in style to UISlider, but which allows you to pick a minimum and maximum range; inspired by react-native-range-slider

Features

  • iOS Support
  • Android Support
  • Native Code
  • Customizable

IOS Example

IOS Demo

Android Example

IOS Demo

Installation

Install the library using either yarn or npm like so:

yarn add @jesster2k10/react-native-range-slider
npm install --save @jesster2k10/react-native-range-slider

IOS Installation

If you're using React Native versions > 60.0, it's relatively straightforward.

cd ios && pod install

For versions below 0.60.0, use rnpm links

  • Run react-native link @jesster2k10/react-native-range-slider
  • If linking fails, follow the manual linking steps

Android Installation

For versions below 0.60.0, follow the linking instructions above. There are additional steps required to get started with android.

Step One

Modify your settings.gradle to include the following

include ':rangeseekbar'
project(':rangeseekbar').projectDir = new File('../../node_modules/@jesster2k10/react-native-range-seekbar/crystalrangeseekbar')

Step Two

Modify and your application build.gradle to include:

buildscript {
  dependencies {
    classpath 'com.github.dcendents:android-maven-gradle-plugin:1.5'
    classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
  }
}

### Step Three

Modify your AndroidManifest.xml and set android:allowBackup="true", see below for example:

<manifest xmlns:android="http://schemas.android.com/apk/res/android"
  xmlns:tools="http://schemas.android.com/tools"
  package="com.ReactNativeRangeSliderExample">

    <uses-permission android:name="android.permission.INTERNET" />

    <application
      android:name=".MainApplication"
      android:label="@string/app_name"
      android:icon="@mipmap/ic_launcher"
      android:roundIcon="@mipmap/ic_launcher_round"
      android:allowBackup="true"
      android:theme="@style/AppTheme">
      <activity
        android:name=".MainActivity"
        android:label="@string/app_name"
        android:configChanges="keyboard|keyboardHidden|orientation|screenSize"
        android:windowSoftInputMode="adjustResize">
        <intent-filter>
            <action android:name="android.intent.action.MAIN" />
            <category android:name="android.intent.category.LAUNCHER" />
        </intent-filter>
      </activity>
      <activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
    </application>

</manifest>

Usage

Basic Usage

You can check out the examples for more usage.

import RangeSlider from '@jesster2k10/react-native-range-slider';

// ...

<RangeSlider
  min={0}
  max={100}
  onChange={(min, max) => console.log(min, max)}
/>;

## Props

Props Explanation

Common Props

propertytypedescriptionrequired
minnumberthe minimum value for the sliderTRUE
maxnumberthe maximum value for the sliderTRUE
onChange(min: number, max: number) => voida callback that will be called with slider data once the values changeFALSE
tintColorstringtint color for the slider track & handles (ios only, use handleColor on android)FALSE
tintColorBetweenHandlesstringtint color for the active part of the slider trackFALSE
stepnumberthe step for the sliderFALSE
handleColorstringthe color for both left and right handlersFALSE
styleobjecta custom style object for the sliderFALSE
prefixstringthe prefix for the min and max values
suffixstringthe suffix for the min and max values

IOS Only Props

propertytypedescriptionrequired
typesliderrangethe type of slider
selectedMaximumnumberthe selected maximum value, it shouldn't be less than maxFALSE
selectedMinimumnumberthe selected minimum value, it shouldn't be less than minFALSE
handleBorderColorstringthe color for the slider handle borderFALSE
handleWidthnumberthe size of the handleFALSE
minLabelColorstringthe color of the minimum (left hand) labelFALSE
maxLabelColorstringthe color of the maximum (right hand) labelFALSE
handleDiameternumberthe diameter of the handleFALSE
lineHeightnumberthe height of the slider trackFALSE
hideLabelsbooleancontrols whether the min and max labels are visibleFALSE
minLabelFontstringthe font family name of the min (left hand) labelFALSE
minLabelFontSizenumberthe font size of the min (left hand) labelFALSE
maxLabelFontstringthe font family name of the max (right hand) labelFALSE
maxLabelFontSizenumberthe font size of the max (right hand) labelFALSE
labelPaddingnumberextra padding for the min & max labelsFALSE
maxDistancenumberthe maximum distance between handlesFALSE
minDistancenumberthe minimum distance between handlesFALSE
lineBorderWidthnumberthe border width of the slider trackFALSE
lineBorderColorstringthe border color of the slider trackFALSE

Android Only Props

propertytypedescriptionrequired
leftHandleColorstringthe color of the left handleFALSE
leftHandlePressedColorstringthe color of the left (min) handle when touchedFALSE
rightHandleColorstringthe color of the right (max) handleFALSE
rightHandlePressedColorstringthe color of the right (max) handle when touchedFALSE
handlePressedColorstringthe color of the handle when touchedFALSE
minStartValuenumber-FALSE
maxStartValuenumber-FALSE
fixGapnumbera fixed gap between the handlesFALSE
corderRadiusnumberthe corder radius of the slider trackFALSE
Please note that on android, the tint color refers to the color of the empty track.

Acknowledgments

Roadmap

  • Improve android customization abilities (fonts, handle size)
  • Improve documentation
  • Unit tests
  • Flow support

Contribution

Please visit the CONTRIBUTING.md file.

License

MIT

Keywords

FAQs

Last updated on 24 Mar 2020

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc