mg-library 1.0.799 → 1.0.800

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 (2) hide show
  1. package/components.js +46 -4
  2. package/package.json +1 -1
package/components.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import React, { useRef, useState } from "react";
2
2
  import { Platform, Animated } from "react-native";
3
- import { Box, Text, Divider, Button, ButtonText, ButtonIcon, Icon, Popover, PopoverTrigger, PopoverBackdrop, PopoverContent, PopoverArrow, PopoverBody, PopoverFooter } from '@gluestack-ui/themed';
3
+ import { AlertDialog, AlertDialogBackdrop, AlertDialogContent, AlertDialogBody, AlertDialogFooter, Box, Text, Divider, Button, ButtonText, ButtonIcon, Icon, Popover, PopoverTrigger, PopoverBackdrop, PopoverContent, PopoverArrow, PopoverBody, PopoverFooter } from '@gluestack-ui/themed';
4
4
  import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
5
5
 
6
6
  import * as mgFunctionsLib from './functions.js';
@@ -167,7 +167,7 @@ export function MGButton({
167
167
  );
168
168
  }
169
169
 
170
- export function MGPopover(props) {
170
+ /* export function MGPopover(props) {
171
171
  const { title, icon, language, callback } = props;
172
172
  const [open, setOpen] = useState(false);
173
173
 
@@ -219,6 +219,48 @@ export function MGPopover(props) {
219
219
  </PopoverContent>
220
220
  </Popover>
221
221
  );
222
+ } */
223
+
224
+ export function MGPopover(props) {
225
+ const { title, icon, language, callback } = props;
226
+ const [open, setOpen] = useState(false);
227
+ const handleConfirm = async () => {
228
+ try { await callback?.(); } finally { setOpen(false); }
229
+ };
230
+ return (
231
+ <>
232
+ <Button
233
+ action="primary"
234
+ variant="solid"
235
+ h={50}
236
+ onPress={() => setOpen(true)}
237
+ >
238
+ {icon ? <Icon as={MaterialCommunityIcons} name={icon} mr="$2" color="$white" /> : null}
239
+ <ButtonText>{title}</ButtonText>
240
+ </Button>
241
+ <AlertDialog isOpen={open} onClose={() => setOpen(false)}>
242
+ <AlertDialogBackdrop />
243
+ <AlertDialogContent>
244
+ <AlertDialogBody>
245
+ <Box alignItems="center">
246
+ <Icon as={MaterialCommunityIcons} name="alert-outline" size={48} mb="$3" />
247
+ <MGText textAlign="center">
248
+ {mgFunctionsLib.i18nString('confirm', language)}?
249
+ </MGText>
250
+ </Box>
251
+ </AlertDialogBody>
252
+ <AlertDialogFooter>
253
+ <Button onPress={handleConfirm}>
254
+ <ButtonText>{mgFunctionsLib.i18nString('yes', language)}</ButtonText>
255
+ </Button>
256
+ <Button variant="outline" onPress={() => setOpen(false)}>
257
+ <ButtonText>{mgFunctionsLib.i18nString('no', language)}</ButtonText>
258
+ </Button>
259
+ </AlertDialogFooter>
260
+ </AlertDialogContent>
261
+ </AlertDialog>
262
+ </>
263
+ );
222
264
  }
223
265
 
224
266
  export function MGDivider({ style, ...props }) {
@@ -227,9 +269,9 @@ export function MGDivider({ style, ...props }) {
227
269
  h="$0.55"
228
270
  flexGrow={1}
229
271
  alignSelf="stretch"
230
- style={style}
272
+ style={style}
231
273
  {...props}
232
- bg="$gray400"
274
+ bg="$gray400"
233
275
  />
234
276
  );
235
277
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mg-library",
3
- "version": "1.0.799",
3
+ "version": "1.0.800",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "react-native": "index.js",