related-ui-components 2.4.7 → 2.4.9

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.
Files changed (54) hide show
  1. package/lib/module/app.js +86 -121
  2. package/lib/module/app.js.map +1 -1
  3. package/lib/module/components/Input/PhoneInput.js +178 -0
  4. package/lib/module/components/Input/PhoneInput.js.map +1 -0
  5. package/lib/module/components/Input/index.js +2 -0
  6. package/lib/module/components/Input/index.js.map +1 -1
  7. package/lib/module/components/Skeleton/Shimmer.js +1 -1
  8. package/lib/module/components/Skeleton/Shimmer.js.map +1 -1
  9. package/lib/module/contexts/BottomSheetStackContext.js +12 -0
  10. package/lib/module/contexts/BottomSheetStackContext.js.map +1 -0
  11. package/lib/module/contexts/BottomSheetStackProvider.js +111 -0
  12. package/lib/module/contexts/BottomSheetStackProvider.js.map +1 -0
  13. package/lib/module/contexts/index.js +2 -2
  14. package/lib/module/contexts/index.js.map +1 -1
  15. package/lib/module/theme/Colors.js +4 -2
  16. package/lib/module/theme/Colors.js.map +1 -1
  17. package/lib/module/utils/flags.js +6 -0
  18. package/lib/module/utils/flags.js.map +1 -0
  19. package/lib/typescript/src/app.d.ts +3 -1
  20. package/lib/typescript/src/app.d.ts.map +1 -1
  21. package/lib/typescript/src/components/Input/PhoneInput.d.ts +22 -0
  22. package/lib/typescript/src/components/Input/PhoneInput.d.ts.map +1 -0
  23. package/lib/typescript/src/components/Input/index.d.ts +2 -0
  24. package/lib/typescript/src/components/Input/index.d.ts.map +1 -1
  25. package/lib/typescript/src/contexts/BottomSheetStackContext.d.ts +16 -0
  26. package/lib/typescript/src/contexts/BottomSheetStackContext.d.ts.map +1 -0
  27. package/lib/typescript/src/contexts/BottomSheetStackProvider.d.ts +5 -0
  28. package/lib/typescript/src/contexts/BottomSheetStackProvider.d.ts.map +1 -0
  29. package/lib/typescript/src/contexts/index.d.ts +2 -2
  30. package/lib/typescript/src/contexts/index.d.ts.map +1 -1
  31. package/lib/typescript/src/theme/Colors.d.ts +1 -0
  32. package/lib/typescript/src/theme/Colors.d.ts.map +1 -1
  33. package/lib/typescript/src/utils/flags.d.ts +2 -0
  34. package/lib/typescript/src/utils/flags.d.ts.map +1 -0
  35. package/package.json +4 -1
  36. package/src/app.tsx +134 -116
  37. package/src/components/Input/PhoneInput.tsx +214 -0
  38. package/src/components/Input/index.ts +4 -1
  39. package/src/components/Skeleton/Shimmer.tsx +1 -1
  40. package/src/contexts/BottomSheetStackContext.tsx +30 -0
  41. package/src/contexts/BottomSheetStackProvider.tsx +138 -0
  42. package/src/contexts/index.ts +2 -2
  43. package/src/theme/Colors.ts +5 -2
  44. package/src/utils/flags.ts +7 -0
  45. package/lib/module/contexts/BottomSheetContext.js +0 -13
  46. package/lib/module/contexts/BottomSheetContext.js.map +0 -1
  47. package/lib/module/contexts/BottomSheetProvider.js +0 -104
  48. package/lib/module/contexts/BottomSheetProvider.js.map +0 -1
  49. package/lib/typescript/src/contexts/BottomSheetContext.d.ts +0 -10
  50. package/lib/typescript/src/contexts/BottomSheetContext.d.ts.map +0 -1
  51. package/lib/typescript/src/contexts/BottomSheetProvider.d.ts +0 -7
  52. package/lib/typescript/src/contexts/BottomSheetProvider.d.ts.map +0 -1
  53. package/src/contexts/BottomSheetContext.tsx +0 -28
  54. package/src/contexts/BottomSheetProvider.tsx +0 -136
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+
3
+ export function iso2ToFlagEmoji(countryCode) {
4
+ return countryCode.toUpperCase().split('').map(ch => String.fromCodePoint(ch.charCodeAt(0) + 127397)).join('');
5
+ }
6
+ //# sourceMappingURL=flags.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["iso2ToFlagEmoji","countryCode","toUpperCase","split","map","ch","String","fromCodePoint","charCodeAt","join"],"sourceRoot":"..\\..\\..\\src","sources":["utils/flags.ts"],"mappings":";;AAAA,OAAO,SAASA,eAAeA,CAACC,WAAmB,EAAU;EAC3D,OAAOA,WAAW,CACfC,WAAW,CAAC,CAAC,CACbC,KAAK,CAAC,EAAE,CAAC,CACTC,GAAG,CAACC,EAAE,IAAIC,MAAM,CAACC,aAAa,CAACF,EAAE,CAACG,UAAU,CAAC,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC,CAC1DC,IAAI,CAAC,EAAE,CAAC;AACb","ignoreList":[]}
@@ -1,2 +1,4 @@
1
- export {};
1
+ import React from "react";
2
+ declare const App: () => React.JSX.Element;
3
+ export default App;
2
4
  //# sourceMappingURL=app.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/app.tsx"],"names":[],"mappings":""}
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../../../src/app.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAmB,MAAM,OAAO,CAAC;AAqDxC,QAAA,MAAM,GAAG,yBA4ER,CAAC;AAUF,eAAe,GAAG,CAAC"}
@@ -0,0 +1,22 @@
1
+ import React from "react";
2
+ import { TextInput, StyleProp, TextStyle } from "react-native";
3
+ import { CustomInputProps } from "./Input";
4
+ export type Country = {
5
+ code: string;
6
+ iso2: string;
7
+ name: string;
8
+ };
9
+ export interface PhoneInputProps extends Omit<CustomInputProps, "leftIcon" | "rightIcon" | "onRightIconPress" | "keyboardType" | "style" | "placeholderTextColor"> {
10
+ value: string;
11
+ onChangeText: (text: string) => void;
12
+ selectedCountry?: Country;
13
+ onSelectCountry?: (c: Country) => void;
14
+ countries?: Country[];
15
+ countryNameStyle?: StyleProp<TextStyle>;
16
+ countryCodeStyle?: StyleProp<TextStyle>;
17
+ listTitleStyle?: StyleProp<TextStyle>;
18
+ listTitle?: string;
19
+ }
20
+ declare const PhoneInput: React.ForwardRefExoticComponent<PhoneInputProps & React.RefAttributes<TextInput>>;
21
+ export default PhoneInput;
22
+ //# sourceMappingURL=PhoneInput.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"PhoneInput.d.ts","sourceRoot":"","sources":["../../../../../src/components/Input/PhoneInput.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAqD,MAAM,OAAO,CAAC;AAC1E,OAAO,EACL,SAAS,EAOT,SAAS,EACT,SAAS,EACV,MAAM,cAAc,CAAC;AACtB,OAAoB,EAAE,gBAAgB,EAAE,MAAM,SAAS,CAAC;AASxD,MAAM,MAAM,OAAO,GAAG;IACpB,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,WAAW,eACf,SAAQ,IAAI,CACV,gBAAgB,EACd,UAAU,GACV,WAAW,GACX,kBAAkB,GAClB,cAAc,GACd,OAAO,GACP,sBAAsB,CACzB;IACD,KAAK,EAAE,MAAM,CAAC;IACd,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,eAAe,CAAC,EAAE,OAAO,CAAC;IAC1B,eAAe,CAAC,EAAE,CAAC,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,SAAS,CAAC,EAAE,OAAO,EAAE,CAAC;IAGtB,gBAAgB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACxC,gBAAgB,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IACxC,cAAc,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAEtC,SAAS,CAAC,EAAE,MAAM,CAAA;CACnB;AAQD,QAAA,MAAM,UAAU,mFAiHf,CAAC;AA2CF,eAAe,UAAU,CAAC"}
@@ -1,3 +1,5 @@
1
1
  export { default as Input } from "./Input";
2
2
  export * from "./Input";
3
+ export { default as PhoneInput } from "./PhoneInput";
4
+ export * from "./PhoneInput";
3
5
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAC,MAAM,SAAS,CAAC;AAC1C,cAAc,SAAS,CAAC"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/components/Input/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,KAAK,EAAC,MAAM,SAAS,CAAC;AAC1C,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,OAAO,IAAI,UAAU,EAAC,MAAM,cAAc,CAAC;AACpD,cAAc,cAAc,CAAC"}
@@ -0,0 +1,16 @@
1
+ import React, { ReactNode } from "react";
2
+ export interface BottomSheetStackItem {
3
+ component: ReactNode;
4
+ snapPoints?: string[] | number[];
5
+ initialSnapIndex?: number;
6
+ }
7
+ export interface BottomSheetStackContextType {
8
+ push: (item: BottomSheetStackItem) => void;
9
+ pop: () => void;
10
+ replace: (item: BottomSheetStackItem) => void;
11
+ clear: () => void;
12
+ canGoBack: boolean;
13
+ }
14
+ export declare const BottomSheetStackContext: React.Context<BottomSheetStackContextType | null>;
15
+ export declare const useBottomSheetStack: () => BottomSheetStackContextType;
16
+ //# sourceMappingURL=BottomSheetStackContext.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetStackContext.d.ts","sourceRoot":"","sources":["../../../../src/contexts/BottomSheetStackContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,EAAE,SAAS,EAAc,MAAM,OAAO,CAAC;AAErD,MAAM,WAAW,oBAAoB;IACnC,SAAS,EAAE,SAAS,CAAC;IACrB,UAAU,CAAC,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAAC;IACjC,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B;AAED,MAAM,WAAW,2BAA2B;IAC1C,IAAI,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC3C,GAAG,EAAE,MAAM,IAAI,CAAC;IAChB,OAAO,EAAE,CAAC,IAAI,EAAE,oBAAoB,KAAK,IAAI,CAAC;IAC9C,KAAK,EAAE,MAAM,IAAI,CAAC;IAClB,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,eAAO,MAAM,uBAAuB,mDAC2B,CAAC;AAEhE,eAAO,MAAM,mBAAmB,mCAU/B,CAAC"}
@@ -0,0 +1,5 @@
1
+ import React, { ReactNode } from "react";
2
+ export declare const BottomSheetStackProvider: React.FC<{
3
+ children: ReactNode;
4
+ }>;
5
+ //# sourceMappingURL=BottomSheetStackProvider.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"BottomSheetStackProvider.d.ts","sourceRoot":"","sources":["../../../../src/contexts/BottomSheetStackProvider.tsx"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,EACZ,SAAS,EAMV,MAAM,OAAO,CAAC;AASf,eAAO,MAAM,wBAAwB,EAAE,KAAK,CAAC,EAAE,CAAC;IAAE,QAAQ,EAAE,SAAS,CAAA;CAAE,CA0GtE,CAAC"}
@@ -1,3 +1,3 @@
1
- export * from "./BottomSheetContext";
2
- export * from "./BottomSheetProvider";
1
+ export * from "./BottomSheetStackContext";
2
+ export * from "./BottomSheetStackProvider";
3
3
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,sBAAsB,CAAA;AACpC,cAAc,uBAAuB,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/contexts/index.ts"],"names":[],"mappings":"AAAA,cAAc,2BAA2B,CAAA;AACzC,cAAc,4BAA4B,CAAA"}
@@ -42,6 +42,7 @@ export interface ThemeType {
42
42
  };
