-
Notifications
You must be signed in to change notification settings - Fork 24.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
KeyboardAvoidingView collapses to 0 height on iOS14 when "Prefer Cross-Fade Transitions" is enabled #29974
Comments
I have same issue |
While we are waiting for a fix, we think about disabling the KeyboardAvoidingView for users that have You can read more about the accessibility info in the docs: |
For what it's worth, I can reproduce this in the iOS simulator with 14, so an actual iOS 14 device isn't required. |
Here's the patch we're applying with patch-package against RN 63.2:
Ultimately we'll want to fix this natively, but should be a safe patch for most as I can't think of many situations where we'd want a keyboard positioned at the top of the screen. |
Similar problem with |
I'm having the same issue with react 0.61.5. Tried the patch but it didn't work. |
@jdiaz-kindalab we're on 0.61.5 too and the patch is working for us. Are you sure it's being applied correctly? |
Hopefully it's not. Here's my patch file:
Would you mind sharing yours? To be clear, I'm having this issue even without Prefer Cross-Fade Transitions enabled. In my case, any tap I do outside the keyboard extends my screen back to normal height while keeping the keyboard open. It seems like the lost focus event is making the screen go back to normal size. Thanks for checking out with me |
I was able to reproduce this exact issue with an app in production after users wrote in about it. I will attempt one of the patches above to see if it resolves the issue and report back. |
Can confirm @sterlingwes's fix works. Thank you! |
@jdiaz-kindalab In a rare case, one of my users has this issue even without Prefer Cross-Fade Transitions enabled. Were you able to find out why? |
@sterlingwes 's patch fix worked for us. |
@sterlingwes 's patch fix worked for us, too. Thanks a lot!! |
how can i apply this to my project? |
@Jeff-syscyber |
I didn't understand very well, I started to study react native using expo now and I came across this problem... |
After |
another option is fork react-native and change |
@Jeff-syscyber use |
Same issue here. Users report this bug in production app. |
Found this issue too. You seem to have done some work on this @gabrieldonadel, but couldn't quite figure out if anything got merged? |
Similar problem with I applied sterlingwes's fix, and it works fine now. 👍 |
This was driving me insane. I could not find ANY info on it. Stumbled upon this out of sheer luck. Thank you @sterlingwes for the fix |
One of our users submitted a support ticket including a screen recording which tipped me off to it being related to cross-fade transitions. Without that users screen recording I wouldn't have stood a chance finding this Github issue. Confirming that the patch #29974 (comment) worked for me in RN 0.66.4. |
It's not working for me in any way. react-native 62.2.2 |
With iOS 14 & Reduce Motion > Prefer Cross-Fade Transitions enabled, the keyboard position & height is reported differently (0 instead of Y position value matching height of frame). See: facebook#29974 (comment) This commit implements the fix mentioned in the link above.
With iOS 14 & Reduce Motion > Prefer Cross-Fade Transitions enabled, the keyboard position & height is reported differently (0 instead of Y position value matching height of frame). See: facebook#29974 (comment) This commit implements the fix mentioned in the link above.
I would like to work on this issue. Thanks |
Summary: While working on a fix for #29974 (I have a draft for that already (gabrieldonadel#16), just waiting for #34406 to get merged) I noticed that the `KeyboardAvoidingView` tests on RNTester on iOS were not working with Fabric enabled because the `ModalHostView` component was still not implemented. Upon some more investigation, I found this code suggestion from Milker90 (#33652 (comment)) that enables the Modal component on iOS when Fabric is enabled. Closes #33652 ## Changelog [iOS] [Added] - Add support for Modal on iOS when Fabric is enabled Pull Request resolved: #34487 Test Plan: 1. With Fabric enabled open the RNTester app and navigate to the Modal page 2. Test the `Modal` component through the sections changing props https://user-images.githubusercontent.com/11707729/186289099-5223907d-b300-46bf-bfde-73259c29d544.mov Reviewed By: christophpurrer Differential Revision: D38981895 Pulled By: cipolleschi fbshipit-source-id: cd493a8d2035900da2576323bc112e2565df4834
…4487) Summary: While working on a fix for facebook#29974 (I have a draft for that already (gabrieldonadel#16), just waiting for facebook#34406 to get merged) I noticed that the `KeyboardAvoidingView` tests on RNTester on iOS were not working with Fabric enabled because the `ModalHostView` component was still not implemented. Upon some more investigation, I found this code suggestion from Milker90 (facebook#33652 (comment)) that enables the Modal component on iOS when Fabric is enabled. Closes facebook#33652 ## Changelog [iOS] [Added] - Add support for Modal on iOS when Fabric is enabled Pull Request resolved: facebook#34487 Test Plan: 1. With Fabric enabled open the RNTester app and navigate to the Modal page 2. Test the `Modal` component through the sections changing props https://user-images.githubusercontent.com/11707729/186289099-5223907d-b300-46bf-bfde-73259c29d544.mov Reviewed By: christophpurrer Differential Revision: D38981895 Pulled By: cipolleschi fbshipit-source-id: cd493a8d2035900da2576323bc112e2565df4834
… is enabled (#34503) Summary: Fix `KeyboardAvoidingView` height on iOS when "Prefer Cross-Fade Transitions" is enabled by adding an additional check to `_relativeKeyboardHeight` verifying if `prefersCrossFadeTransitions()` is true and `keyboardFrame.screenY` is `0` and treating this special case. The issue was caused by the native RCTKeyboardObserver where the `endFrame` reported by `UIKeyboardWillChangeFrameNotification` returns `height = 0` when Prefer Cross-Fade Transitions" is enabled and unfortunelly there isn't much we can do on the native side to fix it. Closes #31484 Closes #29974 [iOS] [Fixed] - Fix KeyboardAvoidingView height when "Prefer Cross-Fade Transitions" is enabled Pull Request resolved: #34503 Test Plan: **On iOS 14+** 1. Access Settings > "General" > "Accessibility" > "Reduce Motion", enable "Reduce Motion" then enable "Prefer Cross-Fade Transitions". 2. Open the RNTester app and navigate to the KeyboardAvoidingView page 3. Focus and blur inputs and observe the keyboard behaving correctly https://user-images.githubusercontent.com/11707729/186822671-801872be-7db1-4c5c-904b-1987441c1326.mov Reviewed By: jacdebug Differential Revision: D39055213 Pulled By: cipolleschi fbshipit-source-id: fac17cbe02867e0fe522397f6cb59a8b51c1840f
@fabriziobertoglio1987 I've just checked the latest source 0.70.x, it doesn't have prefersCrossFadeTransitions in https://github.com/facebook/react-native/blob/0.70-stable/Libraries/Components/AccessibilityInfo/AccessibilityInfo.js related issue here: #34784 |
… is enabled (#34503) Summary: Fix `KeyboardAvoidingView` height on iOS when "Prefer Cross-Fade Transitions" is enabled by adding an additional check to `_relativeKeyboardHeight` verifying if `prefersCrossFadeTransitions()` is true and `keyboardFrame.screenY` is `0` and treating this special case. The issue was caused by the native RCTKeyboardObserver where the `endFrame` reported by `UIKeyboardWillChangeFrameNotification` returns `height = 0` when Prefer Cross-Fade Transitions" is enabled and unfortunelly there isn't much we can do on the native side to fix it. Closes #31484 Closes #29974 ## Changelog [iOS] [Fixed] - Fix KeyboardAvoidingView height when "Prefer Cross-Fade Transitions" is enabled Pull Request resolved: #34503 Test Plan: **On iOS 14+** 1. Access Settings > "General" > "Accessibility" > "Reduce Motion", enable "Reduce Motion" then enable "Prefer Cross-Fade Transitions". 2. Open the RNTester app and navigate to the KeyboardAvoidingView page 3. Focus and blur inputs and observe the keyboard behaving correctly https://user-images.githubusercontent.com/11707729/186822671-801872be-7db1-4c5c-904b-1987441c1326.mov Reviewed By: jacdebug Differential Revision: D39055213 Pulled By: cipolleschi fbshipit-source-id: fac17cbe02867e0fe522397f6cb59a8b51c1840f
… is enabled (facebook#34503) Summary: Fix `KeyboardAvoidingView` height on iOS when "Prefer Cross-Fade Transitions" is enabled by adding an additional check to `_relativeKeyboardHeight` verifying if `prefersCrossFadeTransitions()` is true and `keyboardFrame.screenY` is `0` and treating this special case. The issue was caused by the native RCTKeyboardObserver where the `endFrame` reported by `UIKeyboardWillChangeFrameNotification` returns `height = 0` when Prefer Cross-Fade Transitions" is enabled and unfortunelly there isn't much we can do on the native side to fix it. Closes facebook#31484 Closes facebook#29974 ## Changelog [iOS] [Fixed] - Fix KeyboardAvoidingView height when "Prefer Cross-Fade Transitions" is enabled Pull Request resolved: facebook#34503 Test Plan: **On iOS 14+** 1. Access Settings > "General" > "Accessibility" > "Reduce Motion", enable "Reduce Motion" then enable "Prefer Cross-Fade Transitions". 2. Open the RNTester app and navigate to the KeyboardAvoidingView page 3. Focus and blur inputs and observe the keyboard behaving correctly https://user-images.githubusercontent.com/11707729/186822671-801872be-7db1-4c5c-904b-1987441c1326.mov Reviewed By: jacdebug Differential Revision: D39055213 Pulled By: cipolleschi fbshipit-source-id: fac17cbe02867e0fe522397f6cb59a8b51c1840f # Conflicts: # Libraries/Components/Keyboard/KeyboardAvoidingView.js
… is enabled (facebook#34503) Summary: Fix `KeyboardAvoidingView` height on iOS when "Prefer Cross-Fade Transitions" is enabled by adding an additional check to `_relativeKeyboardHeight` verifying if `prefersCrossFadeTransitions()` is true and `keyboardFrame.screenY` is `0` and treating this special case. The issue was caused by the native RCTKeyboardObserver where the `endFrame` reported by `UIKeyboardWillChangeFrameNotification` returns `height = 0` when Prefer Cross-Fade Transitions" is enabled and unfortunelly there isn't much we can do on the native side to fix it. Closes facebook#31484 Closes facebook#29974 ## Changelog [iOS] [Fixed] - Fix KeyboardAvoidingView height when "Prefer Cross-Fade Transitions" is enabled Pull Request resolved: facebook#34503 Test Plan: **On iOS 14+** 1. Access Settings > "General" > "Accessibility" > "Reduce Motion", enable "Reduce Motion" then enable "Prefer Cross-Fade Transitions". 2. Open the RNTester app and navigate to the KeyboardAvoidingView page 3. Focus and blur inputs and observe the keyboard behaving correctly https://user-images.githubusercontent.com/11707729/186822671-801872be-7db1-4c5c-904b-1987441c1326.mov Reviewed By: jacdebug Differential Revision: D39055213 Pulled By: cipolleschi fbshipit-source-id: fac17cbe02867e0fe522397f6cb59a8b51c1840f # Conflicts: # Libraries/Components/Keyboard/KeyboardAvoidingView.js
That's fix works for my app!!! Save me!! React Native version: 0.69.0 |
This should be documented in the KeyboardAvoidingView component within the react-native documentation... Works for me! For those who don't know how to apply the patch check this: https://anu-thomas.medium.com/patch-package-in-react-native-c7786a15e279 React Native version: 0.63.5 |
…s enabled on iOS Summary: Fixes [ENG-5919](https://linear.app/comm/issue/ENG-5919/enabling-cross-fade-transitions-on-ios-makes-app-unusable), which is [this React Native issue](facebook/react-native#29974). I took the patch there as inspiration, but there are minimal differences because we have our own `KeyboardAvoidingView` (which lets us skip using `patch-package`). Test Plan: Confirm that the repro no longer works: open chat, select `ChatInputBar`, swipe back Reviewers: atul, ginsu, tomek Reviewed By: ginsu Differential Revision: https://phab.comm.dev/D10120
facebook#29974 KeyboardAvoidingView collapses to 0 height on iOS14 when "Prefer Cross-Fade Transitions" is enabled
Description
For users with
Prefer Cross-Fade Transitions
enabled in their Accessibility > Motion options on iOS 14KeyboardAvoidingView
will collapse to0px
in height when the keyboard hides (when an input is blurred).This only happens on physical devices as the Simulator doesn't have this accessibility option available.
The
KeyboardAvoidingView
behaves correctly whenPrefer Cross-Fade Transitions
is switched off.The issue appears to be caused by incorrect
endCoordinates
coming back from theKeyboard.addListener('keyboardWillChangeFrame')
listener inKeyboardAvoidingView
as the values that come back differ significantly depending on the status ofPrefer Cross-Fade Transitions
.This behaviour happens with
behaviour
set toheight
,padding
andmargin
and doesn't appear to be an issue with theKeyboardAvoidingView
directly but just theKeyboard
events.React Native version:
Tested in React Native 61.5 and 0.63.2 along with Expo v38
System information
Steps To Reproduce
Settings > Accessibility > Motion > Reduce Motion
andPrefer Cross-Fade Transitions
(will only show up after enablingReduce Motion
)KeyboardAvoidingView
in an app and observe the behaviour when dismissing a keyboard by blurring aTextInput
Expected Results
The
KeyboardAvoidingView
should reset to its normal height.Snack, code example, screenshot, or link to a repository:
Snack: https://snack.expo.io/@levibuzolic/ios14-keyboard-avoiding-view
Minimal React Native Project: https://github.com/levibuzolic/KeyboardAvoidingView
Screenshots
Demonstrates the behaviour of the above Snack and React Native project on iOS 14 on an iPhone 11 Pro. The green border is inside the
KeyboardAvoidingView
to highlight the height of the content.The text was updated successfully, but these errors were encountered: