Skip to content

Commit 5ae72b6

Browse files
authored
docs: mention, that React commits blocks REA commits in KAV, KASV components (#1370)
## 📜 Description Adds an explanation how to fix #1086 ## 💡 Motivation and Context The problem is caused by the fact that react commits pause reanimated commits. To fix this problem we need to enable feature flag. I tested in FabricExample project and it indeed solves the issue. Closes #1086 ## 📢 Changelog <!-- High level overview of important changes --> <!-- For example: fixed status bar manipulation; added new types declarations; --> <!-- If your changes don't affect one of platform/language below - then remove this platform/language --> ### Docs - add explanation how to fix missing animation on new arch for `KeyboardAvoidingView` with `translate-with-padding` behavior - add explanation how to fix missing animation on new arch for `KeyboardChatScrollView` ## 🤔 How Has This Been Tested? Tested via preview. ## 📸 Screenshots (if appropriate): <img width="1344" height="1131" alt="image" src="https://github.com/user-attachments/assets/42a69496-05d0-4b7e-a4f3-a41b236f1947" /> ## 📝 Checklist - [x] CI successfully passed - [x] I added new mocks and corresponding unit-tests if library API was changed
1 parent 7a7b6ca commit 5ae72b6

6 files changed

Lines changed: 96 additions & 2 deletions

File tree

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/node_modules/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp b/node_modules/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp
2+
index 667aec1..5cd9376 100644
3+
--- a/node_modules/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp
4+
+++ b/node_modules/react-native/ReactCommon/react/featureflags/ReactNativeFeatureFlags.cpp
5+
@@ -215,7 +215,7 @@ double ReactNativeFeatureFlags::preparedTextCacheSize() {
6+
}
7+
8+
bool ReactNativeFeatureFlags::preventShadowTreeCommitExhaustion() {
9+
- return getAccessor().preventShadowTreeCommitExhaustion();
10+
+ return true;
11+
}
12+
13+
bool ReactNativeFeatureFlags::traceTurboModulePromiseRejectionsOnAndroid() {
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
diff --git a/node_modules/react-native-reanimated/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.cpp b/node_modules/react-native-reanimated/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.cpp
2+
index 48a3e33..a242150 100644
3+
--- a/node_modules/react-native-reanimated/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.cpp
4+
+++ b/node_modules/react-native-reanimated/Common/cpp/reanimated/Fabric/updates/UpdatesRegistryManager.cpp
5+
@@ -22,7 +22,7 @@ void UpdatesRegistryManager::addRegistry(const std::shared_ptr<UpdatesRegistry>
6+
}
7+
8+
void UpdatesRegistryManager::pauseReanimatedCommits() {
9+
- if constexpr (!StaticFeatureFlags::getFlag("DISABLE_COMMIT_PAUSING_MECHANISM")) {
10+
+ if constexpr (false) {
11+
isPaused_ = true;
12+
}
13+
}

docs/docs/api/components/keyboard-avoiding-view.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,21 @@ Since `StatusBar.currentHeight` is an **Android-only** property, using `?? 0` en
194194
When `true`, the view automatically detects its position on screen, accounting for navigation headers, modals, and other layout offsets. This means `keyboardVerticalOffset` becomes purely additive extra space rather than compensation for unknown positioning.
195195

196196
Default is `false`.
197+
198+
## Troubleshooting
199+
200+
### Missing iOS animation with `translate-with-padding` behavior
201+
202+
On iOS, updating React state right before a keyboard event can cause animations to be skipped entirely. This happens because a React commit can block Reanimated from applying its animated updates in the same frame.
203+
204+
Common triggers include:
205+
206+
- updating state in the `onFocus` callback of a `TextInput`;
207+
- updating state in response to the `keyboardWillShow` event;
208+
- using `KeyboardToolbar` or other components that trigger a state update before the keyboard appears.
209+
210+
To fix this, enable the [DISABLE_COMMIT_PAUSING_MECHANISM](https://docs.swmansion.com/react-native-reanimated/docs/guides/feature-flags/#disable_commit_pausing_mechanism) feature flag. See the link for detailed setup instructions.
211+
212+
:::info Do I need to enable this flag?
213+
This issue can occur even if the state update comes from a different screen (e.g. a parent navigator). To check, open the React Profiler and look for any React commits that happen just before the keyboard event — if you see one, you likely need this flag.
214+
:::

docs/docs/api/components/keyboard-chat-scroll-view.mdx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ On Android we adjust the scroll position inside the [`onMove`](../hooks/keyboard
267267

268268
## Troubleshooting
269269

270-
### Reanimated feature flag
270+
### De-synchronized Android animation (new arch only)
271271

272272
`KeyboardChatScrollView` relies on a Reanimated commit hook internally. If you're using **Reanimated < 4.3.0**, you need to enable the [`USE_COMMIT_HOOK_ONLY_FOR_REACT_COMMITS`](https://docs.swmansion.com/react-native-reanimated/docs/guides/feature-flags/#use_commit_hook_only_for_react_commits) feature flag in your `package.json`:
273273

@@ -290,3 +290,19 @@ If you're on **Reanimated 4.3.0+**, this flag is enabled by default — no extra
290290
:::info What it affects?
291291
If you don't enable this flag you'll see de-synchronized keyboard animation on Android/Fabric architecture.
292292
:::
293+
294+
### Missing animations on iOS (new arch only)
295+
296+
On iOS (New Architecture only), updating React state right before a keyboard event can cause animations to be skipped entirely. This happens because a React commit can block Reanimated from applying its animated updates in the same frame.
297+
298+
Common triggers include:
299+
300+
- updating state in the `onFocus` callback of a `TextInput`;
301+
- updating state in response to the `keyboardWillShow` event;
302+
- using `KeyboardToolbar` or other components that trigger a state update before the keyboard appears.
303+
304+
To fix this, enable the [DISABLE_COMMIT_PAUSING_MECHANISM](https://docs.swmansion.com/react-native-reanimated/docs/guides/feature-flags/#disable_commit_pausing_mechanism) feature flag. See the link for detailed setup instructions.
305+
306+
:::info Do I need to enable this flag?
307+
This issue can occur even if the state update comes from a different screen (e.g. a parent navigator). To check, open the React Profiler and look for any React commits that happen just before the keyboard event — if you see one, you likely need this flag.
308+
:::

docs/versioned_docs/version-1.21.0/api/components/keyboard-avoiding-view.mdx

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -194,3 +194,21 @@ Since `StatusBar.currentHeight` is an **Android-only** property, using `?? 0` en
194194
When `true`, the view automatically detects its position on screen, accounting for navigation headers, modals, and other layout offsets. This means `keyboardVerticalOffset` becomes purely additive extra space rather than compensation for unknown positioning.
195195

196196
Default is `false`.
197+
198+
## Troubleshooting
199+
200+
### Missing iOS animation with `translate-with-padding` behavior
201+
202+
On iOS, updating React state right before a keyboard event can cause animations to be skipped entirely. This happens because a React commit can block Reanimated from applying its animated updates in the same frame.
203+
204+
Common triggers include:
205+
206+
- updating state in the `onFocus` callback of a `TextInput`;
207+
- updating state in response to the `keyboardWillShow` event;
208+
- using `KeyboardToolbar` or other components that trigger a state update before the keyboard appears.
209+
210+
To fix this, enable the [DISABLE_COMMIT_PAUSING_MECHANISM](https://docs.swmansion.com/react-native-reanimated/docs/guides/feature-flags/#disable_commit_pausing_mechanism) feature flag. See the link for detailed setup instructions.
211+
212+
:::info Do I need to enable this flag?
213+
This issue can occur even if the state update comes from a different screen (e.g. a parent navigator). To check, open the React Profiler and look for any React commits that happen just before the keyboard event — if you see one, you likely need this flag.
214+
:::

docs/versioned_docs/version-1.21.0/api/components/keyboard-chat-scroll-view.mdx

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -267,7 +267,7 @@ On Android we adjust the scroll position inside the [`onMove`](../hooks/keyboard
267267

268268
## Troubleshooting
269269

270-
### Reanimated feature flag
270+
### De-synchronized Android animation (new arch only)
271271

272272
`KeyboardChatScrollView` relies on a Reanimated commit hook internally. If you're using **Reanimated < 4.3.0**, you need to enable the [`USE_COMMIT_HOOK_ONLY_FOR_REACT_COMMITS`](https://docs.swmansion.com/react-native-reanimated/docs/guides/feature-flags/#use_commit_hook_only_for_react_commits) feature flag in your `package.json`:
273273

@@ -290,3 +290,19 @@ If you're on **Reanimated 4.3.0+**, this flag is enabled by default — no extra
290290
:::info What it affects?
291291
If you don't enable this flag you'll see de-synchronized keyboard animation on Android/Fabric architecture.
292292
:::
293+
294+
### Missing animations on iOS (new arch only)
295+
296+
On iOS (New Architecture only), updating React state right before a keyboard event can cause animations to be skipped entirely. This happens because a React commit can block Reanimated from applying its animated updates in the same frame.
297+
298+
Common triggers include:
299+
300+
- updating state in the `onFocus` callback of a `TextInput`;
301+
- updating state in response to the `keyboardWillShow` event;
302+
- using `KeyboardToolbar` or other components that trigger a state update before the keyboard appears.
303+
304+
To fix this, enable the [DISABLE_COMMIT_PAUSING_MECHANISM](https://docs.swmansion.com/react-native-reanimated/docs/guides/feature-flags/#disable_commit_pausing_mechanism) feature flag. See the link for detailed setup instructions.
305+
306+
:::info Do I need to enable this flag?
307+
This issue can occur even if the state update comes from a different screen (e.g. a parent navigator). To check, open the React Profiler and look for any React commits that happen just before the keyboard event — if you see one, you likely need this flag.
308+
:::

0 commit comments

Comments
 (0)