From 8b980a6b87a57e8d83d9d2b51713f29ae2194b70 Mon Sep 17 00:00:00 2001 From: Jules Rosser Date: Mon, 20 Nov 2023 12:48:24 +0000 Subject: [PATCH] revert PR 30679 --- src/CONST.ts | 8 -------- src/components/Form.js | 10 ---------- src/components/Form/FormProvider.js | 7 ------- src/components/HeaderWithBackButton/index.js | 1 - src/components/RoomNameInput/index.js | 2 +- src/components/RoomNameInput/index.native.js | 2 +- src/libs/Navigation/AppNavigator/Navigators/Overlay.js | 2 -- 7 files changed, 2 insertions(+), 30 deletions(-) diff --git a/src/CONST.ts b/src/CONST.ts index 709e9d3bafe2..3472a3ccbdf4 100755 --- a/src/CONST.ts +++ b/src/CONST.ts @@ -2882,15 +2882,7 @@ const CONST = { /** types that will show a virtual keyboard in a mobile browser */ INPUT_TYPES_WITH_KEYBOARD: ['text', 'search', 'tel', 'url', 'email', 'password'], - /** - * native IDs for close buttons in Overlay component - */ - OVERLAY: { - TOP_BUTTON_NATIVE_ID: 'overLayTopButton', - BOTTOM_BUTTON_NATIVE_ID: 'overLayBottomButton', - }, - BACK_BUTTON_NATIVE_ID: 'backButton', REFERRAL_PROGRAM: { CONTENT_TYPES: { MONEY_REQUEST: 'request', diff --git a/src/components/Form.js b/src/components/Form.js index 0010f01a0ccc..28343691ea15 100644 --- a/src/components/Form.js +++ b/src/components/Form.js @@ -351,17 +351,7 @@ function Form(props) { // We delay the validation in order to prevent Checkbox loss of focus when // the user are focusing a TextInput and proceeds to toggle a CheckBox in // web and mobile web platforms. - - // Prevents React from resetting its properties - event.persist(); setTimeout(() => { - const relatedTargetId = lodashGet(event, 'nativeEvent.relatedTarget.id'); - if ( - relatedTargetId && - _.includes([CONST.OVERLAY.BOTTOM_BUTTON_NATIVE_ID, CONST.OVERLAY.TOP_BUTTON_NATIVE_ID, CONST.BACK_BUTTON_NATIVE_ID], relatedTargetId) - ) { - return; - } setTouchedInput(inputID); if (props.shouldValidateOnBlur) { onValidate(inputValues, !hasServerError); diff --git a/src/components/Form/FormProvider.js b/src/components/Form/FormProvider.js index e8f8fdc1ea96..92c76da5936d 100644 --- a/src/components/Form/FormProvider.js +++ b/src/components/Form/FormProvider.js @@ -266,14 +266,7 @@ function FormProvider({validate, formID, shouldValidateOnBlur, shouldValidateOnC // We delay the validation in order to prevent Checkbox loss of focus when // the user is focusing a TextInput and proceeds to toggle a CheckBox in // web and mobile web platforms. - - // Prevents React from resetting its properties - event.persist(); setTimeout(() => { - const relatedTargetId = lodashGet(event, 'nativeEvent.relatedTarget.id'); - if (relatedTargetId && _.includes([CONST.OVERLAY.BOTTOM_BUTTON_NATIVE_ID, CONST.OVERLAY.TOP_BUTTON_NATIVE_ID, CONST.BACK_BUTTON_NATIVE_ID], relatedTargetId)) { - return; - } setTouchedInput(inputID); if (shouldValidateOnBlur) { onValidate(inputValues, !hasServerError); diff --git a/src/components/HeaderWithBackButton/index.js b/src/components/HeaderWithBackButton/index.js index edb3b8d26831..1371e6a36b97 100755 --- a/src/components/HeaderWithBackButton/index.js +++ b/src/components/HeaderWithBackButton/index.js @@ -79,7 +79,6 @@ function HeaderWithBackButton({ style={[styles.touchableButtonImage]} role="button" accessibilityLabel={translate('common.back')} - nativeID={CONST.BACK_BUTTON_NATIVE_ID} > setSelection(event.nativeEvent.selection)} errorText={errorText} autoCapitalize="none" - onBlur={(event) => isFocused && onBlur(event)} + onBlur={() => isFocused && onBlur()} shouldDelayFocus={shouldDelayFocus} autoFocus={isFocused && autoFocus} maxLength={CONST.REPORT.MAX_ROOM_NAME_LENGTH} diff --git a/src/components/RoomNameInput/index.native.js b/src/components/RoomNameInput/index.native.js index a2c09996ad34..828affe33d07 100644 --- a/src/components/RoomNameInput/index.native.js +++ b/src/components/RoomNameInput/index.native.js @@ -41,7 +41,7 @@ function RoomNameInput({isFocused, autoFocus, disabled, errorText, forwardedRef, errorText={errorText} maxLength={CONST.REPORT.MAX_ROOM_NAME_LENGTH} keyboardType={keyboardType} // this is a bit hacky solution to a RN issue https://github.com/facebook/react-native/issues/27449 - onBlur={(event) => isFocused && onBlur(event)} + onBlur={() => isFocused && onBlur()} autoFocus={isFocused && autoFocus} autoCapitalize="none" shouldDelayFocus={shouldDelayFocus} diff --git a/src/libs/Navigation/AppNavigator/Navigators/Overlay.js b/src/libs/Navigation/AppNavigator/Navigators/Overlay.js index 44d996282617..7a4cbf7db3c5 100644 --- a/src/libs/Navigation/AppNavigator/Navigators/Overlay.js +++ b/src/libs/Navigation/AppNavigator/Navigators/Overlay.js @@ -29,7 +29,6 @@ function Overlay(props) { onPress={props.onPress} accessibilityLabel={translate('common.close')} role={CONST.ACCESSIBILITY_ROLE.BUTTON} - nativeID={CONST.OVERLAY.TOP_BUTTON_NATIVE_ID} />