mg-library 1.0.726 → 1.0.728
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/components.js +27 -35
- package/mg-library.rar +0 -0
- package/package.json +1 -1
package/components.js
CHANGED
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import React, { useRef, useState } from "react";
|
|
2
2
|
import { Platform, Animated, View } from "react-native";
|
|
3
|
-
import { Box, Text, Divider,
|
|
3
|
+
import { Box, Text, Divider, ButtonIcon, Icon, Popover, PopoverTrigger, PopoverBackdrop, PopoverContent, PopoverArrow, PopoverCloseButton, PopoverBody, PopoverFooter } from '@gluestack-ui/themed';
|
|
4
|
+
import { Button, ButtonText } from '@gluestack-ui/button';
|
|
4
5
|
import MaterialCommunityIcons from 'react-native-vector-icons/MaterialCommunityIcons';
|
|
5
6
|
|
|
6
7
|
import * as mgFunctionsLib from './functions.js';
|
|
@@ -168,41 +169,23 @@ export function MGButton({
|
|
|
168
169
|
}
|
|
169
170
|
|
|
170
171
|
export function MGPopover(props) {
|
|
172
|
+
const { title, icon, language, callback } = props;
|
|
171
173
|
const [open, setOpen] = useState(false);
|
|
172
|
-
const
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
callback={async () => {
|
|
180
|
-
setOpen(false);
|
|
181
|
-
await props.callback?.();
|
|
182
|
-
}}
|
|
183
|
-
/>
|
|
184
|
-
<MGButton
|
|
185
|
-
title={mgFunctionsLib.i18nString("no", props.language)}
|
|
186
|
-
action="primary"
|
|
187
|
-
variant="outline"
|
|
188
|
-
py="$4"
|
|
189
|
-
callback={() => setOpen(false)}
|
|
190
|
-
/>
|
|
191
|
-
</Box>
|
|
192
|
-
);
|
|
174
|
+
const handleConfirm = async () => {
|
|
175
|
+
try {
|
|
176
|
+
await callback?.();
|
|
177
|
+
} finally {
|
|
178
|
+
setOpen(false);
|
|
179
|
+
}
|
|
180
|
+
};
|
|
193
181
|
return (
|
|
194
|
-
<Popover
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
{props.icon ? (
|
|
200
|
-
<Icon as={MaterialCommunityIcons} name={props.icon} mr="$2" color="$white" />
|
|
201
|
-
) : null}
|
|
202
|
-
<ButtonText>{props.title}</ButtonText>
|
|
182
|
+
<Popover isOpen={open} onOpenChange={setOpen}>
|
|
183
|
+
<PopoverTrigger>
|
|
184
|
+
<Button action="primary" variant="solid" onPress={() => setOpen(true)}>
|
|
185
|
+
{icon ? <Icon as={MaterialCommunityIcons} name={icon} mr="$2" color="$white" /> : null}
|
|
186
|
+
<ButtonText>{title}</ButtonText>
|
|
203
187
|
</Button>
|
|
204
|
-
|
|
205
|
-
>
|
|
188
|
+
</PopoverTrigger>
|
|
206
189
|
<PopoverBackdrop />
|
|
207
190
|
<PopoverContent w={300} bg="$white">
|
|
208
191
|
<PopoverArrow />
|
|
@@ -211,11 +194,20 @@ export function MGPopover(props) {
|
|
|
211
194
|
<Box alignItems="center" justifyContent="center">
|
|
212
195
|
<Icon as={MaterialCommunityIcons} name="alert-outline" size={16} color="$primary500" mb="$3" />
|
|
213
196
|
<MGText textAlign="center">
|
|
214
|
-
{mgFunctionsLib.i18nString(
|
|
197
|
+
{mgFunctionsLib.i18nString('confirm', language)}?
|
|
215
198
|
</MGText>
|
|
216
199
|
</Box>
|
|
217
200
|
</PopoverBody>
|
|
218
|
-
<PopoverFooter>
|
|
201
|
+
<PopoverFooter>
|
|
202
|
+
<Box flexDirection="row" justifyContent="space-around" mt="$5" mb="$5">
|
|
203
|
+
<Button action="primary" variant="solid" py="$4" onPress={handleConfirm}>
|
|
204
|
+
<ButtonText>{mgFunctionsLib.i18nString('yes', language)}</ButtonText>
|
|
205
|
+
</Button>
|
|
206
|
+
<Button action="primary" variant="outline" py="$4" onPress={() => setOpen(false)}>
|
|
207
|
+
<ButtonText>{mgFunctionsLib.i18nString('no', language)}</ButtonText>
|
|
208
|
+
</Button>
|
|
209
|
+
</Box>
|
|
210
|
+
</PopoverFooter>
|
|
219
211
|
</PopoverContent>
|
|
220
212
|
</Popover>
|
|
221
213
|
);
|
package/mg-library.rar
CHANGED
|
Binary file
|