I'm relatively new here, I was wondering if I can know when the user is scrolling to either right or left using ScrollView from react-native
As far as I know the method onScroll
doesn't know where is the user scrolling to
I'm relatively new here, I was wondering if I can know when the user is scrolling to either right or left using ScrollView from react-native
As far as I know the method onScroll
doesn't know where is the user scrolling to
Do check this out if you want to check left / right scroll :
<ScrollView
horizontal={true}
onScroll={(event) =>{
var currentOffset = event.nativeEvent.contentOffset.x;
var direction = currentOffset > this.offset ? 'left' : 'right';
alert(direction);
}}
>
<Text style={{height:50}}>wiw</Text>
<Text style={{height:50}}>wiw</Text>
<Text style={{height:50}}>wiw</Text>
<Text style={{height:50}}>wiw</Text>
<Text style={{height:50}}>wiw</Text>
<Text style={{height:50}}>wiw</Text>
<Text style={{height:50}}>wiw</Text>
<Text style={{height:50}}>wiw</Text>
<Text style={{height:50}}>wiw</Text>
<Text style={{height:50}}>wiw</Text>
<Text style={{height:50}}>wiw</Text>
</ScrollView>
Hope it helps .fee lfree for doubts