Description
Description
For users with Prefer Cross-Fade Transitions
enabled in their Accessibility > Motion options on iOS 14 KeyboardAvoidingView
will collapse to 0px
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 when Prefer Cross-Fade Transitions
is switched off.
The issue appears to be caused by incorrect endCoordinates
coming back from the Keyboard.addListener('keyboardWillChangeFrame')
listener in KeyboardAvoidingView
as the values that come back differ significantly depending on the status of Prefer Cross-Fade Transitions
.
This behaviour happens with behaviour
set to height
, padding
and margin
and doesn't appear to be an issue with the KeyboardAvoidingView
directly but just the Keyboard
events.
React Native version:
Tested in React Native 61.5 and 0.63.2 along with Expo v38
System information
System:
OS: macOS 10.15.6
CPU: (12) x64 Intel(R) Core(TM) i7-8700K CPU @ 3.70GHz
Memory: 837.72 MB / 32.00 GB
Shell: 5.7.1 - /bin/zsh
Binaries:
Node: 14.5.0 - /var/folders/fj/y1w1yb3n4810ly8x70sds2d00000gn/T/yarn--1600411348330-0.8419068030637213/node
Yarn: 1.22.5 - /var/folders/fj/y1w1yb3n4810ly8x70sds2d00000gn/T/yarn--1600411348330-0.8419068030637213/yarn
npm: 6.14.5 - ~/.asdf/installs/nodejs/14.5.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Managers:
CocoaPods: 1.9.3 - /Users/levi/.asdf/shims/pod
SDKs:
iOS SDK:
Platforms: iOS 14.0, DriverKit 19.0, macOS 10.15, tvOS 14.0, watchOS 7.0
Android SDK: Not Found
IDEs:
Android Studio: 4.0 AI-193.6911.18.40.6626763
Xcode: 12.0/12A7209 - /usr/bin/xcodebuild
Languages:
Java: 1.8.0_242-release - /usr/bin/javac
Python: 3.8.5 - /Users/levi/.asdf/shims/python
npmPackages:
@react-native-community/cli: Not Found
react: 16.13.1 => 16.13.1
react-native: 0.63.2 => 0.63.2
react-native-macos: Not Found
npmGlobalPackages:
*react-native*: Not Found
Steps To Reproduce
- On a device with iOS 14
- Enable
Settings > Accessibility > Motion > Reduce Motion
andPrefer Cross-Fade Transitions
(will only show up after enablingReduce Motion
) - Use a
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.