43
43
  skeletonBackgroundColor?: string;
44
44
  skeletonItemColor?: string;
45
+ skeletonShimmer?: string;
45
46
  }
46
47
  export declare const lightTheme: ThemeType;
47
48
  export declare const darkTheme: ThemeType;
@@ -1 +1 @@
1
- {"version":3,"file":"Colors.d.ts","sourceRoot":"","sources":["../../../../src/theme/Colors.ts"],"names":[],"mappings":"AACA,MAA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V,CAAC,EAAE,MAAM,CAAC;QACV,CAAC,EAAE,MAAM,CAAC;QACV,EAAE,EAAE,MAAM,CAAC;QACX,GAAG,EAAE,MAAM,CAAC;KACb,CAAA;IAED,SAAS,CAAC,EAAE;QACV,OAAO,CAAC,EAAE,MAAM,EAAE,CAAC;QACnB,SAAS,CAAC,EAAE,MAAM,EAAE,CAAC;QACrB,CAAC,GAAG,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAC;KACrC,CAAC;IACF,uBAAuB,CAAC,EAAG,MAAM,CAAC;IAClC,iBAAiB,CAAC,EAAE,MAAM,CAAC;IAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;CAC1B;AAGD,eAAO,MAAM,UAAU,EAAE,SAmDxB,CAAC;AAGF,eAAO,MAAM,SAAS,EAAE,SAmDvB,CAAC"}
@@ -0,0 +1,2 @@
1
+ export declare function iso2ToFlagEmoji(countryCode: string): string;
2
+ //# sourceMappingURL=flags.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"flags.d.ts","sourceRoot":"","sources":["../../../../src/utils/flags.ts"],"names":[],"mappings":"AAAA,wBAAgB,eAAe,CAAC,WAAW,EAAE,MAAM,GAAG,MAAM,CAM3D"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "related-ui-components",
3
- "version": "2.4.7",
3
+ "version": "2.4.9",
4
4
  "main": "./src/index.ts",
