React native scrollview disable pull to refresh

Alan Russo picture Alan Russo · Jul 31, 2017 · Viewed 13.6k times · Source

I'm using the scrollview of react native v0.44.2 and I wanted to disable the pull to refresh and only generate the scroll of my views, is there another way to do it without being with scrollview?
I saw some old version, I do not know if I put this animation recently. So my code is as follows:

render() {
    return (
      <View>
        <ScrollView>
          <View style={styles.box}>

          </View>
          <View style={styles.box}>

          </View>
          <View style={styles.box}>

          </View>
          <View style={styles.box}>

          </View>
          <View style={styles.box}>

          </View>
          <View style={styles.box}>

          </View>
        </ScrollView>

      </View>
    );
  }
}

and my styles:

const styles = StyleSheet.create({

  box: {
    backgroundColor: 'blue',
    height: 300,
    width: 200,
    borderWidth: 5,
    borderColor: 'red'
  }
});

Answer

Maybelle Pacate picture Maybelle Pacate · Sep 12, 2018

I've faced the same issue, and solved it by setting bounces property to false:

<ScrollView bounces={false} style={{ flex: 1 }}>
...
</ScrollView>

docs: https://facebook.github.io/react-native/docs/scrollview.html#bounces