react-native-awesome-slider
react-native-awesome-slider copied to clipboard
Keyboard getting opened On slider touch
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>
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.
You can try to patch the package and just add editable={false} prop. It should work perfect then.