@admin-layout/gluestack-ui-mobile 10.0.9-alpha.9 → 10.1.1-alpha.8

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 (170) hide show
  1. package/CHANGELOG.md +2 -6
  2. package/lib/components/ui/accordion/index.web.d.ts +209 -0
  3. package/lib/components/ui/accordion/index.web.js +156 -0
  4. package/lib/components/ui/accordion/index.web.js.map +1 -0
  5. package/lib/components/ui/actionsheet/index.web.d.ts +872 -0
  6. package/lib/components/ui/actionsheet/index.web.js +286 -0
  7. package/lib/components/ui/actionsheet/index.web.js.map +1 -0
  8. package/lib/components/ui/alert/index.web.d.ts +135 -0
  9. package/lib/components/ui/alert/index.web.js +38 -0
  10. package/lib/components/ui/alert/index.web.js.map +1 -0
  11. package/lib/components/ui/alert-dialog/index.web.d.ts +64 -0
  12. package/lib/components/ui/alert-dialog/index.web.js +139 -0
  13. package/lib/components/ui/alert-dialog/index.web.js.map +1 -0
  14. package/lib/components/ui/avatar/index.web.d.ts +21 -0
  15. package/lib/components/ui/avatar/index.web.js +92 -0
  16. package/lib/components/ui/avatar/index.web.js.map +1 -0
  17. package/lib/components/ui/badge/index.web.d.ts +382 -0
  18. package/lib/components/ui/badge/index.web.js +138 -0
  19. package/lib/components/ui/badge/index.web.js.map +1 -0
  20. package/lib/components/ui/button/index.web.d.ts +247 -0
  21. package/lib/components/ui/button/index.web.js +57 -0
  22. package/lib/components/ui/button/index.web.js.map +1 -0
  23. package/lib/components/ui/checkbox/index.web.d.ts +265 -0
  24. package/lib/components/ui/checkbox/index.web.js +77 -0
  25. package/lib/components/ui/checkbox/index.web.js.map +1 -0
  26. package/lib/components/ui/divider/index.web.d.ts +53 -0
  27. package/lib/components/ui/divider/index.web.js +21 -0
  28. package/lib/components/ui/divider/index.web.js.map +1 -0
  29. package/lib/components/ui/drawer/index.web.d.ts +174 -0
  30. package/lib/components/ui/drawer/index.web.js +65 -0
  31. package/lib/components/ui/drawer/index.web.js.map +1 -0
  32. package/lib/components/ui/fab/index.web.d.ts +520 -0
  33. package/lib/components/ui/fab/index.web.js +146 -0
  34. package/lib/components/ui/fab/index.web.js.map +1 -0
  35. package/lib/components/ui/flat-list/index.web.d.ts +21 -0
  36. package/lib/components/ui/flat-list/index.web.js +41 -0
  37. package/lib/components/ui/flat-list/index.web.js.map +1 -0
  38. package/lib/components/ui/form-control/index.web.d.ts +2071 -0
  39. package/lib/components/ui/form-control/index.web.js +290 -0
  40. package/lib/components/ui/form-control/index.web.js.map +1 -0
  41. package/lib/components/ui/image/index.web.d.ts +142 -0
  42. package/lib/components/ui/image/index.web.js +29 -0
  43. package/lib/components/ui/image/index.web.js.map +1 -0
  44. package/lib/components/ui/image-background/index.web.d.ts +8 -0
  45. package/lib/components/ui/image-background/index.web.js +23 -0
  46. package/lib/components/ui/image-background/index.web.js.map +1 -0
  47. package/lib/components/ui/input/index.web.d.ts +163 -0
  48. package/lib/components/ui/input/index.web.js +50 -0
  49. package/lib/components/ui/input/index.web.js.map +1 -0
  50. package/lib/components/ui/input-accessory-view/index.web.d.ts +9 -0
  51. package/lib/components/ui/input-accessory-view/index.web.js +16 -0
  52. package/lib/components/ui/input-accessory-view/index.web.js.map +1 -0
  53. package/lib/components/ui/keyboard-avoiding-view/index.web.d.ts +9 -0
  54. package/lib/components/ui/keyboard-avoiding-view/index.web.js +8 -0
  55. package/lib/components/ui/keyboard-avoiding-view/index.web.js.map +1 -0
  56. package/lib/components/ui/link/index.web.d.ts +365 -0
  57. package/lib/components/ui/link/index.web.js +70 -0
  58. package/lib/components/ui/link/index.web.js.map +1 -0
  59. package/lib/components/ui/menu/index.web.d.ts +142 -0
  60. package/lib/components/ui/menu/index.web.js +83 -0
  61. package/lib/components/ui/menu/index.web.js.map +1 -0
  62. package/lib/components/ui/modal/index.web.d.ts +111 -0
  63. package/lib/components/ui/modal/index.web.js +58 -0
  64. package/lib/components/ui/modal/index.web.js.map +1 -0
  65. package/lib/components/ui/popover/index.web.d.ts +309 -0
  66. package/lib/components/ui/popover/index.web.js +184 -0
  67. package/lib/components/ui/popover/index.web.js.map +1 -0
  68. package/lib/components/ui/portal/index.web.d.ts +9 -0
  69. package/lib/components/ui/portal/index.web.js +16 -0
  70. package/lib/components/ui/portal/index.web.js.map +1 -0
  71. package/lib/components/ui/pressable/index.web.d.ts +8 -0
  72. package/lib/components/ui/pressable/index.web.js +44 -0
  73. package/lib/components/ui/pressable/index.web.js.map +1 -0
  74. package/lib/components/ui/progress/index.web.d.ts +237 -0
  75. package/lib/components/ui/progress/index.web.js +73 -0
  76. package/lib/components/ui/progress/index.web.js.map +1 -0
  77. package/lib/components/ui/radio/index.web.d.ts +224 -0
  78. package/lib/components/ui/radio/index.web.js +69 -0
  79. package/lib/components/ui/radio/index.web.js.map +1 -0
  80. package/lib/components/ui/refresh-control/index.web.d.ts +14 -0
  81. package/lib/components/ui/refresh-control/index.web.js +69 -0
  82. package/lib/components/ui/refresh-control/index.web.js.map +1 -0
  83. package/lib/components/ui/safe-area-view/index.web.d.ts +6 -0
  84. package/lib/components/ui/safe-area-view/index.web.js +10 -0
  85. package/lib/components/ui/safe-area-view/index.web.js.map +1 -0
  86. package/lib/components/ui/scroll-view/index.web.d.ts +44 -0
  87. package/lib/components/ui/scroll-view/index.web.js +41 -0
  88. package/lib/components/ui/scroll-view/index.web.js.map +1 -0
  89. package/lib/components/ui/section-list/index.web.d.ts +26 -0
  90. package/lib/components/ui/section-list/index.web.js +35 -0
  91. package/lib/components/ui/section-list/index.web.js.map +1 -0
  92. package/lib/components/ui/select/index.web.d.ts +162 -0
  93. package/lib/components/ui/select/index.web.js +51 -0
  94. package/lib/components/ui/select/index.web.js.map +1 -0
  95. package/lib/components/ui/slider/index.web.d.ts +223 -0
  96. package/lib/components/ui/slider/index.web.js +189 -0
  97. package/lib/components/ui/slider/index.web.js.map +1 -0
  98. package/lib/components/ui/spinner/index.web.d.ts +176 -0
  99. package/lib/components/ui/spinner/index.web.js +55 -0
  100. package/lib/components/ui/spinner/index.web.js.map +1 -0
  101. package/lib/components/ui/status-bar/index.web.d.ts +14 -0
  102. package/lib/components/ui/status-bar/index.web.js +7 -0
  103. package/lib/components/ui/status-bar/index.web.js.map +1 -0
  104. package/lib/components/ui/switch/index.web.d.ts +71 -0
  105. package/lib/components/ui/switch/index.web.js +27 -0
  106. package/lib/components/ui/switch/index.web.js.map +1 -0
  107. package/lib/components/ui/tabs/index.web.d.ts +351 -0
  108. package/lib/components/ui/tabs/index.web.js +120 -0
  109. package/lib/components/ui/tabs/index.web.js.map +1 -0
  110. package/lib/components/ui/textarea/index.web.d.ts +162 -0
  111. package/lib/components/ui/textarea/index.web.js +50 -0
  112. package/lib/components/ui/textarea/index.web.js.map +1 -0
  113. package/lib/components/ui/toast/index.web.d.ts +225 -0
  114. package/lib/components/ui/toast/index.web.js +80 -0
  115. package/lib/components/ui/toast/index.web.js.map +1 -0
  116. package/lib/components/ui/tooltip/index.web.d.ts +86 -0
  117. package/lib/components/ui/tooltip/index.web.js +110 -0
  118. package/lib/components/ui/tooltip/index.web.js.map +1 -0
  119. package/lib/components/ui/view/index.web.d.ts +2 -0
  120. package/lib/components/ui/view/index.web.js +7 -0
  121. package/lib/components/ui/view/index.web.js.map +1 -0
  122. package/lib/components/ui/virtualized-list/index.web.d.ts +19 -0
  123. package/lib/components/ui/virtualized-list/index.web.js +30 -0
  124. package/lib/components/ui/virtualized-list/index.web.js.map +1 -0
  125. package/lib/components/usePermissionAutoFetch.d.ts +7 -19
  126. package/lib/containers/layout/DrawerBottomNavigationConfig.d.ts +47 -47
  127. package/lib/containers/layout/DrawerConfig.d.ts +31 -31
  128. package/lib/redux/settings.d.ts +3 -9
  129. package/package.json +9 -5
  130. package/src/components/ui/accordion/index.web.tsx +294 -0
  131. package/src/components/ui/actionsheet/index.web.tsx +555 -0
  132. package/src/components/ui/alert/index.web.tsx +71 -0
  133. package/src/components/ui/alert-dialog/index.web.tsx +241 -0
  134. package/src/components/ui/avatar/index.web.tsx +150 -0
  135. package/src/components/ui/badge/index.web.tsx +188 -0
  136. package/src/components/ui/button/index.web.tsx +86 -0
  137. package/src/components/ui/checkbox/index.web.tsx +151 -0
  138. package/src/components/ui/divider/index.web.tsx +37 -0
  139. package/src/components/ui/drawer/index.web.tsx +144 -0
  140. package/src/components/ui/fab/index.web.tsx +201 -0
  141. package/src/components/ui/flat-list/index.web.tsx +89 -0
  142. package/src/components/ui/form-control/index.web.tsx +451 -0
  143. package/src/components/ui/image/index.web.tsx +43 -0
  144. package/src/components/ui/image-background/index.web.tsx +43 -0
  145. package/src/components/ui/input/index.web.tsx +80 -0
  146. package/src/components/ui/input-accessory-view/index.web.tsx +31 -0
  147. package/src/components/ui/keyboard-avoiding-view/index.web.tsx +23 -0
  148. package/src/components/ui/link/index.web.tsx +103 -0
  149. package/src/components/ui/menu/index.web.tsx +159 -0
  150. package/src/components/ui/modal/index.web.tsx +135 -0
  151. package/src/components/ui/popover/index.web.tsx +326 -0
  152. package/src/components/ui/portal/index.web.tsx +34 -0
  153. package/src/components/ui/pressable/index.web.tsx +73 -0
  154. package/src/components/ui/progress/index.web.tsx +123 -0
  155. package/src/components/ui/radio/index.web.tsx +130 -0
  156. package/src/components/ui/refresh-control/index.web.tsx +104 -0
  157. package/src/components/ui/safe-area-view/index.web.tsx +24 -0
  158. package/src/components/ui/scroll-view/index.web.tsx +142 -0
  159. package/src/components/ui/section-list/index.web.tsx +93 -0
  160. package/src/components/ui/select/index.web.tsx +83 -0
  161. package/src/components/ui/slider/index.web.tsx +283 -0
  162. package/src/components/ui/spinner/index.web.tsx +81 -0
  163. package/src/components/ui/status-bar/index.web.tsx +20 -0
  164. package/src/components/ui/switch/index.web.tsx +44 -0
  165. package/src/components/ui/tabs/index.web.tsx +205 -0
  166. package/src/components/ui/textarea/index.web.tsx +86 -0
  167. package/src/components/ui/toast/index.web.tsx +132 -0
  168. package/src/components/ui/tooltip/index.web.tsx +155 -0
  169. package/src/components/ui/view/index.web.tsx +15 -0
  170. package/src/components/ui/virtualized-list/index.web.tsx +84 -0
