codingpixel-expo-app 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +112 -0
- package/bin/cli.js +9 -0
- package/dist/babel.js +198 -0
- package/dist/bootstrap.js +54 -0
- package/dist/fonts.js +98 -0
- package/dist/index.js +120 -0
- package/dist/install.js +243 -0
- package/dist/overlay.js +141 -0
- package/dist/patch.js +212 -0
- package/dist/prompts.js +115 -0
- package/dist/scaffold.js +43 -0
- package/dist/sdkNotes.js +19 -0
- package/dist/util.js +48 -0
- package/package.json +56 -0
- package/templates/base/assets/fonts/.gitkeep +0 -0
- package/templates/base/assets/images/.gitkeep +0 -0
- package/templates/base/assets/index.ts +8 -0
- package/templates/base/src/app/_layout.tsx +39 -0
- package/templates/base/src/app/index.tsx +13 -0
- package/templates/base/src/app/routes.tsx +9 -0
- package/templates/base/src/core/hooks/.gitkeep +0 -0
- package/templates/base/src/core/redux/hooks.ts +6 -0
- package/templates/base/src/core/redux/mmkvStorage.ts +18 -0
- package/templates/base/src/core/redux/reducers.ts +20 -0
- package/templates/base/src/core/redux/slices/userSlice.ts +31 -0
- package/templates/base/src/core/redux/store.ts +28 -0
- package/templates/base/src/core/services/.gitkeep +0 -0
- package/templates/base/src/core/tanstack/index.tsx +93 -0
- package/templates/base/src/core/tanstack/tanstack-keys.ts +42 -0
- package/templates/base/src/core/utils/config.ts +50 -0
- package/templates/base/src/core/utils/constants.ts +11 -0
- package/templates/base/src/core/utils/endpoints.ts +29 -0
- package/templates/base/src/core/utils/types.ts +47 -0
- package/templates/base/src/core/utils/validation.ts +10 -0
- package/templates/base/src/features/.gitkeep +0 -0
- package/templates/base/src/ui/appComponents/AppRefreshControl/index.tsx +39 -0
- package/templates/base/src/ui/appComponents/appButton/index.tsx +122 -0
- package/templates/base/src/ui/appComponents/appColumnView/index.tsx +320 -0
- package/templates/base/src/ui/appComponents/appFlashList/index.tsx +191 -0
- package/templates/base/src/ui/appComponents/appFlatList/index.tsx +172 -0
- package/templates/base/src/ui/appComponents/appIcon/index.tsx +105 -0
- package/templates/base/src/ui/appComponents/appInput/index.tsx +226 -0
- package/templates/base/src/ui/appComponents/appKeyboardAvoidingView/index.tsx +168 -0
- package/templates/base/src/ui/appComponents/appKeyboardAwareScrollView/index.tsx +188 -0
- package/templates/base/src/ui/appComponents/appLogger/index.tsx +22 -0
- package/templates/base/src/ui/appComponents/appPressable/index.tsx +220 -0
- package/templates/base/src/ui/appComponents/appRowView/index.tsx +320 -0
- package/templates/base/src/ui/appComponents/appSafeAreaInsets/index.tsx +24 -0
- package/templates/base/src/ui/appComponents/appScrollView/index.tsx +166 -0
- package/templates/base/src/ui/appComponents/appSkeleton/index.tsx +22 -0
- package/templates/base/src/ui/appComponents/appStatusBar/index.tsx +8 -0
- package/templates/base/src/ui/appComponents/appTabHeader/index.tsx +111 -0
- package/templates/base/src/ui/appComponents/appText/index.tsx +258 -0
- package/templates/base/src/ui/appComponents/appTextWrapper/index.tsx +84 -0
- package/templates/base/src/ui/appComponents/appWrapper/index.tsx +56 -0
- package/templates/base/src/ui/appComponents/customActivityIndicator/index.tsx +34 -0
- package/templates/base/src/ui/appComponents/customGetPermissionModal/index.tsx +62 -0
- package/templates/base/src/ui/appComponents/customModal/index.tsx +26 -0
- package/templates/base/src/ui/appComponents/customTextInput/index.tsx +143 -0
- package/templates/base/src/ui/components/.gitkeep +0 -0
- package/templates/base/src/ui/components/avatarBlock/index.tsx +42 -0
- package/templates/base/src/ui/components/backgroundGradient/index.tsx +24 -0
- package/templates/base/src/ui/components/errorFallback/index.tsx +40 -0
- package/templates/base/src/ui/iconComponents/IconFontAwesome6/index.tsx +22 -0
- package/templates/base/src/ui/iconComponents/IoniconsIcons/index.tsx +33 -0
- package/templates/base/src/ui/iconComponents/antDesignicons/index.tsx +22 -0
- package/templates/base/src/ui/iconComponents/featherIcons/index.tsx +22 -0
- package/templates/base/src/ui/iconComponents/materialCommunityIcons/index.tsx +24 -0
- package/templates/base/src/ui/iconComponents/materialIcons/index.tsx +23 -0
- package/templates/base/src/ui/iconComponents/octiconsIcons/index.tsx +23 -0
- package/templates/base/src/ui/theme/allFileStyles.ts +39 -0
- package/templates/base/src/ui/theme/colors.ts +54 -0
- package/templates/base/src/ui/theme/fonts.ts +3 -0
- package/templates/base/src/ui/theme/responsive.ts +27 -0
- package/templates/bottom-sheet/src/ui/appComponents/BottomSheetKeyboardAwareScrollView/index.tsx +111 -0
- package/templates/bottom-sheet/src/ui/appComponents/appBottomSheetBackdrop/index.tsx +27 -0
- package/templates/bottom-sheet/src/ui/appComponents/appBottomSheetScrollView/index.tsx +99 -0
- package/templates/bottom-sheet/src/ui/appComponents/appBottomSheetView/index.tsx +173 -0
- package/templates/bottom-sheet/src/ui/appComponents/customBottomSheetModal/index.tsx +17 -0
- package/templates/claude-command/init-app.md +41 -0
- package/templates/image-picker/media-constants.snippet.ts +18 -0
- package/templates/image-picker/src/core/services/PermissionService.ts +48 -0
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { LinearGradient } from "expo-linear-gradient";
|
|
2
|
+
import React from "react";
|
|
3
|
+
import { Dimensions } from "react-native";
|
|
4
|
+
|
|
5
|
+
const { height } = Dimensions.get("window");
|
|
6
|
+
|
|
7
|
+
const GRADIENT_STYLE = {
|
|
8
|
+
position: "absolute" as const,
|
|
9
|
+
top: 0,
|
|
10
|
+
left: 0,
|
|
11
|
+
right: 0,
|
|
12
|
+
height: height * 0.3,
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const BackgroundGradient = () => {
|
|
16
|
+
return (
|
|
17
|
+
<LinearGradient
|
|
18
|
+
colors={["#2D85B71A", "#2D85B700"]}
|
|
19
|
+
style={GRADIENT_STYLE}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default BackgroundGradient;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import AppColumnView from "@appComponents/appColumnView";
|
|
2
|
+
import AppPressable from "@appComponents/appPressable";
|
|
3
|
+
import AppText from "@appComponents/appText";
|
|
4
|
+
import AppWrapper from "@appComponents/appWrapper";
|
|
5
|
+
import { Colors } from "@theme/colors";
|
|
6
|
+
import { Fonts } from "@theme/fonts";
|
|
7
|
+
import { FallbackProps } from "react-error-boundary";
|
|
8
|
+
|
|
9
|
+
const ErrorFallback = ({ error, resetErrorBoundary }: FallbackProps) => (
|
|
10
|
+
<AppWrapper bgColor={Colors.BG_COLOR}>
|
|
11
|
+
<AppColumnView
|
|
12
|
+
flex={1}
|
|
13
|
+
alignItems="center"
|
|
14
|
+
justifyContent="center"
|
|
15
|
+
paddingHorizontal={24}
|
|
16
|
+
gap={12}
|
|
17
|
+
>
|
|
18
|
+
<AppText size={18} fontFamily={Fonts.SEMI_BOLD} color={Colors.GRAY_5} center>
|
|
19
|
+
Something went wrong
|
|
20
|
+
</AppText>
|
|
21
|
+
<AppText size={13} fontFamily={Fonts.REGULAR} color={Colors.GRAY_4} center>
|
|
22
|
+
{error instanceof Error ? error.message : String(error)}
|
|
23
|
+
</AppText>
|
|
24
|
+
<AppPressable
|
|
25
|
+
marginTop={8}
|
|
26
|
+
paddingHorizontal={20}
|
|
27
|
+
paddingVertical={12}
|
|
28
|
+
borderRadius={12}
|
|
29
|
+
backgroundColor={Colors.PRIMARY}
|
|
30
|
+
onPress={resetErrorBoundary}
|
|
31
|
+
>
|
|
32
|
+
<AppText size={14} fontFamily={Fonts.SEMI_BOLD} color={Colors.WHITE}>
|
|
33
|
+
Try Again
|
|
34
|
+
</AppText>
|
|
35
|
+
</AppPressable>
|
|
36
|
+
</AppColumnView>
|
|
37
|
+
</AppWrapper>
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
export default ErrorFallback;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { FontAwesome6 } from "@expo/vector-icons";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
const IconFontAwesome6 = ({
|
|
5
|
+
name,
|
|
6
|
+
size,
|
|
7
|
+
color,
|
|
8
|
+
}: {
|
|
9
|
+
name: string;
|
|
10
|
+
size: number;
|
|
11
|
+
color: string;
|
|
12
|
+
}) => {
|
|
13
|
+
return (
|
|
14
|
+
<FontAwesome6
|
|
15
|
+
name={name as keyof typeof FontAwesome6.glyphMap}
|
|
16
|
+
size={size}
|
|
17
|
+
color={color}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default IconFontAwesome6;
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { RF } from "@theme/responsive";
|
|
2
|
+
import { Ionicons } from "@expo/vector-icons";
|
|
3
|
+
import React from "react";
|
|
4
|
+
|
|
5
|
+
type GlyphName = keyof typeof Ionicons.glyphMap;
|
|
6
|
+
|
|
7
|
+
const ICON_ALIASES: Record<string, GlyphName> = {
|
|
8
|
+
home: "home",
|
|
9
|
+
teams: "people",
|
|
10
|
+
schedule: "calendar",
|
|
11
|
+
messages: "chatbubbles",
|
|
12
|
+
payments: "card",
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
const IoniconsIcons = ({
|
|
16
|
+
icon,
|
|
17
|
+
color,
|
|
18
|
+
size = 20,
|
|
19
|
+
}: {
|
|
20
|
+
icon: string;
|
|
21
|
+
color?: string;
|
|
22
|
+
size?: number;
|
|
23
|
+
}) => {
|
|
24
|
+
const name: GlyphName =
|
|
25
|
+
ICON_ALIASES[icon] ??
|
|
26
|
+
(icon in Ionicons.glyphMap ? (icon as GlyphName) : "help-circle");
|
|
27
|
+
|
|
28
|
+
return (
|
|
29
|
+
<Ionicons name={name} size={RF(size)} color={color} />
|
|
30
|
+
);
|
|
31
|
+
};
|
|
32
|
+
|
|
33
|
+
export default IoniconsIcons;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { AntDesign } from "@expo/vector-icons";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
const AndDesignIcons = ({
|
|
5
|
+
name,
|
|
6
|
+
size,
|
|
7
|
+
color,
|
|
8
|
+
}: {
|
|
9
|
+
name: string;
|
|
10
|
+
size: number;
|
|
11
|
+
color: string;
|
|
12
|
+
}) => {
|
|
13
|
+
return (
|
|
14
|
+
<AntDesign
|
|
15
|
+
name={name as keyof typeof AntDesign.glyphMap}
|
|
16
|
+
size={size}
|
|
17
|
+
color={color}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default AndDesignIcons;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Feather } from "@expo/vector-icons";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
const FeatherIcons = ({
|
|
5
|
+
name,
|
|
6
|
+
size,
|
|
7
|
+
color,
|
|
8
|
+
}: {
|
|
9
|
+
name: string;
|
|
10
|
+
size: number;
|
|
11
|
+
color: string;
|
|
12
|
+
}) => {
|
|
13
|
+
return (
|
|
14
|
+
<Feather
|
|
15
|
+
name={name as keyof typeof Feather.glyphMap}
|
|
16
|
+
size={size}
|
|
17
|
+
color={color}
|
|
18
|
+
/>
|
|
19
|
+
);
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export default FeatherIcons;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import { MaterialCommunityIcons } from "@expo/vector-icons";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
interface IconMaterialCommunityProps {
|
|
5
|
+
name: string;
|
|
6
|
+
size: number;
|
|
7
|
+
color: string;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
const IconMaterialCommunity = ({
|
|
11
|
+
name,
|
|
12
|
+
size,
|
|
13
|
+
color,
|
|
14
|
+
}: IconMaterialCommunityProps) => {
|
|
15
|
+
return (
|
|
16
|
+
<MaterialCommunityIcons
|
|
17
|
+
name={name as keyof typeof MaterialCommunityIcons.glyphMap}
|
|
18
|
+
size={size}
|
|
19
|
+
color={color}
|
|
20
|
+
/>
|
|
21
|
+
);
|
|
22
|
+
};
|
|
23
|
+
|
|
24
|
+
export default IconMaterialCommunity;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { MaterialIcons } from "@expo/vector-icons";
|
|
2
|
+
import { RF } from "@theme/responsive";
|
|
3
|
+
import React from "react";
|
|
4
|
+
|
|
5
|
+
type GlyphName = keyof typeof MaterialIcons.glyphMap;
|
|
6
|
+
|
|
7
|
+
const MaterialIconss = ({
|
|
8
|
+
icon,
|
|
9
|
+
color,
|
|
10
|
+
size = 20,
|
|
11
|
+
}: {
|
|
12
|
+
icon: string;
|
|
13
|
+
color?: string;
|
|
14
|
+
size?: number;
|
|
15
|
+
}) => {
|
|
16
|
+
const name: GlyphName = (
|
|
17
|
+
icon in MaterialIcons.glyphMap ? icon : "question"
|
|
18
|
+
) as GlyphName;
|
|
19
|
+
|
|
20
|
+
return <MaterialIcons name={name} size={RF(size)} color={color} />;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default MaterialIconss;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import { Octicons } from "@expo/vector-icons";
|
|
2
|
+
import { RF } from "@theme/responsive";
|
|
3
|
+
import React from "react";
|
|
4
|
+
|
|
5
|
+
type GlyphName = keyof typeof Octicons.glyphMap;
|
|
6
|
+
|
|
7
|
+
const OcticonsIcons = ({
|
|
8
|
+
icon,
|
|
9
|
+
color,
|
|
10
|
+
size = 20,
|
|
11
|
+
}: {
|
|
12
|
+
icon: string;
|
|
13
|
+
color?: string;
|
|
14
|
+
size?: number;
|
|
15
|
+
}) => {
|
|
16
|
+
const name: GlyphName = (
|
|
17
|
+
icon in Octicons.glyphMap ? icon : "question"
|
|
18
|
+
) as GlyphName;
|
|
19
|
+
|
|
20
|
+
return <Octicons name={name} size={RF(size)} color={color} />;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
export default OcticonsIcons;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { StyleSheet } from "react-native";
|
|
2
|
+
import { Colors } from "./colors";
|
|
3
|
+
import { RF } from "./responsive";
|
|
4
|
+
|
|
5
|
+
export const AllStyles = StyleSheet.create({
|
|
6
|
+
backdropAbsoluteBlur: {
|
|
7
|
+
...StyleSheet.absoluteFillObject,
|
|
8
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
9
|
+
shadowColor: "#000",
|
|
10
|
+
shadowOffset: { width: 0, height: -2 },
|
|
11
|
+
shadowOpacity: 0.25,
|
|
12
|
+
shadowRadius: 8,
|
|
13
|
+
elevation: 8,
|
|
14
|
+
zIndex: 1,
|
|
15
|
+
},
|
|
16
|
+
shadowBackdrop: {
|
|
17
|
+
...StyleSheet.absoluteFillObject,
|
|
18
|
+
backgroundColor: "rgba(0, 0, 0, 0.5)",
|
|
19
|
+
shadowColor: "#000",
|
|
20
|
+
shadowOffset: { width: 0, height: -2 },
|
|
21
|
+
shadowOpacity: 0.25,
|
|
22
|
+
shadowRadius: 8,
|
|
23
|
+
elevation: 8,
|
|
24
|
+
zIndex: 1,
|
|
25
|
+
},
|
|
26
|
+
modalBorderStyle: {
|
|
27
|
+
borderTopLeftRadius: RF(20),
|
|
28
|
+
borderTopRightRadius: RF(20),
|
|
29
|
+
backgroundColor: Colors.GRAY_1,
|
|
30
|
+
},
|
|
31
|
+
messageListContainer: { gap: RF(16), padding: RF(16) },
|
|
32
|
+
modalBackgroundColor: {
|
|
33
|
+
backgroundColor: Colors.GRAY_1,
|
|
34
|
+
},
|
|
35
|
+
fullWidthButton: {
|
|
36
|
+
width: "100%",
|
|
37
|
+
},
|
|
38
|
+
shadowOffset: { width: 0, height: 2 },
|
|
39
|
+
});
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
export const enum Colors {
|
|
2
|
+
PRIMARY = "#2E5A88",
|
|
3
|
+
PRIMARY_1 = "#436B94",
|
|
4
|
+
PRIMARY_2 = "#587BA0",
|
|
5
|
+
PRIMARY_3 = "#829CB8",
|
|
6
|
+
PRIMARY_4 = "#97ADC4",
|
|
7
|
+
PRIMARY_5 = "#ABBDCF",
|
|
8
|
+
PRIMARY_6 = "#C1CEDC",
|
|
9
|
+
PRIMARY_7 = "#D5DEE7",
|
|
10
|
+
PRIMARY_8 = "#EBEFF4",
|
|
11
|
+
|
|
12
|
+
SECONDARY = "#2D85B7",
|
|
13
|
+
SECONDARY_1 = "#4292BF",
|
|
14
|
+
SECONDARY_2 = "#579DC5",
|
|
15
|
+
SECONDARY_3 = "#6CAACD",
|
|
16
|
+
SECONDARY_4 = "#81B6D4",
|
|
17
|
+
SECONDARY_5 = "#96C2DB",
|
|
18
|
+
SECONDARY_6 = "#ABCEE2",
|
|
19
|
+
SECONDARY_7 = "#C0DBEA",
|
|
20
|
+
SECONDARY_8 = "#D5E7F1",
|
|
21
|
+
SECONDARY_9 = "#EAF3F8",
|
|
22
|
+
|
|
23
|
+
SUCCESS = "#22BB33",
|
|
24
|
+
SUCCESS_10_PERCENT = "#E9F9EB",
|
|
25
|
+
INFO = "#246BFD",
|
|
26
|
+
WARNING = "#BF6A02",
|
|
27
|
+
WARNING_10_PERCENT = "#FEF7EE",
|
|
28
|
+
ERROR = "#BB2124",
|
|
29
|
+
ERROR_10_PERCENT = "#F9E9EA",
|
|
30
|
+
DISABLED = "#AAAAAA",
|
|
31
|
+
DISABLED_BUTTON = "#693EC9",
|
|
32
|
+
NOTIFICATION = "#F75555",
|
|
33
|
+
|
|
34
|
+
PURPLE_TEN_PERCENT = "#F0ECFA",
|
|
35
|
+
PURPLE = "#693EC9",
|
|
36
|
+
|
|
37
|
+
GRAY_10 = "#303030",
|
|
38
|
+
GRAY_9 = "#3C3D3D",
|
|
39
|
+
GRAY_8 = "#444546",
|
|
40
|
+
GRAY_7 = "#4E4F50",
|
|
41
|
+
GRAY_6 = "#5B5D5F",
|
|
42
|
+
GRAY_5 = "#86888A",
|
|
43
|
+
GRAY_4 = "#AEB0B2",
|
|
44
|
+
GRAY_3 = "#D0D1D1",
|
|
45
|
+
GRAY_2 = "#E6E7E7",
|
|
46
|
+
GRAY_1 = "#F5F6F6",
|
|
47
|
+
|
|
48
|
+
WHITE = "#FFFFFF",
|
|
49
|
+
BORDER = "#D1D0D0",
|
|
50
|
+
BLACK = "#1A1A1A",
|
|
51
|
+
|
|
52
|
+
TRANSPARENT = "transparent",
|
|
53
|
+
BG_COLOR = "#FDFDFD",
|
|
54
|
+
}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as Device from "expo-device";
|
|
2
|
+
import { Dimensions, PixelRatio } from "react-native";
|
|
3
|
+
import { RFValue } from "react-native-responsive-fontsize";
|
|
4
|
+
|
|
5
|
+
export const isTablet = Device.deviceType == Device.DeviceType.TABLET;
|
|
6
|
+
const widthPercentageToDP = (widthPercent: any) => {
|
|
7
|
+
const screenWidth = Dimensions.get("window").width;
|
|
8
|
+
const elemWidth = parseFloat(widthPercent);
|
|
9
|
+
return PixelRatio.roundToNearestPixel((screenWidth * elemWidth) / 100);
|
|
10
|
+
};
|
|
11
|
+
const heightPercentageToDP = (heightPercent: any) => {
|
|
12
|
+
const screenHeight = Dimensions.get("window").height;
|
|
13
|
+
const elemHeight = parseFloat(heightPercent);
|
|
14
|
+
return PixelRatio.roundToNearestPixel((screenHeight * elemHeight) / 100);
|
|
15
|
+
};
|
|
16
|
+
const RFView = (value: number) => {
|
|
17
|
+
return RFValue(value * (isTablet ? 0.74 : 0.89));
|
|
18
|
+
};
|
|
19
|
+
const RFTextFont = (value: number) => {
|
|
20
|
+
return RFValue(value * (isTablet ? 0.69 : 0.89));
|
|
21
|
+
};
|
|
22
|
+
export {
|
|
23
|
+
heightPercentageToDP as HP,
|
|
24
|
+
RFView as RF,
|
|
25
|
+
RFTextFont as RFT,
|
|
26
|
+
widthPercentageToDP as WP,
|
|
27
|
+
};
|
package/templates/bottom-sheet/src/ui/appComponents/BottomSheetKeyboardAwareScrollView/index.tsx
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
import {
|
|
2
|
+
SCROLLABLE_TYPE,
|
|
3
|
+
createBottomSheetScrollableComponent,
|
|
4
|
+
type BottomSheetScrollViewMethods,
|
|
5
|
+
} from '@gorhom/bottom-sheet';
|
|
6
|
+
import type { BottomSheetScrollViewProps } from '@gorhom/bottom-sheet/src/components/bottomSheetScrollable/types';
|
|
7
|
+
import React, { memo } from 'react';
|
|
8
|
+
import { DimensionValue, StyleProp, ViewStyle } from 'react-native';
|
|
9
|
+
import {
|
|
10
|
+
KeyboardAwareScrollView,
|
|
11
|
+
KeyboardAwareScrollViewProps,
|
|
12
|
+
} from 'react-native-keyboard-controller';
|
|
13
|
+
import Reanimated from 'react-native-reanimated';
|
|
14
|
+
|
|
15
|
+
const toDim = (v?: number | DimensionValue) =>
|
|
16
|
+
v === undefined
|
|
17
|
+
? undefined
|
|
18
|
+
: typeof v === 'number'
|
|
19
|
+
? (v as DimensionValue)
|
|
20
|
+
: v;
|
|
21
|
+
|
|
22
|
+
type ExtraStyleProps = {
|
|
23
|
+
style?: StyleProp<ViewStyle>;
|
|
24
|
+
contentContainerStyle?: StyleProp<ViewStyle>;
|
|
25
|
+
margin?: number;
|
|
26
|
+
marginTop?: number;
|
|
27
|
+
marginBottom?: number;
|
|
28
|
+
marginLeft?: number;
|
|
29
|
+
marginRight?: number;
|
|
30
|
+
marginHorizontal?: number;
|
|
31
|
+
marginVertical?: number;
|
|
32
|
+
padding?: number;
|
|
33
|
+
paddingTop?: number;
|
|
34
|
+
paddingBottom?: number;
|
|
35
|
+
paddingLeft?: number;
|
|
36
|
+
paddingRight?: number;
|
|
37
|
+
paddingHorizontal?: number;
|
|
38
|
+
paddingVertical?: number;
|
|
39
|
+
gap?: number;
|
|
40
|
+
flex?: number;
|
|
41
|
+
flexGrow?: number;
|
|
42
|
+
flexShrink?: number;
|
|
43
|
+
flexBasis?: number | DimensionValue;
|
|
44
|
+
flexWrap?: 'wrap' | 'nowrap';
|
|
45
|
+
width?: number | DimensionValue;
|
|
46
|
+
height?: number | DimensionValue;
|
|
47
|
+
minHeight?: number | DimensionValue;
|
|
48
|
+
maxHeight?: number | DimensionValue;
|
|
49
|
+
minWidth?: number | DimensionValue;
|
|
50
|
+
maxWidth?: number | DimensionValue;
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
type CombinedProps = BottomSheetScrollViewProps &
|
|
54
|
+
KeyboardAwareScrollViewProps &
|
|
55
|
+
ExtraStyleProps;
|
|
56
|
+
|
|
57
|
+
const AnimatedScrollView =
|
|
58
|
+
Reanimated.createAnimatedComponent<KeyboardAwareScrollViewProps>(
|
|
59
|
+
KeyboardAwareScrollView,
|
|
60
|
+
);
|
|
61
|
+
|
|
62
|
+
const BottomSheetScrollViewComponent = createBottomSheetScrollableComponent<
|
|
63
|
+
BottomSheetScrollViewMethods,
|
|
64
|
+
BottomSheetScrollViewProps
|
|
65
|
+
>(SCROLLABLE_TYPE.SCROLLVIEW, AnimatedScrollView);
|
|
66
|
+
|
|
67
|
+
const BottomSheetKeyboardAwareScrollView = memo(
|
|
68
|
+
({ style, contentContainerStyle, ...rest }: CombinedProps) => {
|
|
69
|
+
const resolvedStyle: ViewStyle = {
|
|
70
|
+
margin: rest.margin,
|
|
71
|
+
marginTop: rest.marginTop,
|
|
72
|
+
marginBottom: rest.marginBottom,
|
|
73
|
+
marginLeft: rest.marginLeft,
|
|
74
|
+
marginRight: rest.marginRight,
|
|
75
|
+
marginHorizontal: rest.marginHorizontal,
|
|
76
|
+
marginVertical: rest.marginVertical,
|
|
77
|
+
padding: rest.padding,
|
|
78
|
+
paddingTop: rest.paddingTop,
|
|
79
|
+
paddingBottom: rest.paddingBottom,
|
|
80
|
+
paddingLeft: rest.paddingLeft,
|
|
81
|
+
paddingRight: rest.paddingRight,
|
|
82
|
+
paddingHorizontal: rest.paddingHorizontal,
|
|
83
|
+
paddingVertical: rest.paddingVertical,
|
|
84
|
+
gap: rest.gap,
|
|
85
|
+
flex: rest.flex,
|
|
86
|
+
flexGrow: rest.flexGrow,
|
|
87
|
+
flexShrink: rest.flexShrink,
|
|
88
|
+
flexBasis: toDim(rest.flexBasis),
|
|
89
|
+
flexWrap: rest.flexWrap,
|
|
90
|
+
width: toDim(rest.width),
|
|
91
|
+
height: toDim(rest.height),
|
|
92
|
+
minHeight: toDim(rest.minHeight),
|
|
93
|
+
maxHeight: toDim(rest.maxHeight),
|
|
94
|
+
minWidth: toDim(rest.minWidth),
|
|
95
|
+
maxWidth: toDim(rest.maxWidth),
|
|
96
|
+
};
|
|
97
|
+
|
|
98
|
+
return (
|
|
99
|
+
<BottomSheetScrollViewComponent
|
|
100
|
+
{...rest}
|
|
101
|
+
style={style}
|
|
102
|
+
contentContainerStyle={[resolvedStyle, contentContainerStyle]}
|
|
103
|
+
/>
|
|
104
|
+
);
|
|
105
|
+
},
|
|
106
|
+
);
|
|
107
|
+
|
|
108
|
+
BottomSheetKeyboardAwareScrollView.displayName =
|
|
109
|
+
'BottomSheetKeyboardAwareScrollView';
|
|
110
|
+
|
|
111
|
+
export default BottomSheetKeyboardAwareScrollView;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { BottomSheetBackdrop } from "@gorhom/bottom-sheet";
|
|
2
|
+
import React from "react";
|
|
3
|
+
|
|
4
|
+
interface IAppButtonSheetBackdrop {
|
|
5
|
+
props: any;
|
|
6
|
+
disappearsOnIndex?: number;
|
|
7
|
+
appearsOnIndex?: number;
|
|
8
|
+
opacity?: number;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
const AppButtonSheetBackdrop = ({
|
|
12
|
+
props,
|
|
13
|
+
disappearsOnIndex = -1,
|
|
14
|
+
appearsOnIndex = 0,
|
|
15
|
+
opacity = 0.8,
|
|
16
|
+
}: IAppButtonSheetBackdrop) => {
|
|
17
|
+
return (
|
|
18
|
+
<BottomSheetBackdrop
|
|
19
|
+
{...props}
|
|
20
|
+
disappearsOnIndex={disappearsOnIndex}
|
|
21
|
+
appearsOnIndex={appearsOnIndex}
|
|
22
|
+
opacity={opacity}
|
|
23
|
+
/>
|
|
24
|
+
);
|
|
25
|
+
};
|
|
26
|
+
|
|
27
|
+
export default AppButtonSheetBackdrop;
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { BottomSheetScrollView } from "@gorhom/bottom-sheet";
|
|
2
|
+
import { RF } from "@theme/responsive";
|
|
3
|
+
import React, { ComponentProps, forwardRef } from "react";
|
|
4
|
+
import { ViewStyle } from "react-native";
|
|
5
|
+
|
|
6
|
+
type BottomSheetScrollViewProps = ComponentProps<typeof BottomSheetScrollView>;
|
|
7
|
+
|
|
8
|
+
interface ExtraStyleProps {
|
|
9
|
+
padding?: number;
|
|
10
|
+
paddingTop?: number;
|
|
11
|
+
paddingBottom?: number;
|
|
12
|
+
paddingLeft?: number;
|
|
13
|
+
paddingRight?: number;
|
|
14
|
+
paddingHorizontal?: number;
|
|
15
|
+
paddingVertical?: number;
|
|
16
|
+
|
|
17
|
+
gap?: number;
|
|
18
|
+
|
|
19
|
+
margin?: number;
|
|
20
|
+
marginTop?: number;
|
|
21
|
+
marginBottom?: number;
|
|
22
|
+
marginLeft?: number;
|
|
23
|
+
marginRight?: number;
|
|
24
|
+
marginHorizontal?: number;
|
|
25
|
+
marginVertical?: number;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export type AppBottomSheetScrollViewProps = BottomSheetScrollViewProps &
|
|
29
|
+
ExtraStyleProps;
|
|
30
|
+
|
|
31
|
+
const AppBottomSheetScrollView = forwardRef<
|
|
32
|
+
React.ComponentRef<typeof BottomSheetScrollView>,
|
|
33
|
+
AppBottomSheetScrollViewProps
|
|
34
|
+
>(
|
|
35
|
+
(
|
|
36
|
+
{
|
|
37
|
+
children,
|
|
38
|
+
style,
|
|
39
|
+
contentContainerStyle,
|
|
40
|
+
padding,
|
|
41
|
+
paddingTop,
|
|
42
|
+
paddingBottom,
|
|
43
|
+
paddingLeft,
|
|
44
|
+
paddingRight,
|
|
45
|
+
paddingHorizontal,
|
|
46
|
+
paddingVertical,
|
|
47
|
+
gap,
|
|
48
|
+
margin,
|
|
49
|
+
marginTop,
|
|
50
|
+
marginBottom,
|
|
51
|
+
marginLeft,
|
|
52
|
+
marginRight,
|
|
53
|
+
marginHorizontal,
|
|
54
|
+
marginVertical,
|
|
55
|
+
...rest
|
|
56
|
+
},
|
|
57
|
+
ref,
|
|
58
|
+
) => {
|
|
59
|
+
const spacingStyle: ViewStyle = {
|
|
60
|
+
padding: padding !== undefined ? RF(padding) : undefined,
|
|
61
|
+
paddingTop: paddingTop !== undefined ? RF(paddingTop) : undefined,
|
|
62
|
+
paddingBottom:
|
|
63
|
+
paddingBottom !== undefined ? RF(paddingBottom) : undefined,
|
|
64
|
+
paddingLeft: paddingLeft !== undefined ? RF(paddingLeft) : undefined,
|
|
65
|
+
paddingRight: paddingRight !== undefined ? RF(paddingRight) : undefined,
|
|
66
|
+
paddingHorizontal:
|
|
67
|
+
paddingHorizontal !== undefined ? RF(paddingHorizontal) : undefined,
|
|
68
|
+
paddingVertical:
|
|
69
|
+
paddingVertical !== undefined ? RF(paddingVertical) : undefined,
|
|
70
|
+
|
|
71
|
+
gap: gap !== undefined ? RF(gap) : undefined,
|
|
72
|
+
|
|
73
|
+
margin: margin !== undefined ? RF(margin) : undefined,
|
|
74
|
+
marginTop: marginTop !== undefined ? RF(marginTop) : undefined,
|
|
75
|
+
marginBottom: marginBottom !== undefined ? RF(marginBottom) : undefined,
|
|
76
|
+
marginLeft: marginLeft !== undefined ? RF(marginLeft) : undefined,
|
|
77
|
+
marginRight: marginRight !== undefined ? RF(marginRight) : undefined,
|
|
78
|
+
marginHorizontal:
|
|
79
|
+
marginHorizontal !== undefined ? RF(marginHorizontal) : undefined,
|
|
80
|
+
marginVertical:
|
|
81
|
+
marginVertical !== undefined ? RF(marginVertical) : undefined,
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
return (
|
|
85
|
+
<BottomSheetScrollView
|
|
86
|
+
ref={ref}
|
|
87
|
+
style={style}
|
|
88
|
+
contentContainerStyle={[spacingStyle, contentContainerStyle]}
|
|
89
|
+
{...rest}
|
|
90
|
+
>
|
|
91
|
+
{children}
|
|
92
|
+
</BottomSheetScrollView>
|
|
93
|
+
);
|
|
94
|
+
},
|
|
95
|
+
);
|
|
96
|
+
|
|
97
|
+
AppBottomSheetScrollView.displayName = "AppBottomSheetScrollView";
|
|
98
|
+
|
|
99
|
+
export default AppBottomSheetScrollView;
|