11import type { ForwardedRef , ReactNode } from 'react' ;
2- import React , { useContext , useEffect , useMemo , useRef } from 'react' ;
2+ import React , { forwardRef , useContext , useEffect , useMemo , useRef } from 'react' ;
33import type { StyleProp , ViewStyle } from 'react-native' ;
44import { Keyboard , PanResponder , View } from 'react-native' ;
55import { PickerAvoidingView } from 'react-native-picker-select' ;
@@ -18,9 +18,6 @@ import toggleTestToolsModal from '@userActions/TestTool';
1818import CONST from '@src/CONST' ;
1919
2020type 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}
235234ScreenWrapperContainer . displayName = 'ScreenWrapperContainer' ;
236235
237- export default React . memo ( ScreenWrapperContainer ) ;
236+ export default React . memo ( forwardRef ( ScreenWrapperContainer ) ) ;
238237export type { ScreenWrapperContainerProps } ;
0 commit comments