|
|
@@ -1,21 +1,28 @@
|
|
|
import {
|
|
|
+ forwardRef,
|
|
|
Fragment,
|
|
|
- type FC
|
|
|
+ type Ref
|
|
|
} from "react";
|
|
|
import {
|
|
|
ScrollView,
|
|
|
View
|
|
|
} from "react-native";
|
|
|
import type IPageContainerProps from "./type";
|
|
|
+import {
|
|
|
+ type IPageContainerRef
|
|
|
+} from "./type";
|
|
|
import stylesheet from "./stylesheet";
|
|
|
import {
|
|
|
NCoreUIKitTheme
|
|
|
} from "../../core/hooks";
|
|
|
+import {
|
|
|
+ type RefForwardingComponent
|
|
|
+} from "../../types";
|
|
|
import {
|
|
|
SafeAreaView
|
|
|
} from "react-native-safe-area-context";
|
|
|
|
|
|
-const PageContainer: FC<IPageContainerProps> = ({
|
|
|
+const PageContainer: RefForwardingComponent<IPageContainerRef, IPageContainerProps> = ({
|
|
|
backgroundColor = "default" as keyof NCoreUIKit.ContainerContentColors,
|
|
|
isWrapSafeareaContext = false,
|
|
|
isWorkWithHeaderSpace = true,
|
|
|
@@ -30,7 +37,7 @@ const PageContainer: FC<IPageContainerProps> = ({
|
|
|
children,
|
|
|
style,
|
|
|
...props
|
|
|
-}) => {
|
|
|
+}, ref) => {
|
|
|
const {
|
|
|
configs,
|
|
|
colors,
|
|
|
@@ -48,6 +55,7 @@ const PageContainer: FC<IPageContainerProps> = ({
|
|
|
|
|
|
return <ScrollView
|
|
|
keyboardShouldPersistTaps="handled"
|
|
|
+ ref={ref as Ref<ScrollView>}
|
|
|
{...scrollViewProps}
|
|
|
contentContainerStyle={[
|
|
|
stylesheet.contentContainer,
|
|
|
@@ -79,6 +87,7 @@ const PageContainer: FC<IPageContainerProps> = ({
|
|
|
}
|
|
|
|
|
|
return <View
|
|
|
+ ref={ref as Ref<View>}
|
|
|
{...props}
|
|
|
style={[
|
|
|
stylesheet.contentContainer,
|
|
|
@@ -125,4 +134,4 @@ const PageContainer: FC<IPageContainerProps> = ({
|
|
|
|
|
|
return renderSafeareaContext();
|
|
|
};
|
|
|
-export default PageContainer;
|
|
|
+export default forwardRef(PageContainer);
|