mg-library 1.0.800 → 1.0.801

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 +84 -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,92 @@ 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
+ >
265
+ <AlertDialogBody>
266
+ <Box alignItems="center" justifyContent="center" py="$2">
267
+ <Icon
268
+ as={MaterialCommunityIcons}
269
+ name="alert-outline"
270
+ size={48}
271
+ color="$primary500"
272
+ mb="$3"
273
+ />
274
+ <MGText textAlign="center">
275
+ {mgFunctionsLib.i18nString('confirm', language)}?
276
+ </MGText>
277
+ </Box>
278
+ </AlertDialogBody>
279
+ <AlertDialogFooter>
280
+ <Box
281
+ flex={1}
282
+ flexDirection="row"
283
+ justifyContent="space-around"
284
+ mt="$2"
285
+ mb="$2"
286
+ w="$full"
287
+ >
288
+ <Button
289
+ h={50}
290
+ action="primary"
291
+ variant="solid"
292
+ onPress={handleConfirm}
293
+ >
294
+ <ButtonText>
295
+ {mgFunctionsLib.i18nString('yes', language)}
296
+ </ButtonText>
297
+ </Button>
298
+ <Button
299
+ h={50}
300
+ action="primary"
301
+ variant="outline"
302
+ onPress={() => setOpen(false)}
303
+ >
304
+ <ButtonText>
305
+ {mgFunctionsLib.i18nString('no', language)}
306
+ </ButtonText>
307
+ </Button>
308
+ </Box>
309
+ </AlertDialogFooter>
310
+ </AlertDialogContent>
311
+ </AlertDialog>
312
+ </>
313
+ </OverlayProvider>
263
314
  );
264
315
  }
265
316
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mg-library",
3
- "version": "1.0.800",
3
+ "version": "1.0.801",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "react-native": "index.js",