Skip to content
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

[CP Staging] Revert "fix confirmation button jump" #55296

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,13 +4,11 @@
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';

Check failure on line 9 in src/components/Form/FormProvider.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @libs are not allowed. Use named imports instead. Example: import { method } from "@libs/module"
import Visibility from '@libs/Visibility';
import * as FormActions from '@userActions/FormActions';

Check failure on line 11 in src/components/Form/FormProvider.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @userActions are not allowed. Use named imports instead. Example: import { action } from "@userActions/module"
import CONST from '@src/CONST';
import type {OnyxFormDraftKey, OnyxFormKey} from '@src/ONYXKEYS';
import ONYXKEYS from '@src/ONYXKEYS';
Expand Down Expand Up @@ -97,7 +95,6 @@
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 @@
}, VALIDATE_DELAY);
}
inputProps.onBlur?.(event);
if (Browser.isSafari()) {
setIsBlurred(true);
}
},
onInputChange: (value, key) => {
const inputKey = key ?? inputID;
Expand All @@ -399,7 +393,7 @@
},
};
},
[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 @@ -12,18 +12,16 @@
import useTackInputFocus from '@hooks/useTackInputFocus';
import useThemeStyles from '@hooks/useThemeStyles';
import useWindowDimensions from '@hooks/useWindowDimensions';
import * as Browser from '@libs/Browser';

Check failure on line 15 in src/components/ScreenWrapper.tsx

View workflow job for this annotation

GitHub Actions / Changed files ESLint check

Namespace imports from @libs are not allowed. Use named imports instead. Example: import { method } from "@libs/module"
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 @@
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 @@
}),
).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 @@
{...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
Loading