Skip to content
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

fix: KeyboardAvoidingView height when "Prefer Cross-Fade Transitions" is enabled #16

Closed

Conversation

gabrieldonadel
Copy link
Owner

@gabrieldonadel gabrieldonadel commented Aug 22, 2022

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 incorrect endCoordinates coming back from the native iOS UIKeyboardWillChangeFrameNotification event and unfortunelly there isn't much we can do on the native side to fix it.

Closes https://github.com/facebook/react-native/issues/ 31484
Closes https://github.com/facebook/react-native/issues/ 29974

Changelog

[iOS] [Fixed] - Fix KeyboardAvoidingView height when "Prefer Cross-Fade Transitions" is enabled

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
Screen.Recording.2022-08-26.at.01.32.17.mov

@gabrieldonadel gabrieldonadel force-pushed the fix/keyboard-avoiding-view-cross-fade-transitions branch from bf9c0a0 to 0fdab0f Compare August 25, 2022 23:56
@gabrieldonadel gabrieldonadel changed the base branch from feat/add-prefer-crossfade-transitions to main August 25, 2022 23:58
@gabrieldonadel
Copy link
Owner Author

facebook-github-bot pushed a commit to facebook/react-native that referenced this pull request Aug 26, 2022
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
raykle pushed a commit to raykle/react-native that referenced this pull request Aug 27, 2022
…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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant