react-native-slider icon indicating copy to clipboard operation
react-native-slider copied to clipboard

Rotate is not working

Open yesnoyes opened this issue 6 years ago • 7 comments

I am trying to rotate the Slider vertically but transform function is not working. Same code is working with Native Slider. Here is how I am doing it -

<Slider style={sliderStyles(width, height).slider} minimumValue={-1} maximumValue={1} value={0} minimumTrackTintColor={'yellow'} transform={[{rotate: '-90deg'}]} />

yesnoyes avatar May 23 '20 11:05 yesnoyes

Vertical slider created using transform does not work as expected

Link to the snack https://snack.expo.io/@yajana/slider

YajanaRao avatar Jun 18 '20 19:06 YajanaRao

I tried this way. This worked for me:

import React, { useEffect, useState } from 'react'
import Slider from '@react-native-community/slider'

const VerticalSlider = () => {
  const [style, setStyle] = useState({})
  useEffect(()=> {
    setStyle({transform: [{ rotate: '-90deg' }]})
  }, [1])

  return (
    <Slider
      minimumValue={0}
      maximumValue={1}
      minimumTrackTintColor="#FFFFFF"
      maximumTrackTintColor="#000000"
      style={[{ width: 300, height: 40 }, style]}
    />
  )
}

export default VerticalSlider

pankajgupta1 avatar Jun 25 '20 07:06 pankajgupta1

@pankajgupta1 I tried your solution in the snack https://snack.expo.io/@yajana/slider I am not able to get it working. VerticalSliderSolution is the component.

YajanaRao avatar Jun 25 '20 14:06 YajanaRao

@YajanaRao I tried this, But there is some error for android : View config not found for name RNCSlider

I think this is with expo. try to use this in real project on real device, May be there work. In my android code which is using in my project, this is working like a charm.

Here I saw in web too, in there I saw problem, there on vertically sliding that is not working, but when we horizontally slide this vertical slide working.

Give a try on real device, I think that will work. ON android , ios this is working good.

pankajgupta1 avatar Jun 26 '20 06:06 pankajgupta1

@YajanaRao Hey did u find any solution for it?? I need vertical slider with snap points but could not find it

mohity7777 avatar Dec 14 '20 11:12 mohity7777

@yesnoyes I've tested this on the latest release (v4.1.1) and this issue does not occur. Can you verify on your side using the latest release?

BartoszKlonowski avatar Aug 22 '21 22:08 BartoszKlonowski

Closing due to lack of author's feedback.

BartoszKlonowski avatar Sep 01 '21 10:09 BartoszKlonowski