Skip to content

Commit

Permalink
Merge pull request #55296 from shubham1206agra/revert-54736-53814-con…
Browse files Browse the repository at this point in the history
…firmation-button-jump

Revert "fix confirmation button jump"
  • Loading branch information
mjasikowski authored Jan 16, 2025
2 parents 1ee7261 + 2a52aee commit 71501b9
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 66 deletions.
2 changes: 0 additions & 2 deletions src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import CustomStatusBarAndBackgroundContextProvider from './components/CustomStat
import ErrorBoundary from './components/ErrorBoundary';
import HTMLEngineProvider from './components/HTMLEngineProvider';
import InitialURLContextProvider from './components/InitialURLContextProvider';
import {InputBlurContextProvider} from './components/InputBlurContext';
import KeyboardProvider from './components/KeyboardProvider';
import {LocaleContextProvider} from './components/LocaleContextProvider';
import OnyxProvider from './components/OnyxProvider';
Expand Down Expand Up @@ -99,7 +98,6 @@ function App({url}: AppProps) {
KeyboardProvider,
SearchRouterContextProvider,
ProductTrainingContextProvider,
InputBlurContextProvider,
]}
>
<CustomStatusBarAndBackground />
Expand Down
8 changes: 1 addition & 7 deletions src/components/Form/FormProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,8 @@ import type {ForwardedRef, MutableRefObject, ReactNode, RefAttributes} from 'rea
import React, {createRef, forwardRef, useCallback, useEffect, useImperativeHandle, useMemo, useRef, useState} from 'react';
import type {NativeSyntheticEvent, StyleProp, TextInputSubmitEditingEventData, ViewStyle} from 'react-native';
import {useOnyx} from 'react-native-onyx';
import {useInputBlurContext} from '@components/InputBlurContext';
import useDebounceNonReactive from '@hooks/useDebounceNonReactive';
import useLocalize from '@hooks/useLocalize';
import * as Browser from '@libs/Browser';
import * as ValidationUtils from '@libs/ValidationUtils';
import Visibility from '@libs/Visibility';
import * as FormActions from '@userActions/FormActions';
Expand Down Expand Up @@ -97,7 +95,6 @@ function FormProvider(
const [inputValues, setInputValues] = useState<Form>(() => ({...draftValues}));
const [errors, setErrors] = useState<GenericFormInputErrors>({});
const hasServerError = useMemo(() => !!formState && !isEmptyObject(formState?.errors), [formState]);
const {setIsBlurred} = useInputBlurContext();

const onValidate = useCallback(
(values: FormOnyxValues, shouldClearServerError = true) => {
Expand Down Expand Up @@ -374,9 +371,6 @@ function FormProvider(
}, VALIDATE_DELAY);
}
inputProps.onBlur?.(event);
if (Browser.isSafari()) {
setIsBlurred(true);
}
},
onInputChange: (value, key) => {
const inputKey = key ?? inputID;
Expand All @@ -399,7 +393,7 @@ function FormProvider(
},
};
},
[draftValues, inputValues, formState?.errorFields, errors, submit, setTouchedInput, shouldValidateOnBlur, onValidate, hasServerError, setIsBlurred, formID, shouldValidateOnChange],
[draftValues, inputValues, formState?.errorFields, errors, submit, setTouchedInput, shouldValidateOnBlur, onValidate, hasServerError, formID, shouldValidateOnChange],
);
const value = useMemo(() => ({registerInput}), [registerInput]);

Expand Down
32 changes: 0 additions & 32 deletions src/components/InputBlurContext/index.tsx

This file was deleted.

26 changes: 1 addition & 25 deletions src/components/ScreenWrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,13 @@ import useWindowDimensions from '@hooks/useWindowDimensions';
import * as Browser from '@libs/Browser';
import type {PlatformStackNavigationProp} from '@libs/Navigation/PlatformStackNavigation/types';
import type {AuthScreensParamList, RootStackParamList} from '@libs/Navigation/types';
import addViewportResizeListener from '@libs/VisualViewport';
import toggleTestToolsModal from '@userActions/TestTool';
import CONST from '@src/CONST';
import CustomDevMenu from './CustomDevMenu';
import FocusTrapForScreens from './FocusTrap/FocusTrapForScreen';
import type FocusTrapForScreenProps from './FocusTrap/FocusTrapForScreen/FocusTrapProps';
import HeaderGap from './HeaderGap';
import ImportedStateIndicator from './ImportedStateIndicator';
import {useInputBlurContext} from './InputBlurContext';
import KeyboardAvoidingView from './KeyboardAvoidingView';
import ModalContext from './Modal/ModalContext';
import OfflineIndicator from './OfflineIndicator';
Expand Down Expand Up @@ -167,7 +165,6 @@ function ScreenWrapper(
const shouldReturnToOldDot = useMemo(() => {
return !!route?.params && 'singleNewDotEntry' in route.params && route.params.singleNewDotEntry === 'true';
}, [route?.params]);
const {isBlurred, setIsBlurred} = useInputBlurContext();

UNSTABLE_usePreventRemove(shouldReturnToOldDot, () => {
NativeModules.HybridAppModule?.closeReactNativeApp(false, false);
Expand All @@ -192,27 +189,6 @@ function ScreenWrapper(
}),
).current;

useEffect(() => {
/**
* Handler to manage viewport resize events specific to Safari.
* Disables the blur state when Safari is detected.
*/
const handleViewportResize = () => {
if (!Browser.isSafari()) {
return; // Exit early if not Safari
}
setIsBlurred(false); // Disable blur state for Safari
};

// Add the viewport resize listener
const removeResizeListener = addViewportResizeListener(handleViewportResize);

// Cleanup function to remove the listener
return () => {
removeResizeListener();
};
}, [setIsBlurred]);

useEffect(() => {
// On iOS, the transitionEnd event doesn't trigger some times. As such, we need to set a timeout
const timeout = setTimeout(() => {
Expand Down Expand Up @@ -295,7 +271,7 @@ function ScreenWrapper(
{...keyboardDismissPanResponder.panHandlers}
>
<KeyboardAvoidingView
style={[styles.w100, styles.h100, !isBlurred ? {maxHeight} : undefined, isAvoidingViewportScroll ? [styles.overflowAuto, styles.overscrollBehaviorContain] : {}]}
style={[styles.w100, styles.h100, {maxHeight}, isAvoidingViewportScroll ? [styles.overflowAuto, styles.overscrollBehaviorContain] : {}]}
behavior={keyboardAvoidingViewBehavior}
enabled={shouldEnableKeyboardAvoidingView}
>
Expand Down

0 comments on commit 71501b9

Please sign in to comment.