@@ -0,0 +1,104 @@
1
+ 'use client';
2
+
3
+ import React, { useEffect, useState } from 'react';
4
+
5
+ interface RefreshControlProps {
6
+ refreshing?: boolean;
7
+ onRefresh?: () => void;
8
+ progressViewOffset?: number;
9
+ tintColor?: string;
10
+ title?: string;
11
+ titleColor?: string;
12
+ colors?: string[];
13
+ enabled?: boolean;
14
+ style?: React.CSSProperties;
15
+ }
16
+
17
+ export const RefreshControl: React.FC<RefreshControlProps> = ({ refreshing = false, onRefresh, style, ...props }) => {
18
+ const [startY, setStartY] = useState(0);
19
+ const [pulling, setPulling] = useState(false);
20
+ const [pullDistance, setPullDistance] = useState(0);
21
+ const threshold = 100; // Minimum pull distance to trigger refresh
22
+
23
+ useEffect(() => {
24
+ if (!refreshing) {
25
+ setPullDistance(0);
26
+ setPulling(false);
27
+ }
28
+ }, [refreshing]);
29
+
30
+ const handleTouchStart = (e: React.TouchEvent) => {
31
+ if (window.scrollY === 0) {
32
+ setStartY(e.touches[0].clientY);
33
+ setPulling(true);
34
+ }
35
+ };
36
+
37
+ const handleTouchMove = (e: React.TouchEvent) => {
38
+ if (pulling && !refreshing) {
39
+ const currentY = e.touches[0].clientY;
40
+ const distance = Math.max(0, currentY - startY);
41
+ setPullDistance(Math.min(distance * 0.5, threshold * 1.5)); // Add resistance
42
+ }
43
+ };
44
+
45
+ const handleTouchEnd = () => {
46
+ if (pulling && pullDistance >= threshold && onRefresh) {
47
+ onRefresh();
48
+ }
49
+ if (!refreshing) {
50
+ setPullDistance(0);
51
+ }
52
+ setPulling(false);
53
+ };
54
+
55
+ return (
56
+ <div
57
+ style={{
58
+ position: 'relative',
59
+ width: '100%',
60
+ ...style,
61
+ }}
62
+ onTouchStart={handleTouchStart}
63
+ onTouchMove={handleTouchMove}
64
+ onTouchEnd={handleTouchEnd}
65
+ >
66
+ {(pulling || refreshing) && (
67
+ <div
68
+ style={{
69
+ position: 'absolute',
70
+ top: 0,
71
+ left: 0,
72
+ right: 0,
73
+ display: 'flex',
74
+ justifyContent: 'center',
75
+ alignItems: 'center',
76
+ height: Math.max(pullDistance, refreshing ? 50 : 0),
77
+ transition: pulling ? 'none' : 'height 0.2s ease-out',
78
+ overflow: 'hidden',
79
+ }}
80
+ >
81
+ <div
82
+ style={{
83
+ width: '20px',
84
+ height: '20px',
85
+ border: '2px solid #ccc',
86
+ borderTopColor: props.tintColor || '#000',
87
+ borderRadius: '50%',
88
+ animation: refreshing ? 'spin 1s linear infinite' : 'none',
89
+ transform: !refreshing ? `rotate(${(pullDistance / threshold) * 360}deg)` : undefined,
90
+ }}
91
+ />
92
+ </div>
93
+ )}
94
+ <style>
95
+ {`
96
+ @keyframes spin {
97
+ 0% { transform: rotate(0deg); }
98
+ 100% { transform: rotate(360deg); }
99
+ }
100
+ `}
101
+ </style>
102
+ </div>
103
+ );
104
+ };
@@ -0,0 +1,24 @@
1
+ 'use client';
2
+ import React, { forwardRef } from 'react';
3
+ import type { VariantProps } from '@gluestack-ui/nativewind-utils';
4
+ import { clsx } from 'clsx';
5
+ import { safeAreaStyle } from './styles';
6
+
7
+ type ISafeAreaProps = React.HTMLAttributes<HTMLDivElement> &
8
+ VariantProps<typeof safeAreaStyle> & {
9
+ className?: string;
10
+ };
11
+
12
+ export const StyledSafeAreaView = forwardRef<HTMLDivElement, ISafeAreaProps>(
13
+ ({ className, children, ...props }, ref) => {
14
+ return (
15
+ <div {...props} ref={ref} className={safeAreaStyle({ class: clsx(className) })}>
16
+ {children}
17
+ </div>
18
+ );
19
+ },
20
+ );
21
+
22
+ StyledSafeAreaView.displayName = 'StyledSafeAreaView';
23
+
24
+ export { StyledSafeAreaView as SafeAreaView };
@@ -0,0 +1,142 @@
1
+ 'use client';
2
+ import React, { forwardRef } from 'react';
3
+ import { tva } from '@gluestack-ui/nativewind-utils/tva';
4
+ import { clsx } from 'clsx';
5
+
6
+ // Styles for scroll containers
7
+ const scrollContainerStyle = tva({
8
+ base: 'overflow-auto',
9
+ variants: {
10
+ horizontal: {
11
+ true: 'overflow-x-auto overflow-y-hidden whitespace-nowrap',
12
+ },
13
+ vertical: {
14
+ true: 'overflow-y-auto overflow-x-hidden',
15
+ },
16
+ },
17
+ });
18
+
19
+ type ScrollViewProps = React.HTMLAttributes<HTMLDivElement> & {
20
+ horizontal?: boolean;
21
+ className?: string;
22
+ contentContainerStyle?: React.CSSProperties;
23
+ showsHorizontalScrollIndicator?: boolean;
24
+ showsVerticalScrollIndicator?: boolean;
25
+ };
26
+
27
+ export const ScrollView = forwardRef<HTMLDivElement, ScrollViewProps>(
28
+ (
29
+ {
30
+ horizontal,
31
+ className,
32
+ contentContainerStyle,
33
+ showsHorizontalScrollIndicator = true,
34
+ showsVerticalScrollIndicator = true,
35
+ children,
36
+ style,
37
+ ...props
38
+ },
39
+ ref,
40
+ ) => {
41
+ return (
42
+ <div
43
+ ref={ref}
44
+ className={scrollContainerStyle({
45
+ horizontal,
46
+ vertical: !horizontal,
47
+ class: clsx(className),
48
+ })}
49
+ style={{
50
+ ...style,
51
+ overflowX: !showsHorizontalScrollIndicator ? 'hidden' : undefined,
52
+ overflowY: !showsVerticalScrollIndicator ? 'hidden' : undefined,
53
+ }}
54
+ {...props}
55
+ >
56
+ <div style={contentContainerStyle}>{children}</div>
57
+ </div>
58
+ );
59
+ },
60
+ );
61
+
62
+ ScrollView.displayName = 'ScrollView';
63
+
64
+ // FlatList implementation
65
+ type FlatListProps<T> = {
66
+ data: T[];
67
+ renderItem: ({ item, index }: { item: T; index: number }) => React.ReactNode;
68
+ keyExtractor?: (item: T, index: number) => string;
69
+ horizontal?: boolean;
70
+ className?: string;
71
+ contentContainerStyle?: React.CSSProperties;
72
+ showsHorizontalScrollIndicator?: boolean;
73
+ showsVerticalScrollIndicator?: boolean;
74
+ };
75
+
76
+ export function FlatList<T>({
77
+ data,
78
+ renderItem,
79
+ keyExtractor,
80
+ horizontal,
81
+ className,
82
+ contentContainerStyle,
83
+ showsHorizontalScrollIndicator,
84
+ showsVerticalScrollIndicator,
85
+ ...props
86
+ }: FlatListProps<T>) {
87
+ return (
88
+ <ScrollView
89
+ horizontal={horizontal}
90
+ className={className}
91
+ contentContainerStyle={contentContainerStyle}
92
+ showsHorizontalScrollIndicator={showsHorizontalScrollIndicator}
93
+ showsVerticalScrollIndicator={showsVerticalScrollIndicator}
94
+ {...props}
95
+ >
96
+ {data.map((item, index) => (
97
+ <React.Fragment key={keyExtractor ? keyExtractor(item, index) : index}>
98
+ {renderItem({ item, index })}
99
+ </React.Fragment>
100
+ ))}
101
+ </ScrollView>
102
+ );
103
+ }
104
+
105
+ // SectionList implementation
106
+ type SectionListProps<T, S> = {
107
+ sections: Array<{ title: string; data: T[] }>;
108
+ renderItem: ({ item, index }: { item: T; index: number }) => React.ReactNode;
109
+ renderSectionHeader?: ({ section }: { section: { title: string; data: T[] } }) => React.ReactNode;
110
+ keyExtractor?: (item: T, index: number) => string;
111
+ className?: string;
112
+ contentContainerStyle?: React.CSSProperties;
113
+ };
114
+
115
+ export function SectionList<T, S>({
116
+ sections,
117
+ renderItem,
118
+ renderSectionHeader,
119
+ keyExtractor,
120
+ className,
121
+ contentContainerStyle,
122
+ ...props
123
+ }: SectionListProps<T, S>) {
124
+ return (
125
+ <ScrollView className={className} contentContainerStyle={contentContainerStyle} {...props}>
126
+ {sections.map((section, sectionIndex) => (
127
+ <React.Fragment key={`section-${sectionIndex}`}>
128
+ {renderSectionHeader?.({ section })}
129
+ {section.data.map((item, index) => (
130
+ <React.Fragment key={keyExtractor ? keyExtractor(item, index) : index}>
131
+ {renderItem({ item, index })}
132
+ </React.Fragment>
133
+ ))}
134
+ </React.Fragment>
135
+ ))}
136
+ </ScrollView>
137
+ );
138
+ }
139
+
140
+ // VirtualizedList is an alias for FlatList in web implementation
141
+ // since we're not implementing actual virtualization in this basic version
142
+ export const VirtualizedList = FlatList;
@@ -0,0 +1,93 @@
1
+ 'use client';
2
+ import React, { forwardRef } from 'react';
3
+ import { tva } from '@gluestack-ui/nativewind-utils/tva';
4
+ import { withStyleContext } from '@gluestack-ui/nativewind-utils/withStyleContext';
5
+ import { cssInterop } from 'nativewind';
6
+ import type { VariantProps } from '@gluestack-ui/nativewind-utils';
7
+ import { ScrollView } from '../scroll-view/index.web';
8
+
9
+ const sectionListStyle = tva({
10
+ base: 'flex flex-col',
11
+ });
12
+
13
+ const sectionHeaderStyle = tva({
14
+ base: 'font-bold text-lg py-2 bg-gray-100',
15
+ });
16
+
17
+ interface SectionBase {
18
+ title: string;
19
+ }
20
+
21
+ interface SectionListProps<ItemT, SectionT extends SectionBase> {
22
+ sections: ReadonlyArray<SectionT & { data: ReadonlyArray<ItemT> }>;
23
+ renderItem: ({ item, index }: { item: ItemT; index: number }) => React.ReactElement;
24
+ renderSectionHeader?: ({ section }: { section: SectionT }) => React.ReactElement;
25
+ keyExtractor?: (item: ItemT, index: number) => string;
26
+ className?: string;
27
+ contentContainerStyle?: React.CSSProperties;
28
+ onEndReached?: () => void;
29
+ onEndReachedThreshold?: number;
30
+ stickySectionHeadersEnabled?: boolean;
31
+ }
32
+
33
+ function SectionListComponent<ItemT, SectionT extends SectionBase>(
34
+ {
35
+ sections,
36
+ renderItem,
37
+ renderSectionHeader,
38
+ keyExtractor,
39
+ className,
40
+ contentContainerStyle,
41
+ onEndReached,
42
+ onEndReachedThreshold = 0.5,
43
+ stickySectionHeadersEnabled = false,
44
+ ...props
45
+ }: SectionListProps<ItemT, SectionT>,
46
+ ref: React.Ref<HTMLDivElement>,
47
+ ) {
48
+ const handleScroll = (event: React.UIEvent<HTMLDivElement>) => {
49
+ if (!onEndReached) return;
50
+
51
+ const target = event.target as HTMLDivElement;
52
+ const scrollPosition = target.scrollTop + target.clientHeight;
53
+ const scrollSize = target.scrollHeight;
54
+ const threshold = scrollSize * onEndReachedThreshold;
55
+
56
+ if (scrollSize - scrollPosition <= threshold) {
57
+ onEndReached();
58
+ }
59
+ };
60
+
61
+ const defaultSectionHeader = (section: SectionT) => <div className={sectionHeaderStyle()}>{section.title}</div>;
62
+
63
+ return (
64
+ <ScrollView ref={ref} className={className} onScroll={handleScroll} {...props}>
65
+ <div className={sectionListStyle()} style={contentContainerStyle}>
66
+ {sections.map((section, sectionIndex) => (
67
+ <div key={`section-${sectionIndex}`}>
68
+ <div
69
+ style={{
70
+ position: stickySectionHeadersEnabled ? 'sticky' : 'relative',
71
+ top: stickySectionHeadersEnabled ? 0 : undefined,
72
+ zIndex: stickySectionHeadersEnabled ? 1 : undefined,
73
+ }}
74
+ >
75
+ {renderSectionHeader ? renderSectionHeader({ section }) : defaultSectionHeader(section)}
76
+ </div>
77
+ {section.data.map((item, index) => (
78
+ <React.Fragment key={keyExtractor ? keyExtractor(item, index) : `${sectionIndex}-${index}`}>
79
+ {renderItem({ item, index })}
80
+ </React.Fragment>
81
+ ))}
82
+ </div>
83
+ ))}
84
+ </div>
85
+ </ScrollView>
86
+ );
87
+ }
88
+
89
+ const SectionList = React.forwardRef(SectionListComponent) as <ItemT, SectionT extends SectionBase>(
90
+ props: SectionListProps<ItemT, SectionT> & { ref?: React.Ref<HTMLDivElement> },
91
+ ) => React.ReactElement;
92
+
93
+ export { SectionList };
@@ -0,0 +1,83 @@
1
+ 'use client';
2
+ import React, { forwardRef } from 'react';
3
+ import { createSelect } from '@gluestack-ui/select';
4
+ import { tva } from '@gluestack-ui/nativewind-utils/tva';
5
+ import { withStyleContext } from '@gluestack-ui/nativewind-utils/withStyleContext';
6
+ import { cssInterop } from 'nativewind';
7
+ import type { VariantProps } from '@gluestack-ui/nativewind-utils';
8
+
9
+ const SCOPE = 'SELECT';
10
+
11
+ const StyledSelect = forwardRef<HTMLSelectElement, any>(
12
+ ({ onValueChange, onChange, placeholder, children, ...props }, ref) => {
13
+ const handleChange = (e: React.ChangeEvent<HTMLSelectElement>) => {
14
+ if (onChange) {
15
+ onChange(e);
16
+ }
17
+ if (onValueChange) {
18
+ onValueChange(e.target.value);
19
+ }
20
+ };
21
+
22
+ return (
23
+ <select ref={ref} onChange={handleChange} {...props}>
24
+ {placeholder && (
25
+ <option value="" disabled>
26
+ {placeholder}
27
+ </option>
28
+ )}
29
+ {children}
30
+ </select>
31
+ );
32
+ },
33
+ );
34
+
35
+ StyledSelect.displayName = 'StyledSelect';
36
+
37
+ const selectStyle = tva({
38
+ base: 'px-4 py-2 border border-gray-300 rounded-md focus:outline-none focus:ring-2 focus:ring-blue-500 focus:border-transparent appearance-none bg-white',
39
+ variants: {
40
+ size: {
41
+ sm: 'text-sm h-8',
42
+ md: 'text-base h-10',
43
+ lg: 'text-lg h-12',
44
+ },
45
+ variant: {
46
+ outline: 'bg-transparent',
47
+ filled: 'bg-gray-100',
48
+ unstyled: '',
49
+ },
50
+ state: {
51
+ error: 'border-red-500 focus:ring-red-500',
52
+ success: 'border-green-500 focus:ring-green-500',
53
+ },
54
+ },
55
+ defaultVariants: {
56
+ size: 'md',
57
+ variant: 'outline',
58
+ },
59
+ });
60
+
61
+ export const SelectOption = forwardRef<HTMLOptionElement, React.ComponentProps<'option'>>((props, ref) => {
62
+ return <option ref={ref} {...props} />;
63
+ });
64
+
65
+ SelectOption.displayName = 'SelectOption';
66
+
67
+ type ISelectProps = React.ComponentProps<typeof StyledSelect> &
68
+ VariantProps<typeof selectStyle> & {
69
+ className?: string;
70
+ onValueChange?: (value: string) => void;
71
+ };
72
+
73
+ const Select = React.forwardRef<HTMLSelectElement, ISelectProps>(
74
+ ({ className, size, variant, state, ...props }, ref) => {
75
+ return (
76
+ <StyledSelect ref={ref} className={selectStyle({ size, variant, state, class: className })} {...props} />
77
+ );
78
+ },
79
+ );
80
+
81
+ Select.displayName = 'Select';
82
+
83
+ export { Select };