-
Notifications
You must be signed in to change notification settings - Fork 3.9k
Fix/73175b - Empty space instead of keyboard if backgrounding app while creating expense #76281
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
Changes from all commits
765cd32
a1b7a63
897db36
eaec67c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,19 +1,24 @@ | ||
| import React, {useEffect} from 'react'; | ||
| import {AppState, Keyboard} from 'react-native'; | ||
| import useThemeStyles from '@hooks/useThemeStyles'; | ||
| import Log from '@libs/Log'; | ||
| import BaseTextInput from './BaseTextInput'; | ||
| import type {BaseTextInputProps} from './BaseTextInput/types'; | ||
|
|
||
| function TextInput({ref, ...props}: BaseTextInputProps) { | ||
| function TextInput({ref, navigation, ...props}: BaseTextInputProps) { | ||
| const styles = useThemeStyles(); | ||
|
|
||
| useEffect(() => { | ||
| if (!props.disableKeyboard) { | ||
| return; | ||
| } | ||
|
|
||
| if (!navigation) { | ||
| Log.warn('disableKeyboard is enabled, but "navigation" isn\'t passed to the TextInput component!'); | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Can you check similar places with enabled disableKeyboard where the bug can be reproduced and pass
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes. I reviewed everything when creating this PR, and I added this log to ensure that nothing gets missed in the future. |
||
| } | ||
|
|
||
| const appStateSubscription = AppState.addEventListener('change', (nextAppState) => { | ||
| if (!nextAppState.match(/inactive|background/)) { | ||
| if (!nextAppState.match(/inactive|background/) || (navigation && !navigation.isFocused())) { | ||
| return; | ||
| } | ||
|
|
||
|
|
@@ -23,7 +28,7 @@ function TextInput({ref, ...props}: BaseTextInputProps) { | |
| return () => { | ||
| appStateSubscription.remove(); | ||
| }; | ||
| }, [props.disableKeyboard]); | ||
| }, [props.disableKeyboard, navigation]); | ||
|
|
||
| return ( | ||
| <BaseTextInput | ||
|
|
||
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.
Why do we need to redefine
getStatehere? Also please add prop JSDoc comment.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.
Actually, I didn’t look into why it needs to redefine
getState; I just took it from the type ofuseNavigation😄: