alantoa / react-native-awesome-slider

🚀 An anwesome <Slider/> that supports various features haptic, lottie, animation, ballon, etc.
MIT License
224 stars 28 forks source link

Keyboard getting opened On slider touch #67

Open YashM20 opened 3 months ago

YashM20 commented 3 months ago
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>
alantoa commented 1 month ago

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.

Ibad9 commented 1 week ago

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