Skip to content

Touchable: layout is measured during touch-scroll event #1166

@hushicai

Description

@hushicai

The problem

As mentioned in #1157, Touchable _remeasureMetricsOnActivation was called when we touch to scroll, and cause browser Layout due to the getRect:

image

I have find out that it is called on native too.

image

But there is no performance problem in native.

Browser Layout costs so much times, making the scroll performance so bad!

How to reproduce

A large List, with Touchable items, can reproduce the problem.

<ScrollView>
   // the more complicated of the TouchableOpacity view tree, the easier to reproduce.
  <TouchableOpacity style={styles.item}></TouchableOpacity>
  // ...
  // ...
  // ...
</ScrollView>

const styles = StyleSheet.create({
  // The bigger the visual rect, the easier to reproduce.
  item: {width: '100%', height: 100} 
});

Expected behavior

Hope to look for a solution, and improve the scroll performance.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions