npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@santhoshkumar13/react-native-super-slider

v1.0.3

Published

Slider

Downloads

9

Readme

Super Range Slider

The component is not re-rendered while user moves the thumb. Even if there is a label, only the label component is re-rendered when values are changed.

RangeSlider uses React Native's Animated library to transform thumbs / label / selected rail. These optimizations help to achieve as much native look & feel as possible using only the JS layer.

Version 1

The version 1 was using native Android and iOS views.

Installation

  • npm: npm install --save @santhoshkumar13/react-native-super-slider
  • yarn: yarn add @santhoshkumar13/react-native-super-slider

Usage

...

import RangeSlider from '@santhoshkumar13/react-native-super-slider';

...

const renderThumb = useCallback(() => <Thumb/>, []);
const renderRail = useCallback(() => <Rail/>, []);
const renderRailSelected = useCallback(() => <RailSelected/>, []);
const renderLabel = useCallback(value => <Label text={value}/>, []);
const renderNotch = useCallback(() => <Notch/>, []);
const handleValueChange = useCallback((low, high) => {
  setLow(low);
  setHigh(high);
}, []);

...

<Slider
  style={styles.slider}
  min={0}
  max={100}
  step={1}
  floatingLabel
  renderThumb={renderThumb}
  renderRail={renderRail}
  renderRailSelected={renderRailSelected}
  renderLabel={renderLabel}
  renderNotch={renderNotch}
  onValueChanged={handleValueChange}
/>

...

Properties

| Name | Description | Type | Default Value | | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------- | :-----------------------------------------------: | | min | Minimum value of slider | number | required | | max | Maximum value of slider | number | required | | minRange | Minimum range of thumbs allowed to be selected by the user.Note: it is still possible to set values closer to each other than minRange programmatically.If disableRange is set to true, maximum value allowed for user will be max - minRange. | number | 0 | | step | Step of slider | number | 1 | | low | Low value of slider | number | Initially min value will be set if not provided | | high | High value of slider | number | Initially max value will be set if not provided | | floatingLabel | If set to true, labels will not take space in component tree. Instead they will be rendered over the content above the slider (like a small popup). | boolean | false | | disableRange | Slider works as an ordinary slider with 1 control if true | boolean | false | | disabled | Any user interactions will be ignored if true | boolean | false | | allowLabelOverflow | If set to true, labels are allowed to be drawn outside of slider component's bounds.Otherwise label's edges will never get out of component's edges. | boolean | false | | renderThumb | Should render the thumb. The name is the name of the thumb. This may be helpful if there is a need to render different thumbs for high and low values. | (name: 'high' &#124; 'low') => Node | required | | renderRail | Should render the "rail" for thumbs.Rendered component should have flex: 1 style so it won't fill up the whole space. | () => Node | required | | renderRailSelected | Should render the selected part of "rail" for thumbs.Rendered component should not have flex: 1 style so it fills up the whole space. | () => Node | required | | renderLabel | Should render label above thumbs.If no function is passed, no label will be drawn. | (value: number) => Node | undefined | | renderNotch | Should render the notch below the label (above the thumbs).Classic notch is a small triangle below the label.If allowLabelOverflow is not set to true, the notch will continue moving with thumb even if the label has already reached the edge of the component and can't move further. | () => Node | undefined | | onValueChanged | Will be called when a value was changed.If disableRange is set to true, the second argument should be ignored.fromUser will be true if the value was changed by user's interaction. | (low: number, high: number, fromUser: boolean) => void | undefined | | onSliderTouchStart | Will be called when user starts interaction with slider.If disableRange is set to true, the second argument should be ignored. | (low: number, high: number) => void | undefined | | onSliderTouchEnd | Will be called when user ends interaction with slider.If disableRange is set to true, the second argument should be ignored. | (low: number, high: number) => void | undefined |

All the other props (e.g. style) will be passed to root container component.