React-native: ScrollView sticky header flickers in the latest builds ( > RN 0.47.1 )

Created on 10 Aug 2017  路  15Comments  路  Source: facebook/react-native

Is this a bug report?

Yes

Have you read the Contributing Guidelines?

Yes

Environment

  1. react-native -v:
    react-native-cli: 2.0.1
    react-native: 0.47.1
  2. node -v:
    v6.11.1
  3. npm -v:
    3.10.10

Then, specify:

  • Target Platform:
    iOS and Android
  • Development Operating System:
    macOS
  • Build tools:
    react-native run-android
    react-native run-ios

Steps to Reproduce

  1. Launch the app.
  2. Scroll down and up
  3. Watch the sticky header behavior

Expected Behavior

Sticky header should be fixed to the top when scrolling down. And should be stayed without moving unless scrolled back to top and reached at it's actual position. Works well in iOS and Android version RN0.46.4.

Actual Behavior

With the latest RN release verison (0.47.0), (0.47.1) and pre-release version (v0.48.0-rc.0) sticky header flickers when scrolling down and up.

Reproducible Demo


Created an expo for this. But the expo SDK have RN version 0.46.1.
Issue can't be seen in expo. But the code can be used.
expo snack
android_scrollview_flickering

Locked

Most helpful comment

It should be fixed in 0.48.2

All 15 comments

you should change code in ReactScrollView.java

 @Override
  protected void onScrollChanged(int x, int y, int oldX, int oldY) {
    super.onScrollChanged(x, y, oldX, oldY);

    if (mOnScrollDispatchHelper.onScrollChanged(x, y)) {
      if (mRemoveClippedSubviews) {
        updateClippingRect();
      }

      if (mFlinging) {
        mDoneFlinging = false;
      }

      ReactScrollViewHelper.emitScrollEvent(this);
    }
  }

find this onScrollChangedmethod,then delete if (mOnScrollDispatchHelper.onScrollChanged(x, y))

Okay, I will try this change in the RNAndroid.
Looks like now velocity is brought into the onScrollChanged method.
Need to try different cases anyway.
Thanks for suggestion @linjson

Removing the if statement didn't seem to improve much for me on 0.47.1

@onlydave it is more than just condition if I guess.
I checked the code and found the velocity is being introduced. So removing the if condition may break other areas. Need to check different areas for impacts.

I am using RN0.46.4. Which doesn't have this issue. But have issue in flexbox layouting.
Flex box layout issue is fixed in the RN0.47.1, but due to the flickering, I am not able to upgrade.
Hope to get fixed issue in the upcoming releases.

This is a regression caused by https://github.com/facebook/react-native/commit/f954f3d9b674b13977f722bc3b8dc6c1b99fe6c7, we're looking into a fix!

thanks for the update @janicduplessis, really appreciate it.

To inform people who search informations, it's not fixed in 0.48.1

It should be fixed in 0.48.2

This issue not fixed on 0.49.x

@janicduplessis any idea whether this bug will be fixed in future react versions

@rupamgho123 Upgrading to 0.51.0 seems to have fixed this problem for me, working on both iOS and Android.

@janicduplessis This issue not fixed on RN 0.55.3

Experiencing the same issue in 0.55.4

same issue in 0.54.3

Was this page helpful?
0 / 5 - 0 ratings