question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Android refresh control scroll behavior interrupts horizontal scroll view

See original GitHub issue

On Android, when scrolling through horizontal ListView, if you scroll slightly up as well the RefreshControl starts to appear. This is undesirable and does not happen in iOS. When scrolling horizontal normally you cannot scroll up and down at the same time, one shouldn’t be able to activate the refresh control when scrolling horizontally.

To reproduce this behavior, start scrolling left/right then move your finger down as in a refresh. The refresh control will come down and interrupt your horizontal scroll.

Code sample:

'use strict';

var React = require('react-native');
var {
  AppRegistry,
  StyleSheet,
  Text,
  View,
  ListView,
  RefreshControl,
  ScrollView,
} = React;

var SampleApp = React.createClass({
  getInitialState: function() {
    return {
      dataSource: new ListView.DataSource({ rowHasChanged: (a, b) => a !== b })
    }
  },
  render: function() {
    return (
      <ListView
        dataSource={this.state.dataSource.cloneWithRows([1, 2, 3])}
        refreshControl={<RefreshControl refreshing={false}/>}
        renderHeader={() => (
          <ScrollView horizontal>
            <View style={[styles.box, { backgroundColor: 'red' }]}/>
            <View style={[styles.box, { backgroundColor: 'green' }]}/>
            <View style={[styles.box, { backgroundColor: 'blue' }]}/>
          </ScrollView>
        )}
        renderRow={row => <View><Text>{row}</Text></View>}
      />
    );
  }
});

var styles = StyleSheet.create({
  box: {
    width: 200,
    height: 200,
  }
});

AppRegistry.registerComponent('SampleApp', () => SampleApp);

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Reactions:10
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

6reactions
Kowaiocommented, Jan 25, 2017

Bringing this up again after encountering the problem. Current version used is RN 0.39. Thanks!

0reactions
superandrew213commented, Mar 22, 2018

@calebmer did you come up with a workaround for this?

Read more comments on GitHub >

github_iconTop Results From Across the Web

HorizontalScrollView - Android Developers
HorizontalScrollView only supports horizontal scrolling. ... Caching behavior of children may be controlled through View#setLayerType(int, Paint) .
Read more >
HorizontalScrollView inside ListView: minor vertical scroll ...
The problem is that ListView (or rather its parent AbsListView ) implements onInterceptTouchEvent and hence ListView can intercept all touch ...
Read more >
Well-controlled scrolling with CSS Scroll Snap - web.dev
The CSS Scroll Snap feature allows web developers to create well-controlled scroll experiences by declaring scroll snapping positions.
Read more >
Titanium.UI.ScrollView
On Android, a scroll view can only scroll in one direction, either vertically or horizontally, and not both at the same time. The...
Read more >
Take control of your scroll - customizing pull-to-refresh and ...
Turns out this behavior is called scroll chaining; the browser's default behavior when scrolling content. Oftentimes the default is pretty nice, ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found