Skip to content

Commit a4830c3

Browse files
authored
Merge pull request Expensify#65194 from Eskalifer1/fix/65123-workspace-name-focus
fix/65123: Workspace name input focus
2 parents 70b3bf9 + f51537d commit a4830c3

2 files changed

Lines changed: 28 additions & 29 deletions

File tree

src/components/ScreenWrapper/ScreenWrapperContainer.tsx

Lines changed: 27 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import type {ForwardedRef, ReactNode} from 'react';
2-
import React, {useContext, useEffect, useMemo, useRef} from 'react';
2+
import React, {forwardRef, useContext, useEffect, useMemo, useRef} from 'react';
33
import type {StyleProp, ViewStyle} from 'react-native';
44
import {Keyboard, PanResponder, View} from 'react-native';
55
import {PickerAvoidingView} from 'react-native-picker-select';
@@ -18,9 +18,6 @@ import toggleTestToolsModal from '@userActions/TestTool';
1818
import CONST from '@src/CONST';
1919

2020
type ScreenWrapperContainerProps = React.PropsWithChildren<{
21-
/** Ref for the screen wrapper container */
22-
forwardedRef?: ForwardedRef<View>;
23-
2421
/** A unique ID to find the screen wrapper in tests */
2522
testID: string;
2623

@@ -86,28 +83,30 @@ type ScreenWrapperContainerProps = React.PropsWithChildren<{
8683
isFocused?: boolean;
8784
}>;
8885

89-
function ScreenWrapperContainer({
90-
forwardedRef,
91-
children,
92-
style,
93-
testID,
94-
bottomContent,
95-
bottomContentStyle: bottomContentStyleProp,
96-
keyboardAvoidingViewBehavior = 'padding',
97-
keyboardVerticalOffset,
98-
shouldEnableKeyboardAvoidingView = true,
99-
shouldEnableMaxHeight = false,
100-
shouldEnableMinHeight = false,
101-
shouldEnablePickerAvoiding = true,
102-
shouldDismissKeyboardBeforeClose = true,
103-
shouldAvoidScrollOnVirtualViewport = true,
104-
shouldUseCachedViewportHeight = false,
105-
shouldKeyboardOffsetBottomSafeAreaPadding: shouldKeyboardOffsetBottomSafeAreaPaddingProp,
106-
enableEdgeToEdgeBottomSafeAreaPadding,
107-
includePaddingTop = true,
108-
includeSafeAreaPaddingBottom = false,
109-
isFocused = true,
110-
}: ScreenWrapperContainerProps) {
86+
function ScreenWrapperContainer(
87+
{
88+
children,
89+
style,
90+
testID,
91+
bottomContent,
92+
bottomContentStyle: bottomContentStyleProp,
93+
keyboardAvoidingViewBehavior = 'padding',
94+
keyboardVerticalOffset,
95+
shouldEnableKeyboardAvoidingView = true,
96+
shouldEnableMaxHeight = false,
97+
shouldEnableMinHeight = false,
98+
shouldEnablePickerAvoiding = true,
99+
shouldDismissKeyboardBeforeClose = true,
100+
shouldAvoidScrollOnVirtualViewport = true,
101+
shouldUseCachedViewportHeight = false,
102+
shouldKeyboardOffsetBottomSafeAreaPadding: shouldKeyboardOffsetBottomSafeAreaPaddingProp,
103+
enableEdgeToEdgeBottomSafeAreaPadding,
104+
includePaddingTop = true,
105+
includeSafeAreaPaddingBottom = false,
106+
isFocused = true,
107+
}: ScreenWrapperContainerProps,
108+
ref: ForwardedRef<View>,
109+
) {
111110
const {windowHeight} = useWindowDimensions(shouldUseCachedViewportHeight);
112111
const {initialHeight} = useInitialDimensions();
113112
const styles = useThemeStyles();
@@ -199,7 +198,7 @@ function ScreenWrapperContainer({
199198

200199
return (
201200
<View
202-
ref={forwardedRef}
201+
ref={ref}
203202
style={[styles.flex1, {minHeight}]}
204203
// eslint-disable-next-line react/jsx-props-no-spreading, react-compiler/react-compiler
205204
{...panResponder.panHandlers}
@@ -234,5 +233,5 @@ function ScreenWrapperContainer({
234233
}
235234
ScreenWrapperContainer.displayName = 'ScreenWrapperContainer';
236235

237-
export default React.memo(ScreenWrapperContainer);
236+
export default React.memo(forwardRef(ScreenWrapperContainer));
238237
export type {ScreenWrapperContainerProps};

src/components/ScreenWrapper/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -234,7 +234,7 @@ function ScreenWrapper(
234234
return (
235235
<FocusTrapForScreen focusTrapSettings={focusTrapSettings}>
236236
<ScreenWrapperContainer
237-
forwardedRef={ref}
237+
ref={ref}
238238
style={[styles.flex1, style]}
239239
bottomContent={bottomContent}
240240
didScreenTransitionEnd={didScreenTransitionEnd}

0 commit comments

Comments
 (0)