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

Keyboard getting opened On slider touch

Open YashM20 opened this issue 11 months ago • 2 comments

import { StyleSheet, Text, View, TextInput } from 'react-native'
import React from 'react'
import { useSharedValue } from 'react-native-reanimated';
import { Slider } from 'react-native-awesome-slider';

const AnimatedSlider = () => {
  const progress = useSharedValue(30);
  const min = useSharedValue(0);
  const max = useSharedValue(100);
  return (
    <>
      <Slider
        style={styles.container}
        progress={progress}
        minimumValue={min}
        maximumValue={max}
        cache={true}
        heartbeat={true}
        hapticMode='step'
      />
    </>
  );
}

export default AnimatedSlider

const styles = StyleSheet.create({
  container: {
    flex: 1,
    minWidth: 300,
    backgroundColor: "skyblue"
  }
})

On opening the screen containing this slider, it automatically opens a keyboard, there is not text inputs present in entire screen. I tried to look into the package code I guess TextInput from packages's BubbleComponent is getting focused. Here's a code from your module.

<Animated.View
          style={{
            ...BUBBLE_STYLE,
            backgroundColor: color,
            maxWidth: bubbleMaxWidth,
          }}
        >
          <TextInput
            ref={textRef}
            textAlign="center"
            style={[styles.textStyle, { color: textColor }, textStyle]}
            defaultValue=""
            caretHidden
          />
        </Animated.View>

YashM20 avatar Mar 09 '24 13:03 YashM20

Hey, have you checked if it's related to enabling autoFocus on TextInput somewhere? Did you enable any default keyboard behavior somewhere? I assume that's it because this library does not rely on any keyboard events.

alantoa avatar May 08 '24 12:05 alantoa

You can try to patch the package and just add editable={false} prop. It should work perfect then.

Ibad9 avatar Jun 06 '24 11:06 Ibad9