callstack / react-native-slider

React Native component exposing Slider from iOS and SeekBar from Android
MIT License
1.2k stars 269 forks source link

Slider not working if it is in an absolute positioned container #619

Closed omerts closed 1 month ago

omerts commented 3 months ago

Environment

Description

When the slider is inside an container which has position: absolute; the slider is unresponsive.

Reproducible Demo

import React, {useState} from 'react'
import {View} from 'react-native'

import Slider from '@react-native-community/slider'

export const Test: React.FC = React.memo(() => {
  const [zoom, setZoom] = useState<number>(0)

  return (
    <View style={styles.container}>
      <Slider
        value={zoom}
        onValueChange={setZoom}
        step={0.1}
        minimumValue={-1}
        maximumValue={1}
      />
    </View>
  )
})

export const styles = StyleSheet.create({
  container: {
    position: 'absolute',
    top: 20,
    right: 20,
    flexDirection: 'row',
    gap: 26,
  }
})

export default CameraController
folin03 commented 2 months ago

+1 it is happening on Android only

I use Slider over VictoryChart from victory-native package and if at any point picker overlaps the VictoryChart, it stops responding to touch.

draggie commented 1 month ago

@omerts I was trying to reproduce this, however maybe you are missing some more context cause just putting the slider into absolutely positioned container does not cause issue you have described.

Please provide working reproduction example so I will be able to investigate that.