I'm trying to get ScrollView to Scroll horizontally only when sliding a particular view something like this:
<ScrollView horizontal={true}>
<View style={styles.TopView}></View>
<View style={styles.BottomView} Scrollable={false}></View>
</ScrollView>
I was thinking of disabling the scroll OnPressIn using hooks like this:
const [Scrollmove, setScrollmove] = useState(true);
<ScrollView horizontal={true} scrollEnabled ={Scrollmove}>
<View style={styles.TopView}></View>
<Pressable
onPressIn={()=>{setScrollmove(false)}}
onPressOut={()=>{setScrollmove(true)}}>
<View style={styles.BottomView}></View>
</Pressable>
</ScrollView>
but I don't know if it would work and is there a better way to achieve the desired effect?
Note: the code segments I've written above are pseudo code
You can't do that. However, you can change your design like, divide your screen and half of it can be scroll, other half can stay.
<View style={styles.TopView}>
<Text>Stay</Text>
</View>
<ScrollView horizontal={true}>
<View style={styles.BottomView} Scrollable={false}>
<Text>Scrollable</Text>
</View>
</ScrollView>