Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Mobile] Remove Keyboard Aware Flatlist (#48791)
* Remove react-native-keyboard-aware-scroll-view dependency * Mobile - AztecView/AztecInputState: - Remove usage of onCaretVerticalPositionChange - Add support for adding a listener when the caret Y coordinate position changes * Mobile - VisualEditor - Remove keyboard listeners and the usage of isAutoScrollEnabled in the state of the component * Mobile - RichText - Remove usage useNativeProps which used to handle the caret position's changes for iOS * Mobile - BlockList and Keyboard Aware FlatList for iOS: - Removes usage of the react-native-keyboard-aware-scroll-view library - Adds custom implementation to scroll to the focused TextInput element * Mobile - Remove patch for react-native-keyboard-aware-scroll-view * Mobile - Update Block insertion E2E test * Mobile - Block List - Update isFloatingToolbarVisible logic * Mobile - KeyboardAwareFlatList - Remove usage of inputAccessoryViewHeight * Mobile - KeyboardAwareFlatList - Prevent adding listeners on re-renders and prevent scrolling if the scroll reference doesn't exist * Mobile - E2E - Improve editor paragraph test * Mobile - KeyboardAwareFlatList - Refactors the code to split it in several hooks, it also fixes a few cases that weren't working correctly. * Mobile - useScrollToTextInput - Fix typo in type * Mobile - RCTAztecView - Send caret's height along with its coords * Mobile - Keyboard Aware Flat list - Rewrite hooks to take into account the measurement of the TextInput to its parent, use the caret's height to add extra padding and correct calculation of the top and bottom offsets * Mobile - Keyboard Aware Flatlist - Update hooks to fix several bugs * Mobile - Keyboard Aware Flatlist - Add tests for new hooks * Mobile - Keyboard Aware FlatList - Remove duplicated condition and adds comments * Mobile - Keyboard Aware Flatlist - Update useScrollToTextInput to fix bugs and simplify logic * Mobile - Keyboard Aware Flatlist - Add missing styles for inner blocks * Mobile - Keyboard Aware Flatlist - Fix issue when the title is focused and it shouldn't scroll down * Mobile - Keyboard Aware Flatlist - Don't take into account null values * Mobile - AztecView - iOS: Pass the caret data when the TextInput is focused * Mobile - Keyboard Aware FlatList - Remove unused shouldPreventAutomaticScroll prop * Mobile - Keyboard Aware FlatList - useKeyboardOffset - Add case where it should remove listeners if the scrollEnabled prop changes from true to false * Mobile - Keyboard Aware FlatList - useTextInputOffset: Prevent measuring the TextInput if the caretY is null since we are no longer taking that as a valid value * Mobile - Keyboard Aware FlatList - useScrollToTextInput: Add documentation for scrollToTextInputOffset * Mobile - Keyboard Aware FlatList - useScrollToTextInput: Update "does not scroll when the ScrollView ref is not available" test to check scrollTo wasn't called * Mobile - AztecInputState - Fix spacing in comment * Mobile - E2E Tests - Paragraph and Block Insertion: Remove adding isAndroid conditions * Revert "Mobile - Keyboard Aware FlatList - useScrollToTextInput: Update "does not scroll when the ScrollView ref is not available" test to check scrollTo wasn't called" This reverts commit fd42475. * Mobile - KeyboardAwareFlatList - Reset scrollViewMeasurements to null everythime the dependecies change * Mobile - useKeyboardOffset - Remove if condition if there's an AztecView currently focused, it is not needed anymore * Mobile - AztecView - Pass caret data when the content size of the TextInput changes e.g the orientation changes. Also update the caret data if the AztecView is focused * Mobile - AztecInputState - Don't notify caret change listeners if there's no caret data (avoid triggering them with null values) * Mobile - useKeyboardOffset: Remove usage of keyboardWillShow and just rely on keyboardDidShow and keyboardDidHide, this will be useful when this logic is shared with Android. It also updates the hook to just store the current keyboard offset avoiding storing the keyboard visibility as well. * Mobile - KeyboardAwareFlatList - Remove usage of isKeboardVisible since we just need to know if there's a keyboard offset set or not. It also removes measureScrollView from the useEffect that listens to device orientation changes * Mobile - BlockList - Restore usage of shouldFlatListPreventAutomaticScroll * Mobile -useKeyboardOffset: Update hook to use a setTiemout to remove the keyboard offset, it also updates the unit test * Mobile - useScrollToTextInput: Remove dash * Mobile - KeyboardAwareFlatList: Remove dashes * Mobile - useKeyboardOffset - Reset timeout when willShowSubscription is called * Mobile - useTextInputOffset - Add example when a caretY value would be -1 * Mobile - useKeyboardOffset - Remove duplicated test and use a different keyboard height end coordinates to check different offset value * Mobile - useKeyboardOffset - Update test to also remove the keyboardWillShow listener * Mobile - Update Changelog * Components - Update changelog to include the KeyboardAwareFlatList mobile refactor * Mobile - useTextInputOffset - Update comment to use permanent link
- Loading branch information
4454e82
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Flaky tests detected in 4454e82.
Some tests passed with failed attempts. The failures may not be related to this commit but are still reported for visibility. See the documentation for more information.
🔍 Workflow run URL: https://github.com/WordPress/gutenberg/actions/runs/4657214452
📝 Reported issues:
/test/e2e/specs/site-editor/template-part.spec.js
/test/e2e/specs/site-editor/template-part.spec.js