Files
mattermost-mobile/patches/react-native-reanimated+2.10.0.patch
Elias Nahum cae9dc21d2 [Gekidou] Upgrade to RN 0.70 (#6690)
* Upgrade to RN 0.70

* fix assembleAndroidTest
2022-10-20 10:18:25 -03:00

83 lines
3.4 KiB
Diff

diff --git a/node_modules/react-native-reanimated/android/build.gradle b/node_modules/react-native-reanimated/android/build.gradle
index 6b5e3fc..d419b5e 100644
--- a/node_modules/react-native-reanimated/android/build.gradle
+++ b/node_modules/react-native-reanimated/android/build.gradle
@@ -301,6 +301,7 @@ android {
"**/libreactnativejni.so",
"**/libjscexecutor.so",
"**/libv8executor.so",
+ "META-INF/MANIFEST.MF",
]
}
tasks.withType(JavaCompile) {
diff --git a/node_modules/react-native-reanimated/lib/reanimated2/jestUtils.js b/node_modules/react-native-reanimated/lib/reanimated2/jestUtils.js
index d8befd8..6357426 100644
--- a/node_modules/react-native-reanimated/lib/reanimated2/jestUtils.js
+++ b/node_modules/react-native-reanimated/lib/reanimated2/jestUtils.js
@@ -148,6 +148,9 @@ export const setUpTests = (userConfig = {}) => {
let expect;
try {
expect = require('expect');
+ if (!expect.extend) {
+ throw new Error('expect does not have extend, falling back...')
+ }
}
catch (_) {
// for Jest in version 28+
@@ -162,6 +165,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..a242e4b 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,16 +581,33 @@ 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];
}
}
+ if (!changed) {
+ const inputKeys = new Set(Object.keys(inputStyle));
+ let equalKeys = true;
+ for (const key in this._lastSentStyle) {
+ if (!inputKeys.has(key)) {
+ equalKeys = false;
+ break;
+ }
+ }
+ if (equalKeys) {
+ return this._lastSentStyle;
+ }
+ }
+ this._lastSentStyle = style;
return style;
}