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

react-native-slider-button

v0.1.1

Published

Slider button inspired by the slide to unlock widget with an optional animation manipulating the text's transparency. Of course, both the animation duration and text can be customized too.

Downloads

25

Readme

react-native-slider-button

Slider button inspired by the slide to unlock widget with an optional animation manipulating the text's transparency. Of course, both the animation duration and text can be customized too.

Demo

Slider button demo

A (hopefully simple enough) demo project is available too.

Add it to your project

Run npm install --save react-native-slider-button

var SliderButton = require("react-native-slider-button");

Basic usage

<SliderButton
	text={"Slide to start!"}
	textAnimated={true}
	minimumValue={0} maximumValue={100} value={0}
	minimumTrackTintColor={"rgba(0,0,0,0)"}
	maximumTrackTintColor={"rgba(0,0,0,0)"}
	onTrigger={this.onBurnOffStart}/>

Using a custom style

I strongly recommend creating a separate file holding the style definitions overwriting the following three definitons:

text describes the appearance of the text centered in the slider and supports all options of React Native's <Text> component. For instance, you can change the text colour and the font size, as shown below:

text:
{
	fontSize: 18,
	color: "#FFFFFF"
}

slider is responsible for customizing the slider. In the following example I am modifying the margin on the left and right side. Be cautios, that it is adviced to set flex to 1 too or to specify a custom width.

slider:
{
	flex: 1,
	marginLeft: 26,
	marginRight: 26
}

The slider's border can be adapted using by creating a custom object named sliderBorder, as shown below.

sliderBorder:
{
	borderWidth: 2,
	borderRadius: 20,
	borderColor: "#FFFFFF"
}

Please note that both slider as well as sliderBorder support all attributes of React Native's slider component. A complete example can be found in examples/SliderButtonStyle.js.

The custom style object can be applied to the component using the stylesheet property (see section Properties).

Properties

text (string) – The text to be displayed within the slider.

textAnimated (boolean) – Should the text change it's opacity from 1 to 0.5 and vice versa. The animation is endlessly repeated.

sliderCompletionValue (number) – Value the thumb needs to be moved beyond in order to trigger the event associated with the slider. For instance, if your minimum value is 0, your maximum value is 100 and this value is set to 89 the user has to move the thumb beyond 89 per cent of the slider's length.

onTrigger (function) – Callback invoked when the user moves the thumb beyond the completion value. No further parameters are passed to the callback method.

stylesheet (object) – Custom style for the slider button, as described in the custom style section.

resetAfterAction (boolean) – If this value is set to false the slider will remain in its position after the action is triggered. Otherwise, the slider will "jump" back to its initial value.

rightToLeft (boolean) (default: false) - This value allows to control the direction the user has to slide. In case it is set to true the user has to slide from 100 (right) to (100 - the value of sliderCompletionValue).

minimumValue (number) – The minimum allowed value (see React Native's documentation).

maximumValue (number) – The maximum allowed value (see React Native's documentation).

value (number) – The initial value (see React Native's documentation).

minimumTrackTintColor (string) – The track colour left to the thumb (see React Native's documentation).

maximumTrackTintColor (string) – The track colour right to the thumb (see React Native's documentation).

License

This project is MIT licensed. If there is a specific demand I am willing to change the license.