Skip to content

[ScrollView] Sticky Headers do not handle gestures properly #1482

@shayne

Description

@shayne

[RCTScrollView] Make ScrollView detect taps on sticky headers #1415 had an unintentional side affect that prevents gestures from being passed to the appropriate parents of a sticky headers.

Prior to #1415, the header would work as expected, but suffered from not being able to receive touches once docked.

Example:

A sticky header with a horizontal scroll view that contains TouchableHighlights. Note how you can still achieve a tap on the items in the scroll view but scrolling does not work.

  _renderSectionHeader() {
    var views = [];
    for (var i=0; i<10; ++i) {
      ((i) => {
        views.push(
          <TouchableHighlight onPress={() => this._onPress('header: ' + i)}>
            <View
              key   = {i}
              style = {{backgroundColor: 'yellow', width: 50, height: 50, margin: 10, alignItems: 'center', justifyContent: 'center'}}>
              <Text>{i}</Text>
            </View>
          </TouchableHighlight>
        );
      })(i)
    }
    return (
      <ScrollView style={{backgroundColor: 'blue'}} horizontal={true}>
        {views}
      </ScrollView>
    );
  },

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions