mg-library 1.0.800 → 1.0.802

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 +85 -33
  2. package/package.json +1 -1
package/components.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import React, { useRef, useState } from "react";
2
2
  import { Platform, Animated } from "react-native";
3
+ import { OverlayProvider } from '@react-native-aria/overlays';
3
4
  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
5
  import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
5
6
 
@@ -224,42 +225,93 @@ export function MGButton({
224
225
  export function MGPopover(props) {
225
226
  const { title, icon, language, callback } = props;
226
227
  const [open, setOpen] = useState(false);
228
+
227
229
  const handleConfirm = async () => {
228
- try { await callback?.(); } finally { setOpen(false); }
230
+ try {
231
+ await callback?.();
232
+ } finally {
233
+ setOpen(false);
234
+ }
229
235
  };
236
+
230
237
  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
- </>
238
+ <OverlayProvider>
239
+ <>
240
+ <Button
241
+ action="primary"
242
+ variant="solid"
243
+ h={50}
244
+ onPress={() => setOpen(true)}
245
+ >
246
+ {icon ? (
247
+ <Icon
248
+ as={MaterialCommunityIcons}
249
+ name={icon}
250
+ mr="$2"
251
+ color="$white"
252
+ />
253
+ ) : null}
254
+ <ButtonText>{title}</ButtonText>
255
+ </Button>
256
+ <AlertDialog
257
+ isOpen={open}
258
+ onClose={() => setOpen(false)}
259
+ >
260
+ <AlertDialogBackdrop />
261
+ <AlertDialogContent
262
+ w={300}
263
+ alignSelf="center"
264
+ justifyContent="center"
265
+ >
266
+ <AlertDialogBody>
267
+ <Box alignItems="center" justifyContent="center" py="$2">
268
+ <Icon
269
+ as={MaterialCommunityIcons}
270
+ name="alert-outline"
271
+ size={48}
272
+ color="$primary500"
273
+ mb="$3"
274
+ />
275
+ <MGText textAlign="center">
276
+ {mgFunctionsLib.i18nString('confirm', language)}?
277
+ </MGText>
278
+ </Box>
279
+ </AlertDialogBody>
280
+ <AlertDialogFooter>
281
+ <Box
282
+ flex={1}
283
+ flexDirection="row"
284
+ justifyContent="space-around"
285
+ mt="$2"
286
+ mb="$2"
287
+ w="$full"
288
+ >
289
+ <Button
290
+ h={50}
291
+ action="primary"
292
+ variant="solid"
293
+ onPress={handleConfirm}
294
+ >
295
+ <ButtonText>
296
+ {mgFunctionsLib.i18nString('yes', language)}
297
+ </ButtonText>
298
+ </Button>
299
+ <Button
300
+ h={50}
301
+ action="primary"
302
+ variant="outline"
303
+ onPress={() => setOpen(false)}
304
+ >
305
+ <ButtonText>
306
+ {mgFunctionsLib.i18nString('no', language)}
307
+ </ButtonText>
308
+ </Button>
309
+ </Box>
310
+ </AlertDialogFooter>
311
+ </AlertDialogContent>
312
+ </AlertDialog>
313
+ </>
314
+ </OverlayProvider>
263
315
  );
264
316
  }
265
317
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mg-library",
3
- "version": "1.0.800",
3
+ "version": "1.0.802",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "react-native": "index.js",