已合并
fix: values from animated props aren't set correctly after finishing animation with native driver, leading to wrong values in measure. #1287
Przemysław Sosna创建于 2025年7月14日
fix: values from animated props aren't set correctly after finishing animation with native driver, leading to wrong values in measure. #1287
已合并
Pull Request已成功合入, 合并人@huangyouhua
(感谢 Przemysław Sosna 的贡献)2025年7月14日 关联了issue:fix: values from animated props aren't set correctly after finishing animation with native driver, leading to wrong values in measure.
2025年7月14日 关联了issue:fix: values from animated props aren't set correctly after finishing animation with native driver, leading to wrong values in measure.
openharmony_ci
2025年7月14日 评论:
2025年7月14日 评论:
感谢提交 Pull Requests!
Thanks for submitting a pull request.


2025年7月14日 添加了label:dco检查成功
2025年7月14日 修改了pull request 的描述
Przemysław Sosna
2025年7月14日 评论:
2025年7月14日 评论:
start build


此处折叠了120条消息 查看更多
Przemysław Sosna
2025年11月19日 评论:
2025年11月19日 评论:
2025年11月26日 通过审查
2025年11月26日 关闭了关联的issue
2025年11月26日 合入了pull request
Description
When using the native driver for animations that involve layout changes (ie. translateY and other transforms, but not styles such as opacity), because it bypasses Fabric, the new coordinates are not updated so the values returned by measure are incorrect.
This was actually fixed on 0.77, so this PR is a cherrypick of "Trigger rerender on animation complete (#37836)" from the upstream RN repository and "fix: values for animated props are not set correctly after
displaychanges tonone" from the 0.77 branch. "fix: the infinite loop caused by the error "Animated node with tag xxx does not exist"." (d7083d23e9573c805196f813d5c1051c702e150c) is also cherrypicked, as without that native driver is bugged and after a coupld of animations doesn't work properly.Changes
Test Plan
Check the code below, after pressing "Measure Box", the height logged should be 100.
import React, {useLayoutEffect, useRef} from 'react'; import {TouchableOpacity, View, Text, Animated} from 'react-native'; export default function App() { const scaleValue = useRef(new Animated.Value(0.2)).current; const boxRef = useRef<View>(null); React.useEffect(() => { Animated.spring(scaleValue, { toValue: 1, friction: 3, useNativeDriver: true, }).start(); }, []); const measureBox = () => { boxRef.current?.measure((x, y, width, height, pageX, pageY) => { console.log({x, y, width, height, pageX, pageY}); }); }; useLayoutEffect(() => { measureBox(); }, []); return ( <View style={{ flex: 1, justifyContent: 'center', alignItems: 'center', gap: 40, }}> <TouchableOpacity onPress={measureBox} style={{padding: 10, backgroundColor: '#eee'}}> <Text>Measure Box</Text> </TouchableOpacity> <Animated.View ref={boxRef} style={{ width: 100, height: 100, backgroundColor: 'orange', borderRadius: 8, transform: [{scale: scaleValue}], justifyContent: 'center', alignItems: 'center', }}> <Text>Scaled Box</Text> </Animated.View> </View> ); }Checklist