Files
mattermost-mobile/patches/react-native-reanimated+2.8.0.patch
Elias Nahum 19ecc150b6 [Gekidou] Update dependencies (#6305)
* Update dependencies

* Fix iOS build

* update fastlane
2022-05-24 08:47:12 -04:00

70 lines
3.1 KiB
Diff

diff --git a/node_modules/react-native-reanimated/lib/reanimated2/jestUtils.js b/node_modules/react-native-reanimated/lib/reanimated2/jestUtils.js
index 5ae42ec..da59568 100644
--- a/node_modules/react-native-reanimated/lib/reanimated2/jestUtils.js
+++ b/node_modules/react-native-reanimated/lib/reanimated2/jestUtils.js
@@ -145,7 +145,7 @@ export const advanceAnimationByFrame = (count) => {
jest.advanceTimersByTime(frameTime);
};
export const setUpTests = (userConfig = {}) => {
- const expect = require('expect');
+ const { expect } = require('@jest/globals');
require('setimmediate');
frameTime = Math.round(1000 / config.fps);
config = Object.assign(Object.assign({}, config), userConfig);
@@ -154,6 +154,9 @@ export const setUpTests = (userConfig = {}) => {
return compareStyle(received, expectedStyle, config);
},
});
+ global.ReanimatedDataMock = {
+ now: () => currentTimestamp,
+ };
};
export const getAnimatedStyle = (received) => {
return getCurrentStyle(received);
diff --git a/node_modules/react-native-reanimated/src/createAnimatedComponent.tsx b/node_modules/react-native-reanimated/src/createAnimatedComponent.tsx
index 1cf0c3f..a334889 100644
--- a/node_modules/react-native-reanimated/src/createAnimatedComponent.tsx
+++ b/node_modules/react-native-reanimated/src/createAnimatedComponent.tsx
@@ -195,6 +195,7 @@ export default function createAnimatedComponent(
_isFirstRender = true;
animatedStyle: { value: StyleProps } = { value: {} };
initialStyle = {};
+ _lastSentStyle?: StyleProps;
sv: SharedValue<null | Record<string, unknown>> | null;
_propsAnimated?: PropsAnimated;
_component: ComponentRef | null = null;
@@ -580,17 +581,24 @@ export default function createAnimatedComponent(
_filterNonAnimatedStyle(inputStyle: StyleProps) {
const style: StyleProps = {};
+ let changed = false;
for (const key in inputStyle) {
const value = inputStyle[key];
if (!hasAnimatedNodes(value)) {
style[key] = value;
+ changed = changed || style[key] !== this._lastSentStyle?.[key];
} else if (value instanceof AnimatedValue) {
// if any style in animated component is set directly to the `Value` we set those styles to the first value of `Value` node in order
// to avoid flash of default styles when `Value` is being asynchrounously sent via bridge and initialized in the native side.
style[key] = value._startingValue;
+ changed = changed || style[key] !== this._lastSentStyle?.[key];
}
}
- return style;
+ if (changed) {
+ return style;
+ } else {
+ return this._lastSentStyle;
+ }
}
_filterNonAnimatedProps(
@@ -620,6 +628,7 @@ export default function createAnimatedComponent(
props[key] = this._filterNonAnimatedStyle(
StyleSheet.flatten(processedStyle)
);
+ this._lastSentStyle = props[key]
} else if (key === 'animatedProps') {
const animatedProp = inputProps.animatedProps as Partial<
AnimatedComponentProps<AnimatedProps>