@tradly/asset 1.0.14 → 1.0.16
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/README.md +172 -15
- package/dist/esm/index.js +3 -0
- package/dist/esm/native/FileUpload.native.js +35 -23
- package/dist/esm/native/MediaGallery.native.js +17 -10
- package/dist/esm/native/MediaPopup.native.js +44 -23
- package/dist/esm/native/MediaTab.native.js +66 -41
- package/dist/esm/native/Pagination.native.js +43 -19
- package/dist/esm/native/THEME_EXAMPLE.js +112 -0
- package/dist/esm/native/VideosGallery.native.js +14 -7
- package/dist/esm/native/theme.js +167 -0
- package/dist/index.js +14 -0
- package/dist/native/FileUpload.native.js +35 -23
- package/dist/native/MediaGallery.native.js +17 -10
- package/dist/native/MediaPopup.native.js +44 -23
- package/dist/native/MediaTab.native.js +62 -37
- package/dist/native/Pagination.native.js +43 -19
- package/dist/native/THEME_EXAMPLE.js +117 -0
- package/dist/native/VideosGallery.native.js +14 -7
- package/dist/native/theme.js +173 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -236,11 +236,130 @@ You can customize picker options based on the accept type:
|
|
|
236
236
|
### React Native UI Differences
|
|
237
237
|
|
|
238
238
|
- **Bottom Sheet**: Media gallery opens as a bottom sheet (slides up from
|
|
239
|
-
bottom)
|
|
239
|
+
bottom) - defaults to 90% of screen height, customizable
|
|
240
240
|
- **Native Styling**: Uses React Native `StyleSheet` instead of Tailwind CSS
|
|
241
241
|
- **Components**: Uses React Native primitives (`View`, `Text`,
|
|
242
242
|
`TouchableOpacity`, `FlatList`, `Image`)
|
|
243
243
|
- **File Upload**: Requires `picker` prop to be provided
|
|
244
|
+
- **Theme System**: Full theme support for easy dark/light mode customization
|
|
245
|
+
|
|
246
|
+
### React Native Theme & Customization
|
|
247
|
+
|
|
248
|
+
The package includes a comprehensive theme system that makes it easy to
|
|
249
|
+
customize colors, spacing, and styling for dark/light mode.
|
|
250
|
+
|
|
251
|
+
#### Basic Theme Usage
|
|
252
|
+
|
|
253
|
+
```jsx
|
|
254
|
+
import { MediaPopup, MediaApiService } from "@tradly/asset";
|
|
255
|
+
import { createTheme } from "@tradly/asset/native/theme";
|
|
256
|
+
|
|
257
|
+
// Use dark mode
|
|
258
|
+
const darkTheme = createTheme({ mode: "dark" });
|
|
259
|
+
|
|
260
|
+
// Use light mode (default)
|
|
261
|
+
const lightTheme = createTheme({ mode: "light" });
|
|
262
|
+
|
|
263
|
+
<MediaPopup
|
|
264
|
+
apiService={apiService}
|
|
265
|
+
picker={picker}
|
|
266
|
+
theme={darkTheme} // Pass your theme
|
|
267
|
+
bottomSheetHeight={0.9} // 90% of screen (default), customize as needed
|
|
268
|
+
/>;
|
|
269
|
+
```
|
|
270
|
+
|
|
271
|
+
#### Custom Theme Colors
|
|
272
|
+
|
|
273
|
+
```jsx
|
|
274
|
+
import { createTheme } from "@tradly/asset/native/theme";
|
|
275
|
+
|
|
276
|
+
const customTheme = createTheme({
|
|
277
|
+
mode: "dark", // or "light"
|
|
278
|
+
colors: {
|
|
279
|
+
// Primary colors
|
|
280
|
+
primary: "#6366F1",
|
|
281
|
+
tabActive: "#6366F1",
|
|
282
|
+
tabIndicator: "#6366F1",
|
|
283
|
+
|
|
284
|
+
// Backgrounds
|
|
285
|
+
background: "#0F172A",
|
|
286
|
+
backgroundSecondary: "#1E293B",
|
|
287
|
+
|
|
288
|
+
// Text
|
|
289
|
+
text: "#F1F5F9",
|
|
290
|
+
textSecondary: "#CBD5E1",
|
|
291
|
+
|
|
292
|
+
// Tabs
|
|
293
|
+
tabActive: "#6366F1",
|
|
294
|
+
tabInactive: "#94A3B8",
|
|
295
|
+
tabBackground: "#0F172A",
|
|
296
|
+
|
|
297
|
+
// Borders
|
|
298
|
+
border: "#334155",
|
|
299
|
+
|
|
300
|
+
// Pagination
|
|
301
|
+
paginationButtonActive: "#6366F1",
|
|
302
|
+
paginationTextActive: "#FFFFFF",
|
|
303
|
+
|
|
304
|
+
// Upload button
|
|
305
|
+
uploadBorder: "#6366F1",
|
|
306
|
+
uploadIconBackground: "#6366F1",
|
|
307
|
+
|
|
308
|
+
// And many more...
|
|
309
|
+
},
|
|
310
|
+
bottomSheetHeight: 0.92, // 92% of screen height
|
|
311
|
+
});
|
|
312
|
+
|
|
313
|
+
<MediaPopup theme={customTheme} ... />
|
|
314
|
+
```
|
|
315
|
+
|
|
316
|
+
#### Available Theme Colors
|
|
317
|
+
|
|
318
|
+
All colors are customizable via the theme object:
|
|
319
|
+
|
|
320
|
+
- **Primary**: `primary`, `primaryLight`, `primaryDark`
|
|
321
|
+
- **Backgrounds**: `background`, `backgroundSecondary`, `backgroundTertiary`
|
|
322
|
+
- **Text**: `text`, `textSecondary`, `textTertiary`, `textInverse`
|
|
323
|
+
- **Borders**: `border`, `borderLight`, `borderDark`
|
|
324
|
+
- **Tabs**: `tabActive`, `tabInactive`, `tabIndicator`, `tabBackground`
|
|
325
|
+
- **Pagination**: `paginationBackground`, `paginationButton`,
|
|
326
|
+
`paginationButtonActive`, `paginationText`, `paginationTextActive`,
|
|
327
|
+
`paginationBorder`
|
|
328
|
+
- **Upload**: `uploadBorder`, `uploadBackground`, `uploadIconBackground`,
|
|
329
|
+
`uploadText`
|
|
330
|
+
- **Items**: `itemBackground`, `itemShadow`
|
|
331
|
+
- **Loading**: `loadingBackground`, `loadingText`
|
|
332
|
+
- **Overlay**: `overlay`
|
|
333
|
+
|
|
334
|
+
#### Customizing Bottom Sheet Height
|
|
335
|
+
|
|
336
|
+
```jsx
|
|
337
|
+
<MediaPopup
|
|
338
|
+
bottomSheetHeight={0.85} // 85% of screen height
|
|
339
|
+
// or via theme:
|
|
340
|
+
theme={createTheme({ bottomSheetHeight: 0.92 })}
|
|
341
|
+
/>
|
|
342
|
+
```
|
|
343
|
+
|
|
344
|
+
#### Individual Component Styling
|
|
345
|
+
|
|
346
|
+
You can also override individual component styles:
|
|
347
|
+
|
|
348
|
+
```jsx
|
|
349
|
+
<MediaPopup
|
|
350
|
+
theme={darkTheme}
|
|
351
|
+
// Override specific styles
|
|
352
|
+
containerStyle={{ padding: 24 }}
|
|
353
|
+
headerStyle={{ paddingBottom: 16 }}
|
|
354
|
+
titleStyle={{ fontSize: 28 }}
|
|
355
|
+
closeButtonStyle={{ padding: 12 }}
|
|
356
|
+
tabListStyle={{ paddingHorizontal: 8 }}
|
|
357
|
+
tabButtonStyle={{ paddingVertical: 16 }}
|
|
358
|
+
tabButtonActiveStyle={{ backgroundColor: "#F0F0F0" }}
|
|
359
|
+
tabButtonTextActiveStyle={{ fontWeight: "700" }}
|
|
360
|
+
// ... and many more style props
|
|
361
|
+
/>
|
|
362
|
+
```
|
|
244
363
|
|
|
245
364
|
## Advanced Usage
|
|
246
365
|
|
|
@@ -341,18 +460,20 @@ apiService.setBearerToken("new-bearer-token");
|
|
|
341
460
|
|
|
342
461
|
### MediaPopup Props
|
|
343
462
|
|
|
344
|
-
| Prop
|
|
345
|
-
|
|
|
346
|
-
| `isOpen`
|
|
347
|
-
| `onClose`
|
|
348
|
-
| `onSelect`
|
|
349
|
-
| `currentData`
|
|
350
|
-
| `options`
|
|
351
|
-
| `apiService`
|
|
352
|
-
| `onError`
|
|
353
|
-
| `title`
|
|
354
|
-
| `picker`
|
|
355
|
-
| `pickerOptions`
|
|
463
|
+
| Prop | Type | Default | Description | Platform |
|
|
464
|
+
| ------------------- | ----------------- | ----------------- | --------------------------------------------------- | ------------ |
|
|
465
|
+
| `isOpen` | `boolean` | `false` | Controls popup visibility | Web & Native |
|
|
466
|
+
| `onClose` | `function` | - | Callback when popup closes | Web & Native |
|
|
467
|
+
| `onSelect` | `function` | - | Callback when media is selected | Web & Native |
|
|
468
|
+
| `currentData` | `any` | - | Currently selected media data | Web & Native |
|
|
469
|
+
| `options` | `array` | `['image']` | Media types to show: `'image'`, `'video'`, `'file'` | Web & Native |
|
|
470
|
+
| `apiService` | `MediaApiService` | - | **Required**: API service instance | Web & Native |
|
|
471
|
+
| `onError` | `function` | - | Error handler callback | Web & Native |
|
|
472
|
+
| `title` | `string` | `'Media Gallery'` | Popup title | Web & Native |
|
|
473
|
+
| `picker` | `function` | - | **Required for React Native**: File picker function | Native only |
|
|
474
|
+
| `pickerOptions` | `function` | - | Optional: Function to generate picker options | Native only |
|
|
475
|
+
| `theme` | `object` | - | Theme object for colors/spacing (see Theme docs) | Native only |
|
|
476
|
+
| `bottomSheetHeight` | `number` | `0.9` | Bottom sheet height (0.85 = 85%, 0.9 = 90%, etc.) | Native only |
|
|
356
477
|
|
|
357
478
|
**React Native Required Props:**
|
|
358
479
|
|
|
@@ -430,19 +551,55 @@ using style props:
|
|
|
430
551
|
|
|
431
552
|
**Available Style Props (React Native):**
|
|
432
553
|
|
|
554
|
+
**MediaPopup:**
|
|
555
|
+
|
|
556
|
+
- `overlayStyle` - Overlay/backdrop
|
|
433
557
|
- `containerStyle` - Main popup container
|
|
434
558
|
- `headerStyle` - Header container
|
|
435
559
|
- `titleStyle` - Title text
|
|
436
560
|
- `closeButtonStyle` - Close button
|
|
561
|
+
- `closeButtonTextStyle` - Close button text/icon
|
|
562
|
+
|
|
563
|
+
**MediaTab:**
|
|
564
|
+
|
|
565
|
+
- `containerStyle` - Tab container
|
|
437
566
|
- `tabListStyle` - Tab list
|
|
438
567
|
- `tabButtonStyle` - Base tab button
|
|
439
568
|
- `tabButtonActiveStyle` - Active tab button
|
|
440
569
|
- `tabButtonInactiveStyle` - Inactive tab button
|
|
570
|
+
- `tabButtonTextStyle` - Base tab text
|
|
571
|
+
- `tabButtonTextActiveStyle` - Active tab text
|
|
572
|
+
- `tabButtonTextInactiveStyle` - Inactive tab text
|
|
573
|
+
- `tabIndicatorStyle` - Tab indicator line
|
|
574
|
+
- `tabPanelStyle` - Tab panel container
|
|
575
|
+
|
|
576
|
+
**ImagesGallery/VideosGallery:**
|
|
577
|
+
|
|
578
|
+
- `containerStyle` - Gallery container
|
|
441
579
|
- `gridStyle` - Media grid layout
|
|
442
|
-
- `imageItemStyle` -
|
|
443
|
-
- `videoItemStyle` - Video item styles
|
|
580
|
+
- `imageItemStyle` / `videoItemStyle` - Media item styles
|
|
444
581
|
- `paginationContainerStyle` - Pagination container
|
|
445
582
|
|
|
583
|
+
**FileUpload:**
|
|
584
|
+
|
|
585
|
+
- `containerStyle` - Upload container
|
|
586
|
+
- `buttonStyle` - Upload button
|
|
587
|
+
- `iconContainerStyle` - Icon container
|
|
588
|
+
- `titleStyle` - Upload title text
|
|
589
|
+
- `loadingStyle` - Loading state container
|
|
590
|
+
|
|
591
|
+
**Pagination:**
|
|
592
|
+
|
|
593
|
+
- `containerStyle` - Pagination container
|
|
594
|
+
- `navStyle` - Navigation container
|
|
595
|
+
- `previousButtonStyle` - Previous button
|
|
596
|
+
- `nextButtonStyle` - Next button
|
|
597
|
+
- `pageButtonStyle` - Page number button
|
|
598
|
+
- `pageButtonActiveStyle` - Active page button
|
|
599
|
+
- `pageButtonTextStyle` - Page button text
|
|
600
|
+
- `pageButtonTextActiveStyle` - Active page text
|
|
601
|
+
- `ellipsisStyle` - Ellipsis container
|
|
602
|
+
|
|
446
603
|
### Full Styling Guide
|
|
447
604
|
|
|
448
605
|
For detailed styling documentation with examples, see
|
package/dist/esm/index.js
CHANGED
|
@@ -21,6 +21,9 @@ export { MediaTab, ImagesGallery, VideosGallery, FileUpload };
|
|
|
21
21
|
// Export API service
|
|
22
22
|
export { MediaApiService };
|
|
23
23
|
|
|
24
|
+
// Export React Native theme utilities
|
|
25
|
+
export { createTheme, defaultTheme } from "./native/theme";
|
|
26
|
+
|
|
24
27
|
// Export default as MediaPopup for convenience
|
|
25
28
|
export default MediaPopup;
|
|
26
29
|
|
|
@@ -11,6 +11,7 @@ function _arrayWithHoles(r) { if (Array.isArray(r)) return r; }
|
|
|
11
11
|
import React, { useState } from "react";
|
|
12
12
|
import { View, Text, TouchableOpacity, StyleSheet, Alert, ActivityIndicator } from "react-native";
|
|
13
13
|
import { CameraIcon } from "./Icons.native";
|
|
14
|
+
import { defaultTheme } from "./theme";
|
|
14
15
|
|
|
15
16
|
/**
|
|
16
17
|
* FileUpload component for React Native
|
|
@@ -78,6 +79,8 @@ var FileUpload = function FileUpload(_ref) {
|
|
|
78
79
|
onUploadError = _ref.onUploadError,
|
|
79
80
|
picker = _ref.picker,
|
|
80
81
|
pickerOptions = _ref.pickerOptions,
|
|
82
|
+
_ref$theme = _ref.theme,
|
|
83
|
+
theme = _ref$theme === void 0 ? defaultTheme : _ref$theme,
|
|
81
84
|
containerStyle = _ref.containerStyle,
|
|
82
85
|
buttonStyle = _ref.buttonStyle,
|
|
83
86
|
iconContainerStyle = _ref.iconContainerStyle,
|
|
@@ -227,12 +230,18 @@ var FileUpload = function FileUpload(_ref) {
|
|
|
227
230
|
}();
|
|
228
231
|
if (isLoading) {
|
|
229
232
|
return /*#__PURE__*/_jsxs(View, {
|
|
230
|
-
style: [styles.loadingContainer,
|
|
233
|
+
style: [styles.loadingContainer, {
|
|
234
|
+
backgroundColor: theme.colors.loadingBackground,
|
|
235
|
+
borderRadius: theme.radius.md
|
|
236
|
+
}, loadingStyle],
|
|
231
237
|
children: [/*#__PURE__*/_jsx(ActivityIndicator, {
|
|
232
238
|
size: "small",
|
|
233
|
-
color:
|
|
239
|
+
color: theme.colors.primary
|
|
234
240
|
}), /*#__PURE__*/_jsx(Text, {
|
|
235
|
-
style: styles.loadingText,
|
|
241
|
+
style: [styles.loadingText, {
|
|
242
|
+
color: theme.colors.loadingText,
|
|
243
|
+
marginTop: theme.spacing.sm
|
|
244
|
+
}],
|
|
236
245
|
children: "Uploading..."
|
|
237
246
|
})]
|
|
238
247
|
});
|
|
@@ -241,13 +250,26 @@ var FileUpload = function FileUpload(_ref) {
|
|
|
241
250
|
style: [styles.container, containerStyle],
|
|
242
251
|
children: /*#__PURE__*/_jsxs(TouchableOpacity, {
|
|
243
252
|
onPress: handlePickFile,
|
|
244
|
-
style: [styles.button,
|
|
253
|
+
style: [styles.button, {
|
|
254
|
+
borderColor: theme.colors.uploadBorder,
|
|
255
|
+
backgroundColor: theme.colors.uploadBackground,
|
|
256
|
+
borderRadius: theme.radius.md
|
|
257
|
+
}, buttonStyle],
|
|
245
258
|
disabled: isLoading,
|
|
246
259
|
children: [/*#__PURE__*/_jsx(View, {
|
|
247
|
-
style: [styles.iconContainer,
|
|
260
|
+
style: [styles.iconContainer, {
|
|
261
|
+
backgroundColor: theme.colors.uploadIconBackground,
|
|
262
|
+
borderRadius: theme.radius.xl,
|
|
263
|
+
marginBottom: theme.spacing.sm,
|
|
264
|
+
padding: theme.spacing.md
|
|
265
|
+
}, iconContainerStyle],
|
|
248
266
|
children: /*#__PURE__*/_jsx(CameraIcon, {})
|
|
249
267
|
}), /*#__PURE__*/_jsx(Text, {
|
|
250
|
-
style: [styles.title,
|
|
268
|
+
style: [styles.title, {
|
|
269
|
+
color: theme.colors.uploadText,
|
|
270
|
+
marginTop: theme.spacing.sm,
|
|
271
|
+
fontSize: theme.typography.caption.fontSize
|
|
272
|
+
}, titleStyle],
|
|
251
273
|
children: title
|
|
252
274
|
})]
|
|
253
275
|
})
|
|
@@ -265,34 +287,24 @@ var styles = StyleSheet.create({
|
|
|
265
287
|
justifyContent: "center",
|
|
266
288
|
alignItems: "center",
|
|
267
289
|
borderWidth: 1,
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
borderRadius: 8,
|
|
271
|
-
backgroundColor: "#FFFFFF"
|
|
290
|
+
borderStyle: "dashed"
|
|
291
|
+
// Colors applied via theme
|
|
272
292
|
},
|
|
273
293
|
iconContainer: {
|
|
274
|
-
|
|
275
|
-
backgroundColor: "#3B3269",
|
|
276
|
-
borderRadius: 20,
|
|
277
|
-
marginBottom: 8
|
|
294
|
+
// Colors and spacing applied via theme
|
|
278
295
|
},
|
|
279
296
|
title: {
|
|
280
|
-
|
|
281
|
-
color: "#000000",
|
|
282
|
-
marginTop: 8
|
|
297
|
+
// Colors and typography applied via theme
|
|
283
298
|
},
|
|
284
299
|
loadingContainer: {
|
|
285
300
|
width: "100%",
|
|
286
301
|
height: 160,
|
|
287
302
|
justifyContent: "center",
|
|
288
|
-
alignItems: "center"
|
|
289
|
-
|
|
290
|
-
borderRadius: 8
|
|
303
|
+
alignItems: "center"
|
|
304
|
+
// Colors applied via theme
|
|
291
305
|
},
|
|
292
306
|
loadingText: {
|
|
293
|
-
|
|
294
|
-
fontSize: 14,
|
|
295
|
-
color: "#666666"
|
|
307
|
+
// Colors applied via theme
|
|
296
308
|
}
|
|
297
309
|
});
|
|
298
310
|
export default FileUpload;
|
|
@@ -17,6 +17,7 @@ import { View, FlatList, Image, TouchableOpacity, StyleSheet, Dimensions } from
|
|
|
17
17
|
import FileUpload from './FileUpload.native';
|
|
18
18
|
import ImagesSkeleton from './ImagesSkeleton.native';
|
|
19
19
|
import Pagination from './Pagination.native';
|
|
20
|
+
import { defaultTheme } from './theme';
|
|
20
21
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
21
22
|
var _Dimensions$get = Dimensions.get('window'),
|
|
22
23
|
SCREEN_WIDTH = _Dimensions$get.width;
|
|
@@ -32,6 +33,8 @@ var ImagesGallery = function ImagesGallery(_ref) {
|
|
|
32
33
|
onError = _ref.onError,
|
|
33
34
|
picker = _ref.picker,
|
|
34
35
|
pickerOptions = _ref.pickerOptions,
|
|
36
|
+
_ref$theme = _ref.theme,
|
|
37
|
+
theme = _ref$theme === void 0 ? defaultTheme : _ref$theme,
|
|
35
38
|
containerStyle = _ref.containerStyle,
|
|
36
39
|
gridStyle = _ref.gridStyle,
|
|
37
40
|
imageItemStyle = _ref.imageItemStyle,
|
|
@@ -130,7 +133,8 @@ var ImagesGallery = function ImagesGallery(_ref) {
|
|
|
130
133
|
apiService: apiService,
|
|
131
134
|
onUploadError: onError,
|
|
132
135
|
picker: picker,
|
|
133
|
-
pickerOptions: pickerOptions
|
|
136
|
+
pickerOptions: pickerOptions,
|
|
137
|
+
theme: theme
|
|
134
138
|
})
|
|
135
139
|
});
|
|
136
140
|
}
|
|
@@ -143,7 +147,9 @@ var ImagesGallery = function ImagesGallery(_ref) {
|
|
|
143
147
|
},
|
|
144
148
|
style: [styles.imageItem, {
|
|
145
149
|
width: ITEM_SIZE,
|
|
146
|
-
height: ITEM_SIZE
|
|
150
|
+
height: ITEM_SIZE,
|
|
151
|
+
backgroundColor: theme.colors.itemBackground,
|
|
152
|
+
shadowColor: theme.colors.itemShadow
|
|
147
153
|
}, imageItemStyle],
|
|
148
154
|
children: /*#__PURE__*/_jsx(Image, {
|
|
149
155
|
source: {
|
|
@@ -171,13 +177,19 @@ var ImagesGallery = function ImagesGallery(_ref) {
|
|
|
171
177
|
contentContainerStyle: [styles.grid, gridStyle],
|
|
172
178
|
showsVerticalScrollIndicator: false,
|
|
173
179
|
ListFooterComponent: total_count > 0 ? /*#__PURE__*/_jsx(View, {
|
|
174
|
-
style: [styles.paginationContainer,
|
|
180
|
+
style: [styles.paginationContainer, {
|
|
181
|
+
backgroundColor: theme.colors.paginationBackground,
|
|
182
|
+
paddingVertical: theme.spacing.lg,
|
|
183
|
+
paddingHorizontal: theme.spacing.sm,
|
|
184
|
+
marginTop: theme.spacing.sm
|
|
185
|
+
}, paginationContainerStyle],
|
|
175
186
|
children: /*#__PURE__*/_jsx(Pagination, {
|
|
176
187
|
nextPage: function nextPage(value) {
|
|
177
188
|
return loadMedia(value);
|
|
178
189
|
},
|
|
179
190
|
pageCount: Math.ceil(total_count / 30),
|
|
180
|
-
current_page: currentPage
|
|
191
|
+
current_page: currentPage,
|
|
192
|
+
theme: theme
|
|
181
193
|
})
|
|
182
194
|
}) : null
|
|
183
195
|
})
|
|
@@ -197,8 +209,6 @@ var styles = StyleSheet.create({
|
|
|
197
209
|
margin: ITEM_MARGIN,
|
|
198
210
|
borderRadius: 8,
|
|
199
211
|
overflow: 'hidden',
|
|
200
|
-
backgroundColor: '#FFFFFF',
|
|
201
|
-
shadowColor: '#000',
|
|
202
212
|
shadowOffset: {
|
|
203
213
|
width: 0,
|
|
204
214
|
height: 2
|
|
@@ -212,10 +222,7 @@ var styles = StyleSheet.create({
|
|
|
212
222
|
height: '100%'
|
|
213
223
|
},
|
|
214
224
|
paginationContainer: {
|
|
215
|
-
|
|
216
|
-
paddingHorizontal: 8,
|
|
217
|
-
backgroundColor: '#F5F5F5',
|
|
218
|
-
marginTop: 8
|
|
225
|
+
// Styles applied via theme
|
|
219
226
|
}
|
|
220
227
|
});
|
|
221
228
|
export default ImagesGallery;
|
|
@@ -8,6 +8,7 @@ import React from 'react';
|
|
|
8
8
|
import { Modal, View, Text, TouchableOpacity, StyleSheet, Dimensions, Animated, TouchableWithoutFeedback } from 'react-native';
|
|
9
9
|
import MediaTab from './MediaTab.native';
|
|
10
10
|
import { CloseIcon } from './Icons.native';
|
|
11
|
+
import { createTheme } from './theme';
|
|
11
12
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
12
13
|
var _Dimensions$get = Dimensions.get('window'),
|
|
13
14
|
SCREEN_HEIGHT = _Dimensions$get.height;
|
|
@@ -24,10 +25,18 @@ var MediaPopup = function MediaPopup(_ref) {
|
|
|
24
25
|
title = _ref$title === void 0 ? 'Media Gallery' : _ref$title,
|
|
25
26
|
picker = _ref.picker,
|
|
26
27
|
pickerOptions = _ref.pickerOptions,
|
|
28
|
+
theme = _ref.theme,
|
|
29
|
+
overlayStyle = _ref.overlayStyle,
|
|
27
30
|
containerStyle = _ref.containerStyle,
|
|
28
31
|
headerStyle = _ref.headerStyle,
|
|
29
32
|
titleStyle = _ref.titleStyle,
|
|
30
|
-
closeButtonStyle = _ref.closeButtonStyle
|
|
33
|
+
closeButtonStyle = _ref.closeButtonStyle,
|
|
34
|
+
closeButtonTextStyle = _ref.closeButtonTextStyle,
|
|
35
|
+
bottomSheetHeight = _ref.bottomSheetHeight;
|
|
36
|
+
var currentTheme = React.useMemo(function () {
|
|
37
|
+
return createTheme(theme);
|
|
38
|
+
}, [theme]);
|
|
39
|
+
var sheetHeight = bottomSheetHeight || currentTheme.bottomSheetHeight || 0.9;
|
|
31
40
|
var _React$useState = React.useState(new Animated.Value(SCREEN_HEIGHT)),
|
|
32
41
|
_React$useState2 = _slicedToArray(_React$useState, 1),
|
|
33
42
|
slideAnim = _React$useState2[0];
|
|
@@ -66,18 +75,35 @@ var MediaPopup = function MediaPopup(_ref) {
|
|
|
66
75
|
children: /*#__PURE__*/_jsx(TouchableWithoutFeedback, {
|
|
67
76
|
onPress: handleClose,
|
|
68
77
|
children: /*#__PURE__*/_jsx(View, {
|
|
69
|
-
style: styles.overlay,
|
|
78
|
+
style: [styles.overlay, {
|
|
79
|
+
backgroundColor: currentTheme.colors.overlay
|
|
80
|
+
}, overlayStyle],
|
|
70
81
|
children: /*#__PURE__*/_jsx(TouchableWithoutFeedback, {
|
|
71
82
|
children: /*#__PURE__*/_jsxs(Animated.View, {
|
|
72
|
-
style: [styles.container,
|
|
83
|
+
style: [styles.container, {
|
|
84
|
+
backgroundColor: currentTheme.colors.background,
|
|
85
|
+
borderTopLeftRadius: currentTheme.radius.xxl,
|
|
86
|
+
borderTopRightRadius: currentTheme.radius.xxl,
|
|
87
|
+
height: SCREEN_HEIGHT * sheetHeight,
|
|
88
|
+
maxHeight: SCREEN_HEIGHT * sheetHeight,
|
|
89
|
+
padding: currentTheme.spacing.xl
|
|
90
|
+
}, containerStyle, {
|
|
73
91
|
transform: [{
|
|
74
92
|
translateY: slideAnim
|
|
75
93
|
}]
|
|
76
94
|
}],
|
|
77
95
|
children: [/*#__PURE__*/_jsxs(View, {
|
|
78
|
-
style: [styles.header,
|
|
96
|
+
style: [styles.header, {
|
|
97
|
+
borderBottomColor: currentTheme.colors.border,
|
|
98
|
+
marginBottom: currentTheme.spacing.lg,
|
|
99
|
+
paddingBottom: currentTheme.spacing.md
|
|
100
|
+
}, headerStyle],
|
|
79
101
|
children: [/*#__PURE__*/_jsx(Text, {
|
|
80
|
-
style: [styles.title,
|
|
102
|
+
style: [styles.title, {
|
|
103
|
+
fontSize: currentTheme.typography.title.fontSize,
|
|
104
|
+
fontWeight: currentTheme.typography.title.fontWeight,
|
|
105
|
+
color: currentTheme.colors.text
|
|
106
|
+
}, titleStyle],
|
|
81
107
|
children: title
|
|
82
108
|
}), /*#__PURE__*/_jsx(TouchableOpacity, {
|
|
83
109
|
onPress: handleClose,
|
|
@@ -88,7 +114,10 @@ var MediaPopup = function MediaPopup(_ref) {
|
|
|
88
114
|
left: 10,
|
|
89
115
|
right: 10
|
|
90
116
|
},
|
|
91
|
-
children: /*#__PURE__*/_jsx(CloseIcon, {
|
|
117
|
+
children: /*#__PURE__*/_jsx(CloseIcon, {
|
|
118
|
+
size: 24,
|
|
119
|
+
color: currentTheme.colors.text
|
|
120
|
+
})
|
|
92
121
|
})]
|
|
93
122
|
}), /*#__PURE__*/_jsx(MediaTab, {
|
|
94
123
|
imagePopup: isOpen,
|
|
@@ -99,7 +128,8 @@ var MediaPopup = function MediaPopup(_ref) {
|
|
|
99
128
|
apiService: apiService,
|
|
100
129
|
onError: onError,
|
|
101
130
|
picker: picker,
|
|
102
|
-
pickerOptions: pickerOptions
|
|
131
|
+
pickerOptions: pickerOptions,
|
|
132
|
+
theme: currentTheme
|
|
103
133
|
})]
|
|
104
134
|
})
|
|
105
135
|
})
|
|
@@ -110,16 +140,10 @@ var MediaPopup = function MediaPopup(_ref) {
|
|
|
110
140
|
var styles = StyleSheet.create({
|
|
111
141
|
overlay: {
|
|
112
142
|
flex: 1,
|
|
113
|
-
backgroundColor: 'rgba(0, 0, 0, 0.5)',
|
|
114
143
|
justifyContent: 'flex-end'
|
|
115
144
|
},
|
|
116
145
|
container: {
|
|
117
|
-
|
|
118
|
-
borderTopLeftRadius: 20,
|
|
119
|
-
borderTopRightRadius: 20,
|
|
120
|
-
maxHeight: SCREEN_HEIGHT * 0.85,
|
|
121
|
-
minHeight: 200,
|
|
122
|
-
padding: 20,
|
|
146
|
+
width: '100%',
|
|
123
147
|
shadowColor: '#000',
|
|
124
148
|
shadowOffset: {
|
|
125
149
|
width: 0,
|
|
@@ -127,25 +151,22 @@ var styles = StyleSheet.create({
|
|
|
127
151
|
},
|
|
128
152
|
shadowOpacity: 0.25,
|
|
129
153
|
shadowRadius: 3.84,
|
|
130
|
-
elevation: 5
|
|
154
|
+
elevation: 5,
|
|
155
|
+
overflow: 'hidden' // Ensure content doesn't overflow
|
|
131
156
|
},
|
|
132
157
|
header: {
|
|
133
158
|
flexDirection: 'row',
|
|
134
159
|
alignItems: 'center',
|
|
135
160
|
justifyContent: 'space-between',
|
|
136
|
-
|
|
137
|
-
paddingBottom: 12,
|
|
138
|
-
borderBottomWidth: 1,
|
|
139
|
-
borderBottomColor: '#E5E5E5'
|
|
161
|
+
borderBottomWidth: 1
|
|
140
162
|
},
|
|
141
163
|
title: {
|
|
142
|
-
|
|
143
|
-
fontWeight: 'bold',
|
|
144
|
-
color: '#000000'
|
|
164
|
+
flex: 1
|
|
145
165
|
},
|
|
146
166
|
closeButton: {
|
|
147
167
|
padding: 8,
|
|
148
|
-
borderRadius: 20
|
|
168
|
+
borderRadius: 20,
|
|
169
|
+
marginLeft: 12
|
|
149
170
|
}
|
|
150
171
|
});
|
|
151
172
|
export default MediaPopup;
|