Giter VIP home page Giter VIP logo

react-native-motion-slider's Introduction

React Native Motion Slider

A JavaScript slider component for React Native (iOS and Android).
React Native Motion Slider is a high-quality slider with a stunning UI / UX.

demo

Installation

npm install --save react-native-motion-slider

Usage

import MotionSlider from 'react-native-motion-slider';
<View>
    <MotionSlider
    	title={'Choose the desired temperature'} 
        min={-20} 
        max={40}
        value={25.8} 
        decimalPlaces={1}
        units={'º'}
        backgroundColor={['rgb(3, 169, 244)', 'rgb(255, 152, 0)', 'rgb(255, 87, 34)']}
        onValueChanged={(value) => console.log(value)}
        onPressIn={() => console.log('Pressed in')}
        onPressOut={() => console.log('Pressed out')}
        onDrag={() => console.log('Dragging')}
    />
</View>

API

Properties

Property Description Type
width Slider width. number
height Slider height. number
borderRadius Slider border radius. number
backgroundColor String array containing the slider colors. By default it has only one element. [string]
decimalPlaces Decimal places to display on min, max and value elements. number
title Slider title. string
titleColor Slider title color. string
titleStyle Slider title custom style. StyleSheet
min Minimum value of the slider. number
max Maximum value of the slider. number
value Current slider value. number
units Value units (e.g. 'km'). string
minColor Color of min text element. string
maxColor Color of max text element. string
valueColor Color of value text element. string
valueBackgroundColor Color of value container's background color. By default this color inherits the slider's background color. string
fontSize Font size for min, max and value text elements. number
fontWeight Font weight for min, max and value text elements. string
fontFamily Font family for min, max and value text elements. string

Function Properties

Property Input Notes
onValueChanged Slider value Use this to update catch slider value on parent component
onPressIn
onPressOut
onDrag

Acknowledgement

  • Virgil Pana, who designed the concept and inspired me to create this component. I recommend checking his works.

License

MIT.

react-native-motion-slider's People

Contributors

vitorcodes avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

react-native-motion-slider's Issues

No interaction in iOS simulator

Hi,

I'm having an issue on the latest revisions of React Native via Expo (same behaviour happens when building the app),
The component renders fine on web, iOS, Android but the user can only interact with it on web.

Any idea on what might block here ?

<MotionSlider
      value={value}
      backgroundColor={['rgb(190,15,52)']}
      fontSize={17}
      min={range_start}
      max={range_end}
      onValueChanged={setValue}
/>

Toggle between single or multi slider mode?

Hey, just want to point out, fantastic work on the fluid UI. Looks super amazing. I just wanted to ask, do you have any plans to make this slider from single slider to multi slider with Two Thumbs? And then have a boolean toggle prop to let the user switch between both Slider Modes?

If yes, when can we possibly expect for it to be released for this library?

Changing Min, Max numbers depending on scale

<View>
          <MotionSlider
            title={'Choose the desired temperature'}
            min={57}
            max={99}
            value={80}
            decimalPlaces={1}
            units={'º'}
            backgroundColor={[
              'rgb(3, 169, 244)',
              'rgb(255, 152, 0)',
              'rgb(255, 87, 34)'
            ]}
            onValueChanged={value => console.log(value)}
            onPressIn={() => console.log('Pressed in')}
            onPressOut={() => console.log('Pressed out')}
            onDrag={() => console.log('Dragging')}
          />
        </View>

I dont understand why my app keeps breaking if the value i have set is between the Min/Max. Any idea of how to fix it?

I'm getting "Invariant violation: inputRange must be monotonically non-decreasing 57,33,99"

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.