已合并
fix: incorrect nested scroll behavior in the example with reanimated #1781
fix: incorrect nested scroll behavior in the example with reanimated #1781
已合并
Arek Kasprzyk创建于 2025年11月6日
Arek Kasprzyk
Arek Kasprzyk
2025年11月6日

Description

setEnableScrollInteraction should be called in onFinalizeUpdates because its logic depends on the position in the components hierarchy, which isn't established when onPropsChanged is called.

Changes

  • fix nested scroll behavior being sometimes different than on other platforms

Test Plan

The behavior of the following reproducer should be more similar to Android. This MR is a partial fix.

import {ScrollView, Text, useWindowDimensions, View} from 'react-native';
import Animated, {useAnimatedStyle} from 'react-native-reanimated';

const LOADING_HEIGHT = 48;

export default function NestedScrollView() {
  const {height: windowHeight} = useWindowDimensions();

  const animatedStyles = useAnimatedStyle(() => {
    'worklet';
    return {
      transform: [
        {
          translateY: 32,
        },
      ],
    };
  });

  return (
    <View style={[{height: windowHeight, paddingTop: 88}]}>
      <View style={{flex: 1}}>
        <ScrollView
          style={{backgroundColor: 'cyan'}}
          scrollEventThrottle={1}
          bounces={false}
          showsVerticalScrollIndicator={false}>
          <View style={{borderWidth: 1}}>
            {Array(20)
              .fill(1)
              .map((_, index) => (
                <Text key={index}>{index}</Text>
              ))}
          </View>
          <View
            style={{
              height: windowHeight - 88,
              flexDirection: 'row',
            }}>
            <View
              style={{
                height: '100%',
                width: 1,
                backgroundColor: 'black',
              }}
            />
            <View style={{flex: 1}}>
              <Animated.View
                style={[
                  {
                    height: LOADING_HEIGHT,
                    position: 'absolute',
                    top: -LOADING_HEIGHT,
                    width: 100,
                    backgroundColor: 'green',
                    zIndex: 2,
                    display: 'flex',
                    flexDirection: 'row',
                    alignItems: 'center',
                    justifyContent: 'center',
                    transform: [{translateY: -32}],
                  },
                  animatedStyles,
                ]}
              />
              <ScrollView
                style={{
                  backgroundColor: 'pink',
                  flex: 1,
                  height: '100%',
                }}
                bounces={false}
                nestedScrollEnabled={false}
                scrollEventThrottle={1}
                showsVerticalScrollIndicator={false}>
                {Array(100)
                  .fill(1)
                  .map((_, index) => (
                    <Text key={index}>{index}</Text>
                  ))}
              </ScrollView>
            </View>
          </View>
        </ScrollView>
      </View>
    </View>
  );
}

Checklist

likedislike
Pull Request已成功合入, 合并人@huangyouhua
(感谢 Arek Kasprzyk 的贡献)
openharmony_ci
openharmony_ci成员
2025年11月6日 评论:

感谢提交 Pull Requests!
Thanks for submitting a pull request.

likedislike
openharmony_ciopenharmony_ci成员
2025年11月6日 添加了label:dco检查成功
Arek KasprzykArek Kasprzyk
2025年11月6日 关联了issue:[Bug]: fix: incorrect nested scroll behavior in the example with reanimated
Arek KasprzykArek Kasprzyk
2025年11月6日 将michalrojek设为评审人
Arek Kasprzyk
Arek Kasprzyk
2025年11月6日 评论:

start build

likedislike
openharmony_ci
openharmony_ci成员
2025年11月6日 评论:

首次触发
门禁构建开始,包含静态检查、代码编译【ohos_react_native_master编译】,预计在60分钟内完成,门禁结果会同步发送到注册邮箱。您可以通过如下链接跟踪门禁进展:http://dcp.openharmony.cn/workbench/cicd/detail/690b7e0e64650f998bb69d1b/runlist

