From b2731f5c494c88728e23ac9f4109c8ebd881806c Mon Sep 17 00:00:00 2001 From: Dan Abramov <dan.abramov@gmail.com> Date: Sun, 8 Dec 2024 23:50:08 +0000 Subject: [PATCH 1/3] Undo perf hackfix --- src/view/com/util/MainScrollProvider.tsx | 25 ++++++------------------ 1 file changed, 6 insertions(+), 19 deletions(-) diff --git a/src/view/com/util/MainScrollProvider.tsx b/src/view/com/util/MainScrollProvider.tsx index c1293a83c0..e2538eaab6 100644 --- a/src/view/com/util/MainScrollProvider.tsx +++ b/src/view/com/util/MainScrollProvider.tsx @@ -1,11 +1,6 @@ import React, {useCallback, useEffect} from 'react' import {NativeScrollEvent} from 'react-native' -import { - interpolate, - makeMutable, - useSharedValue, - withSpring, -} from 'react-native-reanimated' +import {interpolate, useSharedValue, withSpring} from 'react-native-reanimated' import EventEmitter from 'eventemitter3' import {ScrollProvider} from '#/lib/ScrollContext' @@ -20,18 +15,6 @@ function clamp(num: number, min: number, max: number) { return Math.min(Math.max(num, min), max) } -const V0 = makeMutable( - withSpring(0, { - overshootClamping: true, - }), -) - -const V1 = makeMutable( - withSpring(1, { - overshootClamping: true, - }), -) - export function MainScrollProvider({children}: {children: React.ReactNode}) { const {headerHeight} = useShellLayout() const {headerMode} = useMinimalShellMode() @@ -42,7 +25,11 @@ export function MainScrollProvider({children}: {children: React.ReactNode}) { const setMode = React.useCallback( (v: boolean) => { 'worklet' - headerMode.set(v ? V1.get() : V0.get()) + headerMode.set(() => + withSpring(v ? 1 : 0, { + overshootClamping: true, + }), + ) }, [headerMode], ) From 916eaed13e3a4ed2f61790c782266cda1848a79e Mon Sep 17 00:00:00 2001 From: Dan Abramov <dan.abramov@gmail.com> Date: Sun, 8 Dec 2024 23:52:51 +0000 Subject: [PATCH 2/3] Bump Reanimated to include https://github.com/software-mansion/react-native-reanimated/pull/6758 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 4c7c179693..91199705e6 100644 --- a/package.json +++ b/package.json @@ -181,7 +181,7 @@ "react-native-picker-select": "^9.3.1", "react-native-progress": "bluesky-social/react-native-progress", "react-native-qrcode-styled": "^0.3.3", - "react-native-reanimated": "^3.16.3", + "react-native-reanimated": "3.17.0-nightly-20241208-3f864e6ae", "react-native-root-siblings": "^4.1.1", "react-native-safe-area-context": "4.14.0", "react-native-screens": "~4.3.0", diff --git a/yarn.lock b/yarn.lock index 21fdb48c60..300eecfc7b 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16047,10 +16047,10 @@ react-native-qrcode-styled@^0.3.3: qrcode "^1.5.4" react-fast-compare "^3.2.2" -react-native-reanimated@^3.16.3: - version "3.16.3" - resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-3.16.3.tgz#3b559dca49e9e40abcf5de834dc27fc05f856b66" - integrity sha512-OWlA6e1oHhytTpc7WiSZ7Tmb8OYwLKYZz29Sz6d6WAg60Hm5GuAiKIWUG7Ako7FLcYhFkA0pEQ2xPMEYUo9vlw== +react-native-reanimated@3.17.0-nightly-20241208-3f864e6ae: + version "3.17.0-nightly-20241208-3f864e6ae" + resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-3.17.0-nightly-20241208-3f864e6ae.tgz#827163aa6346206c2c819a13386d6c1d8c69835b" + integrity sha512-OoopqHsdwY9aQNKlUSBiRiyZCDdRTgkjcawYAVhf5546nIu6K0lPd6xbkIl7Vj6LMkiisTKF5JHChsBveSiKig== dependencies: "@babel/plugin-transform-arrow-functions" "^7.0.0-0" "@babel/plugin-transform-class-properties" "^7.0.0-0" From 8b4fb10c3042674f0f78a5aa7215404660c07247 Mon Sep 17 00:00:00 2001 From: Dan Abramov <dan.abramov@gmail.com> Date: Thu, 12 Dec 2024 03:51:54 +0000 Subject: [PATCH 3/3] Bump to 3.17.0-nightly-20241211-17e89ca24 --- package.json | 2 +- yarn.lock | 8 ++++---- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 91199705e6..79735a1936 100644 --- a/package.json +++ b/package.json @@ -181,7 +181,7 @@ "react-native-picker-select": "^9.3.1", "react-native-progress": "bluesky-social/react-native-progress", "react-native-qrcode-styled": "^0.3.3", - "react-native-reanimated": "3.17.0-nightly-20241208-3f864e6ae", + "react-native-reanimated": "3.17.0-nightly-20241211-17e89ca24", "react-native-root-siblings": "^4.1.1", "react-native-safe-area-context": "4.14.0", "react-native-screens": "~4.3.0", diff --git a/yarn.lock b/yarn.lock index 300eecfc7b..03ffcfcfd6 100644 --- a/yarn.lock +++ b/yarn.lock @@ -16047,10 +16047,10 @@ react-native-qrcode-styled@^0.3.3: qrcode "^1.5.4" react-fast-compare "^3.2.2" -react-native-reanimated@3.17.0-nightly-20241208-3f864e6ae: - version "3.17.0-nightly-20241208-3f864e6ae" - resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-3.17.0-nightly-20241208-3f864e6ae.tgz#827163aa6346206c2c819a13386d6c1d8c69835b" - integrity sha512-OoopqHsdwY9aQNKlUSBiRiyZCDdRTgkjcawYAVhf5546nIu6K0lPd6xbkIl7Vj6LMkiisTKF5JHChsBveSiKig== +react-native-reanimated@3.17.0-nightly-20241211-17e89ca24: + version "3.17.0-nightly-20241211-17e89ca24" + resolved "https://registry.yarnpkg.com/react-native-reanimated/-/react-native-reanimated-3.17.0-nightly-20241211-17e89ca24.tgz#af0c36e278646eb2f79e28ad0047cfd80d0e29f5" + integrity sha512-5p7jr0DrnID1puOzMel3VZVRw5Hl/UdMUvPCI1sEG9IA2mUaWrgeoojS2wVwW1U0Pj6HXjPNEimDSXZneZKNuQ== dependencies: "@babel/plugin-transform-arrow-functions" "^7.0.0-0" "@babel/plugin-transform-class-properties" "^7.0.0-0"