-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Fix 17866: After pressing the back arrow to "Send/Request money" screen, the keyboard flashes #30065
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
Merged
Merged
Fix 17866: After pressing the back arrow to "Send/Request money" screen, the keyboard flashes #30065
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
7ca29f8
Fix 17866: After pressing the back arrow to "Send/Request money" scre…
sarious d097f0e
added hook description
sarious 6a989ec
apply shouldEnableMinHeight only for Manual tab. added property to pr…
sarious df084d5
fix the bug with screen width inside the edit money request flow
sarious b2af5ce
fix the bug with bottom inset, when buttons at the bottom are covered…
sarious 7c2a515
enabled min height for all tabs
sarious d8c6af8
Merge commit '342a2c4a63f61c9129873f3f0d4b0616ea9e8083' into fix/1786…
sarious bbd8737
use aliases. get rid of useInitialWindowDimensions native file
sarious ae9815c
fix eslint errors. added jsdoc returns line
sarious File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| // eslint-disable-next-line no-restricted-imports | ||
| import {useEffect, useState} from 'react'; | ||
| import {Dimensions} from 'react-native'; | ||
| import {initialWindowMetrics} from 'react-native-safe-area-context'; | ||
|
|
||
| /** | ||
| * A convenience hook that provides initial size (width and height). | ||
| * An initial height allows to know the real height of window, | ||
| * while the standard useWindowDimensions hook return the height minus Virtual keyboard height | ||
| * @returns {Object} with information about initial width and height | ||
| */ | ||
| export default function () { | ||
| const [dimensions, setDimensions] = useState(() => { | ||
| const window = Dimensions.get('window'); | ||
| const screen = Dimensions.get('screen'); | ||
|
|
||
| return { | ||
| screenHeight: screen.height, | ||
| screenWidth: screen.width, | ||
| initialHeight: window.height, | ||
| initialWidth: window.width, | ||
| }; | ||
| }); | ||
|
|
||
| useEffect(() => { | ||
| const onDimensionChange = (newDimensions) => { | ||
| const {window, screen} = newDimensions; | ||
|
|
||
| setDimensions((oldState) => { | ||
| if (screen.width !== oldState.screenWidth || screen.height !== oldState.screenHeight || window.height > oldState.initialHeight) { | ||
| return { | ||
| initialHeight: window.height, | ||
| initialWidth: window.width, | ||
| screenHeight: screen.height, | ||
| screenWidth: screen.width, | ||
| }; | ||
| } | ||
|
|
||
| return oldState; | ||
| }); | ||
| }; | ||
|
|
||
| const dimensionsEventListener = Dimensions.addEventListener('change', onDimensionChange); | ||
|
|
||
| return () => { | ||
| if (!dimensionsEventListener) { | ||
| return; | ||
| } | ||
| dimensionsEventListener.remove(); | ||
| }; | ||
| }, []); | ||
|
|
||
| const bottomInset = initialWindowMetrics && initialWindowMetrics.insets && initialWindowMetrics.insets.bottom ? initialWindowMetrics.insets.bottom : 0; | ||
|
|
||
| return { | ||
| initialWidth: dimensions.initialWidth, | ||
| initialHeight: dimensions.initialHeight - bottomInset, | ||
|
sarious marked this conversation as resolved.
Outdated
|
||
| }; | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.