likedislike
openharmony_ciopenharmony_ci成员
2025年11月6日 添加了label:编译失败
openharmony_ciopenharmony_ci成员
2025年11月6日 添加了label:静态检查成功
openharmony_ci
openharmony_ci成员
2025年11月6日 评论:

代码门禁未通过
您可以通过如下链接查看门禁报告:http://dcp.openharmony.cn/workbench/cicd/detail/690b7e0e64650f998bb69d1b/runlist

静态检查:

# check type result report
1 codeCheck pass >>>

编译测试:
# Device build result package
1 ohos_react_native_master failed(compile failed) >>>

likedislike
Arek KasprzykArek Kasprzyk
2025年11月6日 设置为草稿状态
Arek KasprzykArek Kasprzyk
2025年11月6日 修改标题为 “[WIP] fix: incorrect nested scroll behavior in the example with reanimated”,原标题为“fix: incorrect nested scroll behavior in the example with reanimated”
Arek Kasprzyk
Arek Kasprzyk
2025年11月10日 评论:

Closing. This is more complex issue that consists of 3 subproblems.

likedislike
Arek KasprzykArek Kasprzyk
2025年11月10日 关闭了 pull request
Arek KasprzykArek Kasprzyk
2025年11月13日 重新打开了 pull request
Arek KasprzykArek Kasprzyk
2025年11月13日 强制推送  13 个提交:4c8b9749-12 commits from branch masterfc247376-fix
Arek Kasprzyk
Arek Kasprzyk
2025年11月13日 评论:

start build

likedislike
openharmony_ciopenharmony_ci成员
2025年11月13日 删除了label:静态检查成功
openharmony_ciopenharmony_ci成员
2025年11月13日 删除了label:编译失败
openharmony_ci
openharmony_ci成员
2025年11月13日 评论:

代码有更新,重置PR验证状态

likedislike
openharmony_ci
openharmony_ci成员
2025年11月13日 评论:

本地或库上代码有更新,全量重新构建,重置所有关联PR的验证状态
门禁构建开始,包含静态检查、代码编译【ohos_react_native_master编译】,预计在60分钟内完成,门禁结果会同步发送到注册邮箱。您可以通过如下链接跟踪门禁进展:http://dcp.openharmony.cn/workbench/cicd/detail/6914b46264650f998bccd866/runlist

likedislike
openharmony_ci
openharmony_ci成员
2025年11月13日 评论:

感谢提交 Pull Requests!
Thanks for submitting a pull request.

likedislike
Arek Kasprzyk
Arek Kasprzyk
2025年11月13日 评论:

start build

likedislike
openharmony_ci
openharmony_ci成员
2025年11月13日 评论:

当前有构建正在进行中,请勿重复触发

likedislike
Arek KasprzykArek Kasprzyk
2025年11月13日 修改了pull request 的描述
此处折叠了5条事件消息 查看更多
openharmony_ciopenharmony_ci成员
2025年11月13日 通过测试
openharmony_ci
openharmony_ci成员
2025年11月13日 评论:

代码门禁通过
您可以通过如下链接查看门禁报告:http://dcp.openharmony.cn/workbench/cicd/detail/6914b46264650f998bccd866/runlist

静态检查:

# check type result report
1 codeCheck pass >>>

编译测试:
# Device build result package
1 ohos_react_native_master success >>>

likedislike
Arek KasprzykArek Kasprzyk
2025年11月14日 将 huangyouhua 设为合并人
Arek KasprzykArek Kasprzyk
2025年11月14日 修改了pull request 的描述
Arek Kasprzyk
Arek Kasprzyk
2025年11月14日 评论:
likedislike
michał
michał
2025年11月26日 评论:

Hey @gyange can you merge this PR?

likedislike
huangyouhuahuangyouhua
2025年11月27日 通过审查
huangyouhuahuangyouhua
2025年11月27日 关闭了关联的issue
huangyouhuahuangyouhua
2025年11月27日 合入了pull request