5
5
  "scripts": {
6
6
  "start": "expo start",
@@ -16,6 +16,7 @@
16
16
  "@react-native-community/slider": "4.5.6",
17
17
  "@react-native-picker/picker": "2.11.0",
18
18
  "@shopify/react-native-skia": "v2.0.0-next.4",
19
+ "country-telephone-data": "^0.6.3",
19
20
  "date-fns": "^4.1.0",
20
21
  "expo": "~53.0.9",
21
22
  "expo-blur": "~14.1.4",
@@ -31,10 +32,12 @@
31
32
  "react-native-picker-select": "^9.3.1",
32
33
  "react-native-qrcode-svg": "^6.3.15",
33
34
  "react-native-reanimated": "~3.17.4",
35
+ "react-native-safe-area-context": "^5.4.1",
34
36
  "react-native-svg": "15.11.2"
35
37
  },
36
38
  "devDependencies": {
37
39
  "@babel/core": "^7.25.2",
40
+ "@types/country-telephone-data": "^0.6.3",
38
41
  "@types/react": "~19.0.10",
39
42
  "react-native-builder-bob": "^0.40.11",
40
43
  "typescript": "~5.8.3"
package/src/app.tsx CHANGED
@@ -1,122 +1,140 @@
1
- // import React, { useState } from "react";
2
- // import { SafeAreaView, StyleSheet, StatusBar } from "react-native";
3
- // import CarouselCardStack from "./components/CarouselCardStack/CarouselCardStack"; // Adjust path as needed
4
- // import { GestureHandlerRootView } from "react-native-gesture-handler";
5
- // import { CarRentalForm, DateRangePicker, FlightForm, FlightSummary, HotelForm, HotelSummary, Filters} from "./components";
6
- // import { lightTheme, RelatedProvider, useTheme } from "./theme";
7
- // import CircularProgressBar from "./components/ProgressBar/CircularProgressBar";
1
+ import React, { useState } from "react";
2
+ import { SafeAreaView, StyleSheet, StatusBar } from "react-native";
3
+ import CarouselCardStack from "./components/CarouselCardStack/CarouselCardStack"; // Adjust path as needed
4
+ import { GestureHandlerRootView } from "react-native-gesture-handler";
5
+ import {
6
+ CarRentalForm,
7
+ DateRangePicker,
8
+ FlightForm,
9
+ FlightSummary,
10
+ HotelForm,
11
+ HotelSummary,
12
+ Filters,
13
+ } from "./components";
14
+ import { lightTheme, RelatedProvider, useTheme } from "./theme";
15
+ import CircularProgressBar from "./components/ProgressBar/CircularProgressBar";
16
+ import PhoneInput from "./components/Input/PhoneInput";
17
+ import { BottomSheetStackProvider } from "./contexts";
18
+ import { SafeAreaProvider } from "react-native-safe-area-context";
8
19
 
9
- // // Sample data - replace with your actual image URLs
10
- // const DUMMY_DATA = [
11
- // {
12
- // id: "1",
13
- // image:
14
- // "https://images.pexels.com/photos/3354648/pexels-photo-3354648.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1",
15
- // title: "Mountain Lake",
16
- // },
17
- // // {
18
- // // id: "2",
19
- // // image:
20
- // // "https://images.pexels.com/photos/163273/sunrise-speedboat-ocean-water-163273.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1",
21
- // // title: "Sunset Cruise",
22
- // // },
23
- // {
24
- // id: "3",
25
- // image:
26
- // "https://images.pexels.com/photos/1430677/pexels-photo-1430677.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1",
27
- // title: "Ocean Horizon",
28
- // },
29
- // {
30
- // id: "4",
31
- // image:
32
- // "https://images.pexels.com/photos/2387793/pexels-photo-2387793.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1",
33
- // title: "Forest Trail",
34
- // },
35
- // // {
36
- // // id: "5",
37
- // // image:
38
- // // "https://images.pexels.com/photos/302804/pexels-photo-302804.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1",
39
- // // title: "City Lights",
40
- // // },
41
- // ];
20
+ // Sample data - replace with your actual image URLs
21
+ const DUMMY_DATA = [
22
+ {
23
+ id: "1",
24
+ image:
25
+ "https://images.pexels.com/photos/3354648/pexels-photo-3354648.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1",
26
+ title: "Mountain Lake",
27
+ },
28
+ // {
29
+ // id: "2",
30
+ // image:
31
+ // "https://images.pexels.com/photos/163273/sunrise-speedboat-ocean-water-163273.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1",
32
+ // title: "Sunset Cruise",
33
+ // },
34
+ {
35
+ id: "3",
36
+ image:
37
+ "https://images.pexels.com/photos/1430677/pexels-photo-1430677.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1",
38
+ title: "Ocean Horizon",
39
+ },
40
+ {
41
+ id: "4",
42
+ image:
43
+ "https://images.pexels.com/photos/2387793/pexels-photo-2387793.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1",
44
+ title: "Forest Trail",
45
+ },
46
+ // {
47
+ // id: "5",
48
+ // image:
49
+ // "https://images.pexels.com/photos/302804/pexels-photo-302804.jpeg?auto=compress&cs=tinysrgb&w=1260&h=750&dpr=1",
50
+ // title: "City Lights",
51
+ // },
52
+ ];
42
53
 
43
- // const App = () => {
44
- // const { theme } = useTheme();
54
+ const App = () => {
55
+ const { theme } = useTheme();
45
56
 
46
- // const [departureDate, setDepartureDate] = useState<string | undefined>(undefined);
47
- // const [returnDate, setReturnDate] = useState<string | undefined>(undefined);
57
+ const [departureDate, setDepartureDate] = useState<string | undefined>(
58
+ undefined
59
+ );
60
+ const [returnDate, setReturnDate] = useState<string | undefined>(undefined);
48
61
 
49
- // const [progress, setProgress] = useState(25);
50
- // const handleAnimate = () => {
51
- // // Set progress to a new random value between 0 and 100
52
- // const newProgress = Math.floor(Math.random() * 101);
53
- // setProgress(newProgress);
54
- // };
55
- // return (
56
- // <>
57
- // <RelatedProvider theme={lightTheme}>
58
- // <GestureHandlerRootView style={{ flex: 1 }}>
59
- // <StatusBar barStyle="light-content" />
60
- // <SafeAreaView style={styles.appContainer}>
61
- // <CircularProgressBar
62
- // progress={5}
63
- // lineCap="round"
64
- // textFont={""}
65
- // />
66
- // {/* <DateRangePicker
67
- // onDatesChange={(t) => {
68
- // setDepartureDate(t.departure);
69
- // setReturnDate(t.return);
70
- // }}
71
- // departureDate={departureDate}
72
- // // departureDisplayValue={departureDate}
73
- // returnDate={returnDate}
74
- // // returnDisplayValue={returnDate}
75
- // ></DateRangePicker> */}
76
- // {/* <Filters
77
- // bottomSheetBackgroundStyle={{
78
- // borderTopRightRadius: 30,
79
- // borderTopLeftRadius: 30,
80
- // padding: 10,
81
- // backgroundColor: "white",
82
- // }}
83
- // containerStyle={{
84
- // backgroundColor: "white",
85
- // borderTopRightRadius: 60,
86
- // borderTopLeftRadius: 60,
87
- // }}
88
- // resetTextStyle={{ color: theme.primary }}
89
- // sectionTitleStyle={{ color: "black" }}
90
- // titleStyle={{ color: "black" }}
91
- // onActionButtonPress={(result) => {
92
- // // setFiltersResult(result);
93
- // }}
94
- // sortOptions={[{ id: 1, name: "test", value: "test" }]}
95
- // // onClose={() => setDisplayFilters(false)}
96
- // applyButtonStyle={{ borderRadius: 8, backgroundColor: "black" }}
97
- // applyButtonTextStyle={{ color: theme.secondary }}
98
- // headerStyle={{ borderBottomWidth: 0 }}
99
- // ></Filters> */}
100
- // {/* <FlightSummary></FlightSummary> */}
101
- // {/* <FlightForm></FlightForm> */}
102
- // {/* <HotelSummary></HotelSummary> */}
103
- // {/* <HotelForm></HotelForm> */}
104
- // {/* <DateRangePicker onDatesChange={()=>{}} labelContainerStyle={{backgroundColor:"red"}}></DateRangePicker> */}
105
- // {/* <CarRentalForm onSelectionChange={console.log}></CarRentalForm> */}
106
- // <CarouselCardStack data={DUMMY_DATA} />
107
- // </SafeAreaView>
108
- // </GestureHandlerRootView>
109
- // </RelatedProvider>
110
- // </>
111
- // );
112
- // };
62
+ const [progress, setProgress] = useState(25);
63
+ const handleAnimate = () => {
64
+ // Set progress to a new random value between 0 and 100
65
+ const newProgress = Math.floor(Math.random() * 101);
66
+ setProgress(newProgress);
67
+ };
68
+ return (
69
+ <>
70
+ <SafeAreaProvider>
71
+ <GestureHandlerRootView style={{ flex: 1 }}>
72
+ <RelatedProvider theme={lightTheme}>
73
+ <BottomSheetStackProvider>
74
+ <StatusBar barStyle="light-content" />
75
+ <SafeAreaView style={styles.appContainer}>
76
+ {/* <CircularProgressBar
77
+ progress={5}
78
+ lineCap="round"
79
+ textFont={""}
80
+ /> */}
81
+ {/* <DateRangePicker
82
+ onDatesChange={(t) => {
83
+ setDepartureDate(t.departure);
84
+ setReturnDate(t.return);
85
+ }}
86
+ departureDate={departureDate}
87
+ // departureDisplayValue={departureDate}
88
+ returnDate={returnDate}
89
+ // returnDisplayValue={returnDate}
90
+ ></DateRangePicker> */}
91
+ {/* <Filters
92
+ bottomSheetBackgroundStyle={{
93
+ borderTopRightRadius: 30,
94
+ borderTopLeftRadius: 30,
95
+ padding: 10,
96
+ backgroundColor: "white",
97
+ }}
98
+ containerStyle={{
99
+ backgroundColor: "white",
100
+ borderTopRightRadius: 60,
101
+ borderTopLeftRadius: 60,
102
+ }}
103
+ resetTextStyle={{ color: theme.primary }}
104
+ sectionTitleStyle={{ color: "black" }}
105
+ titleStyle={{ color: "black" }}
106
+ onActionButtonPress={(result) => {
107
+ // setFiltersResult(result);
108
+ }}
109
+ sortOptions={[{ id: 1, name: "test", value: "test" }]}
110
+ // onClose={() => setDisplayFilters(false)}
111
+ applyButtonStyle={{ borderRadius: 8, backgroundColor: "black" }}
112
+ applyButtonTextStyle={{ color: theme.secondary }}
113
+ headerStyle={{ borderBottomWidth: 0 }}
114
+ ></Filters> */}
115
+ {/* <FlightSummary></FlightSummary> */}
116
+ {/* <FlightForm></FlightForm> */}
117
+ {/* <HotelSummary></HotelSummary> */}
118
+ {/* <HotelForm></HotelForm> */}
119
+ {/* <DateRangePicker onDatesChange={()=>{}} labelContainerStyle={{backgroundColor:"red"}}></DateRangePicker> */}
120
+ {/* <CarRentalForm onSelectionChange={console.log}></CarRentalForm> */}
121
+ {/* <CarouselCardStack data={DUMMY_DATA} /> */}
122
+ <PhoneInput value="" onChangeText={() => {}} inputContainerStyle={{height: 55}}></PhoneInput>
123
+ </SafeAreaView>
124
+ </BottomSheetStackProvider>
125
+ </RelatedProvider>
126
+ </GestureHandlerRootView>
127
+ </SafeAreaProvider>
128
+ </>
129
+ );
130
+ };
113
131
 
114
- // const styles = StyleSheet.create({
115
- // appContainer: {
116
- // flex: 1,
117
- // backgroundColor: "#212121", // Match carousel background or choose another
118
- // justifyContent: "center", // Center the carousel vertically if it's the main content
119
- // },
120
- // });
132
+ const styles = StyleSheet.create({
133
+ appContainer: {
134
+ flex: 1,
135
+ backgroundColor: "#212121", // Match carousel background or choose another
136
+ justifyContent: "center", // Center the carousel vertically if it's the main content
137
+ },
138
+ });
121
139
 
122
- // export default App;
140
+ export default App;
@@ -0,0 +1,214 @@
1
+ import React, { forwardRef, useState, useMemo, useCallback } from "react";
2
+ import {
3
+ TextInput,
4
+ Text,
5
+ View,
6
+ TouchableOpacity,
7
+ StyleSheet,
8
+ FlatList,
9
+ TextInputProps,
10
+ StyleProp,
11
+ TextStyle,
12
+ } from "react-native";
13
+ import CustomInput, { CustomInputProps } from "./Input";
14
+ import { useTheme } from "../../theme";
15
+ import { Popup } from "../Popup";
16
+ import { Ionicons } from "@expo/vector-icons";
17
+ import { useBottomSheetStack } from "../../contexts";
18
+ import { BottomSheetFlatList } from "@gorhom/bottom-sheet";
19
+ import { allCountries } from 'country-telephone-data';
20
+ import { iso2ToFlagEmoji } from "../../utils/flags";
21
+
22
+ export type Country = {
23
+ code: string;
24
+ iso2: string;
25
+ name: string;
26
+ };
27
+
28
+ export interface PhoneInputProps
29
+ extends Omit<
30
+ CustomInputProps,
31
+ | "leftIcon"
32
+ | "rightIcon"
33
+ | "onRightIconPress"
34
+ | "keyboardType"
35
+ | "style"
36
+ | "placeholderTextColor"
37
+ > {
38
+ value: string;
39
+ onChangeText: (text: string) => void;
40
+ selectedCountry?: Country;
41
+ onSelectCountry?: (c: Country) => void;
42
+ countries?: Country[];
43
+
44
+ //styles
45
+ countryNameStyle?: StyleProp<TextStyle>;
46
+ countryCodeStyle?: StyleProp<TextStyle>;
47
+ listTitleStyle?: StyleProp<TextStyle>;
48
+
49
+ listTitle?: string
50
+ }
51
+
52
+ const DEFAULT_COUNTRIES: Country[] = allCountries.map(c => ({
53
+ code: `+${c.dialCode}`,
54
+ iso2: c.iso2,
55
+ name: c.name,
56
+ }));
57
+
58
+ const PhoneInput = forwardRef<TextInput, PhoneInputProps>(
59
+ (
60
+ {
61
+ value,
62
+ onChangeText,
63
+ selectedCountry,
64
+ onSelectCountry,
65
+ countries = DEFAULT_COUNTRIES,
66
+ containerStyle,
67
+ inputContainerStyle,
68
+ inputStyle,
69
+ label,
70
+ labelStyle,
71
+ error,
72
+ errorStyle,
73
+ helper,
74
+ helperStyle,
75
+ listTitle = "Select Country",
76
+ listTitleStyle,
77
+ countryCodeStyle,
78
+ countryNameStyle,
79
+ ...rest
80
+ },
81
+ ref
82
+ ) => {
83
+ const { theme } = useTheme();
84
+ const { push } = useBottomSheetStack();
85
+
86
+ const sel = useMemo(
87
+ () =>
88
+ selectedCountry ||
89
+ countries.find((c) => c.code === "+1") ||
90
+ countries[0],
91
+ [selectedCountry, countries]
92
+ );
93
+
94
+ const handleCountryPress = useCallback(
95
+ (c: Country) => {
96
+ onSelectCountry && onSelectCountry(c);
97
+ },
98
+ [onSelectCountry]
99
+ );
100
+
101
+ const renderCountry = ({ item }: { item: Country }) => (
102
+ <TouchableOpacity
103
+ style={styles.countryRow}
104
+ onPress={() => handleCountryPress(item)}
105
+ >
106
+ <Text style={styles.flag}> {iso2ToFlagEmoji(item.iso2)}</Text>
107
+ <View style={styles.countryText}>
108
+ <Text style={[styles.countryName, countryNameStyle]}>{item.name}</Text>
109
+ <Text style={[styles.countryCode, countryCodeStyle]}>{item.code}</Text>
110
+ </View>
111
+ </TouchableOpacity>
112
+ );
113
+
114
+ const leftIcon = (
115
+ <TouchableOpacity
116
+ style={[styles.selector, { backgroundColor: theme.inputBackground }]}
117
+ hitSlop={{left: 30, top: 30, right: 30, bottom: 30}}
118
+ onPress={() =>
119
+ push({
120
+ component: (
121
+ <View style={styles.popup}>
122
+ <Text style={[styles.popupTitle, listTitleStyle, { color: theme.text }]}>
123
+ {listTitle}
124
+ </Text>
125
+ <BottomSheetFlatList
126
+ data={countries}
127
+ keyExtractor={(c, i) => i.toString()}
128
+ renderItem={renderCountry}
129
+ contentContainerStyle={{ paddingBottom: 16 }}
130
+ />
131
+ </View>
132
+ ),
133
+ snapPoints: ["100%"]
134
+ })
135
+ }
136
+ activeOpacity={0.8}
137
+ >
138
+ <Text style={[styles.flag, { color: theme.inputText }]}>
139
+ {iso2ToFlagEmoji(sel.iso2)}
140
+ </Text>
141
+ <Text style={[styles.code, { color: theme.inputText }]}>
142
+ {sel.code}
143
+ </Text>
144
+ <Ionicons name="chevron-down" size={16} style={{marginHorizontal: 4}}></Ionicons>
145
+ </TouchableOpacity>
146
+ );
147
+
148
+ return (
149
+ <>
150
+ <CustomInput
151
+ ref={ref}
152
+ label={label}
153
+ value={value}
154
+ onChangeText={onChangeText}
155
+ keyboardType="phone-pad"
156
+ placeholder="123 456 7890"
157
+ leftIcon={leftIcon}
158
+ containerStyle={containerStyle}
159
+ inputContainerStyle={inputContainerStyle}
160
+ inputStyle={inputStyle}
161
+ labelStyle={labelStyle}
162
+ error={error}
163
+ errorStyle={errorStyle}
164
+ helper={helper}
165
+ helperStyle={helperStyle}
166
+ {...rest}
167
+ />
168
+ </>
169
+ );
170
+ }
171
+ );
172
+
173
+ const styles = StyleSheet.create({
174
+ selector: {
175
+ flexDirection: "row",
176
+ alignItems: "center",
177
+ borderRightWidth: 1,
178
+ borderRightColor: "grey"
179
+ },
180
+ flag: {
181
+ fontSize: 18,
182
+ },
183
+ code: {
184
+ fontSize: 14,
185
+ marginLeft: 4,
186
+ },
187
+ popup: {
188
+ // maxHeight: 400,
189
+ width: "100%",
190
+ padding: 16,
191
+ },
192
+ popupTitle: {
193
+ fontSize: 18,
194
+ fontWeight: "600",
195
+ marginBottom: 12,
196
+ },
197
+ countryRow: {
198
+ flexDirection: "row",
199
+ alignItems: "center",
200
+ paddingVertical: 10,
201
+ },
202
+ countryText: {
203
+ marginLeft: 12,
204
+ },
205
+ countryName: {
206
+ fontSize: 16,
207
+ },
208
+ countryCode: {
209
+ fontSize: 14,
210
+ color: "#666",
211
+ },
212
+ });
213
+
214
+ export default PhoneInput;
@@ -1,2 +1,5 @@
1
1
  export { default as Input} from "./Input";
2
- export * from "./Input";
2
+ export * from "./Input";
3
+
4
+ export { default as PhoneInput} from "./PhoneInput";
5
+ export * from "./PhoneInput";