Skip to content

Auto scroll issue when snapToInterval/snapToOffsets is set on Vivo/Oppo Phones #29922

Description

@Ashwin-Mothilal

All the scenarios applies to both snapToInterval/snapToOffsets

Description

I have created a ScrollView with snapToInterval set. When I try to scroll, it automatically scrolls to the end of the scroll view then to the start. This happens when snapToInterval is set and especially on Vivo/Oppo phones. This works perfectly on other OEM phones like Samsung, Pixel, Redmi etc.

⚠️ Note

I tested on Vivo v17 running Android 10 with security patch 2020-07-01. This was working fine on the April security patch of the phone.

React Native version:

System:

OS: macOS 10.15.6
CPU: (4) x64 Intel(R) Core(TM) i7-4578U CPU @ 3.00GHz
Memory: 107.91 MB / 16.00 GB
Shell: 5.7.1 - /bin/zsh

Binaries:

Node: 12.16.2 - ~/.nvm/versions/node/v12.16.2/bin/node
Yarn: 1.22.4 - /usr/local/bin/yarn
npm: 6.14.4 - ~/.nvm/versions/node/v12.16.2/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman

SDKs:

iOS SDK:
  Platforms: iOS 13.5, DriverKit 19.0, macOS 10.15, tvOS 13.4, watchOS 6.2

IDEs:

Android Studio: 3.6 AI-192.7142.36.36.6308749
Xcode: 11.5/11E608c - /usr/bin/xcodebuild

npmPackages:

react: 16.13.1 => 16.13.1 
react-native: 0.63.2 => 0.63.2

Steps To Reproduce

Provide a detailed list of steps that reproduce the issue.

  1. Need a Vivo/Oppo phone (I tested it on Vivo v17)
  2. Just simply scroll
Software version - PD194F_EX_A_6.11.5
Android version - 10
Vivo ROM - Funtouch OS_10
Security Patch - 2020-07-01

Expected Results

When I scroll it needs to snap to the next interval.

Snack, code example, screenshot, or link to a repository:

GitHub Repo link
Snack link
Video link

Code:

import React from 'react';
import {
  ScrollView,
  View,
  Text,
  FlatList,
  useWindowDimensions,
} from 'react-native';

const height = 200;

const data = new Array(10).fill(0);

const App = () => {
  const {width} = useWindowDimensions();
  const renderItem = ({index}) => {
    return (
      <View
        style={{
          width,
          height,
          backgroundColor: 'white',
          alignItems: 'center',
          justifyContent: 'center',
          borderWidth: 1,
        }}
        key={index}>
        <Text>{`Count is ${index}`}</Text>
      </View>
    );
  };

  return (
    <View
      style={{
        width,
      }}>
      <Text
        style={{height: 50, textAlign: 'center', textAlignVertical: 'center'}}>
        This is a Horizontal ScrollView
      </Text>
      <ScrollView
        horizontal={true}
        pagingEnabled={false}
        snapToInterval={width}
        decelerationRate={'fast'}
        persistentScrollbar>
        {data.map((_, index) => renderItem({index}))}
      </ScrollView>
      <Text
        style={{height: 50, textAlign: 'center', textAlignVertical: 'center'}}>
        This is a Vertical FlatList
      </Text>
      <FlatList
        renderItem={renderItem}
        data={data}
        keyExtractor={(item, index) => index.toString()}
        style={{height}}
        snapToInterval={height}
        persistentScrollbar
        decelerationRate={'fast'}
      />
    </View>
  );
};

export default App;

Metadata

Metadata

Assignees

No one assigned

    Labels

    Needs: Triage 🔍StaleThere has been a lack of activity on this issue and it may be closed soon.

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions