-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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 can't close keyboard in some pages #46172
Changes from all commits
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 |
---|---|---|
|
@@ -90,8 +90,10 @@ function RoomDescriptionPage({report, policies}: RoomDescriptionPageProps) { | |
if (!el) { | ||
return; | ||
} | ||
if (!reportDescriptionInputRef.current) { | ||
updateMultilineInputRange(el); | ||
} | ||
reportDescriptionInputRef.current = el; | ||
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. ios_desc_room.mp4 |
||
updateMultilineInputRange(el); | ||
}} | ||
value={description} | ||
onChangeText={handleReportDescriptionChange} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -178,8 +178,10 @@ function IOURequestStepDescription({ | |
if (!el) { | ||
return; | ||
} | ||
if (!inputRef.current) { | ||
updateMultilineInputRange(el); | ||
} | ||
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. ios_desc.mp4 |
||
inputRef.current = el; | ||
updateMultilineInputRange(inputRef.current); | ||
}} | ||
autoGrowHeight | ||
maxAutoGrowHeight={variables.textInputAutoGrowMaxHeight} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,7 +44,7 @@ function ExitSurveyResponsePage({draftResponse, route, navigation}: ExitSurveyRe | |
const {keyboardHeight} = useKeyboardState(); | ||
const {windowHeight} = useWindowDimensions(); | ||
const {top: safeAreaInsetsTop} = useSafeAreaInsets(); | ||
const {inputCallbackRef} = useAutoFocusInput(); | ||
const {inputCallbackRef, inputRef} = useAutoFocusInput(); | ||
|
||
const {reason, backTo} = route.params; | ||
const {isOffline} = useNetwork({ | ||
|
@@ -134,7 +134,9 @@ function ExitSurveyResponsePage({draftResponse, route, navigation}: ExitSurveyRe | |
if (!el) { | ||
return; | ||
} | ||
updateMultilineInputRange(el); | ||
if (!inputRef.current) { | ||
updateMultilineInputRange(el); | ||
} | ||
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. ios_exit_survey.mp4 |
||
inputCallbackRef(el); | ||
}} | ||
containerStyles={[baseResponseInputContainerStyle]} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,7 @@ type NewTaskDescriptionPageProps = NewTaskDescriptionPageOnyxProps & StackScreen | |
function NewTaskDescriptionPage({task}: NewTaskDescriptionPageProps) { | ||
const styles = useThemeStyles(); | ||
const {translate} = useLocalize(); | ||
const {inputCallbackRef} = useAutoFocusInput(); | ||
const {inputCallbackRef, inputRef} = useAutoFocusInput(); | ||
|
||
const onSubmit = (values: FormOnyxValues<typeof ONYXKEYS.FORMS.NEW_TASK_FORM>) => { | ||
TaskActions.setDescriptionValue(values.taskDescription); | ||
|
@@ -83,8 +83,10 @@ function NewTaskDescriptionPage({task}: NewTaskDescriptionPageProps) { | |
accessibilityLabel={translate('newTaskPage.descriptionOptional')} | ||
role={CONST.ROLE.PRESENTATION} | ||
ref={(el) => { | ||
if (!inputRef.current) { | ||
updateMultilineInputRange(el); | ||
} | ||
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. ios_task_description.mp4 |
||
inputCallbackRef(el); | ||
updateMultilineInputRange(el); | ||
}} | ||
autoGrowHeight | ||
maxAutoGrowHeight={variables.textInputAutoGrowMaxHeight} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -116,8 +116,10 @@ function TaskDescriptionPage({report, currentUserPersonalDetails}: TaskDescripti | |
if (!element) { | ||
return; | ||
} | ||
if (!inputRef.current) { | ||
updateMultilineInputRange(inputRef.current); | ||
} | ||
inputRef.current = element; | ||
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. ios_task_description_2.mp4 |
||
updateMultilineInputRange(inputRef.current); | ||
}} | ||
autoGrowHeight | ||
maxAutoGrowHeight={variables.textInputAutoGrowMaxHeight} | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import React, {useCallback, useState} from 'react'; | ||
import React, {useCallback, useRef, useState} from 'react'; | ||
import {Keyboard, View} from 'react-native'; | ||
import FormProvider from '@components/Form/FormProvider'; | ||
import InputWrapper from '@components/Form/InputWrapper'; | ||
|
@@ -26,6 +26,7 @@ type Props = WithPolicyProps; | |
function WorkspaceProfileDescriptionPage({policy}: Props) { | ||
const styles = useThemeStyles(); | ||
const {translate} = useLocalize(); | ||
const isInputInitializedRef = useRef(false); | ||
const [description, setDescription] = useState(() => | ||
Parser.htmlToMarkdown( | ||
// policy?.description can be an empty string | ||
|
@@ -109,7 +110,10 @@ function WorkspaceProfileDescriptionPage({policy}: Props) { | |
autoGrowHeight | ||
isMarkdownEnabled | ||
ref={(el: BaseTextInputRef | null): void => { | ||
updateMultilineInputRange(el); | ||
if (!isInputInitializedRef.current) { | ||
updateMultilineInputRange(el); | ||
} | ||
isInputInitializedRef.current = true; | ||
}} | ||
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. ios_profile_desc.mp4 |
||
/> | ||
</View> | ||
|
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.
ios_p_note.mp4