New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

react-native-awesome-slider

Package Overview
Dependencies
Maintainers
1
Versions
66
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-native-awesome-slider

Slider component written using Reanimated v2, high performance/fps, also be used for video/audio scrubber.

0.1.10
Source
npm
Version published
Weekly downloads
9.3K
-4.4%
Maintainers
1
Weekly downloads
 
Created
Source

react-native-awesome-slider

🚀 JSThread's to JSThread, UIThread’s to UIThread.

The best components in react-native now, Perfectly solved the performance/gusture problem of slider.

Install via npm:

npm i react-native-awesome-slider
or
yarn add react-native-awesome-slider

Why use this library?

  • Pure js slider generally use react-native's gueture/animtion, so when you pan sliding, may trigger the swiper to back event. ❌
  • Native slider generally use state update view, not efficient. ❌

So react-native-awesome-slider 100% use reanimated's ShareValue, is running UIThread, is efficient, and react-native-gusture-handle will block your other gesture, let you focus on swiping. ✨

Features

  • 100% Written in TypeScript.
  • 100% Written in react-native-reanimted and react-native-gusture-handle'.
  • Event support Tap & Pan triggering.
  • and more...

Usage

The <Slider/> component has the following properties:

NameTypeExplanationRequiredDefault Value
minimumTrackTintColorstringminimum track tint colorrgba(61, 219, 209, 1)
maximumTrackTintColorstringminimum track tint colortrack tint colorrgba(195, 197, 199, 1)
cacheTrackTintColorstringcache track tint colorrgba(39, 41, 46, 1)
styleViewStyle
borderColorstringColor of the border of the slider, also you can use containerStyle .transparent
bubble(number) => stringGet the current value of the slider as you slide it, and returns a string to be used inside the bubble.(number) => string
progressAnimated.SharedValueCurrent value of the slider0
cacheAnimated.SharedValueCache value of the slider0
minimumValueAnimated.SharedValueAn Animated.SharedValue from react-native-reanimated library which is the minimum value of the slider.undefined
maximumValueAnimated.SharedValueAn Animated.SharedValue from react-native-reanimated library which is the maximum value of the slider.undefined
onSlidingStart() => voidCallback called when the users starts slidingundefined
onValueChange(number) => voidCallback called when slide value changeundefined
onSlidingComplete(number) => voidCallback called when the users stops sliding. the new value will be passed as argumentundefined
renderBubble() => React.ReactNodeRender custom Bubble to show when sliding.See components
setBubbleText(string) => voidThis function will be called while sliding, and should set the text inside your custom bubble.current slider value
bubbleTranslateYnumberValue to pass to the container of the bubble as translateY7
renderThumbImage() => React.ReactNodeRender custom thumb image. if you need to customize thumb, you also need to set the thumb widthReactNode
thumbWidthnumberThumb elements width15
disableAnimated.SharedValueDisable sliderfalse
disableMinTrackTintColorstringDisable slider color, default is minimumTrackTintColorrgba(61, 219, 209, 1)
disableTapEventbooleanEnable tap event change value, default truetrue
bubbleMaxWidthnumberBubble elements max width100
bubbleTextStyleTextStyleBubble textstyle
bubbleContainerStyleViewStyleBubble containe textstyle
bubbleBackgroundColorstringBubble background colorrgba(61, 219, 209, 1)
isScrubbingAnimated.SharedValueBy this, you know the slider status as quickly as possible.(This is useful when you doing video-palyer’s scrubber.)undefined
onTap() => voidOn tap slider event.(This is useful when you doing video-palyer’s scrubber.)undefined
thumbScaleValueAnimated.SharedValueBy this, you can control thumb’s transform-scale animation.undefined
sliderHeightnumberSlider height30
containerStyleViewStyleSlider container style{ width: '100%', height: 5, borderRadius: 2, borderColor: borderColor, overflow: 'hidden', borderWidth: 1, backgroundColor: maximumTrackTintColor, },

Example Usage:

import { Slider } from 'react-native-awesome-slider';

export const Example = () => {
    const progress = useSharedValue(30);
    const min = useSharedValue(0);
    const max = useSharedValue(100);
    return (
        <Slider
            style={styles.container}
            progress={progress}
            minimumValue={min}
            maximumValue={max}
        />
    );
};

⚠ And more, Update soon...

Keywords

react-native

FAQs

Package last updated on 12 Jan 2022

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