mg-library 1.0.720 → 1.0.722
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 +16 -31
- 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, View } from "react-native";
|
|
3
|
-
import { Box, Text, Divider, Button, ButtonText, ButtonIcon, Icon, Popover,
|
|
3
|
+
import { Box, Text, Divider, Button, ButtonText, ButtonIcon, Icon, Popover, PopoverAnchor, PopoverBackdrop, PopoverContent, PopoverArrow, PopoverCloseButton, 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';
|
|
@@ -168,7 +168,7 @@ export function MGButton({
|
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
export function MGPopover(props) {
|
|
171
|
-
const [
|
|
171
|
+
const [open, setOpen] = useState(false);
|
|
172
172
|
const footer = (
|
|
173
173
|
<Box flexDirection="row" justifyContent="space-around" mt="$5" mb="$5">
|
|
174
174
|
<MGButton
|
|
@@ -176,32 +176,30 @@ export function MGPopover(props) {
|
|
|
176
176
|
action="primary"
|
|
177
177
|
variant="solid"
|
|
178
178
|
py="$4"
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
props.callback?.();
|
|
179
|
+
callback={async () => {
|
|
180
|
+
setOpen(false);
|
|
181
|
+
await props.callback?.();
|
|
182
182
|
}}
|
|
183
183
|
/>
|
|
184
184
|
<MGButton
|
|
185
185
|
title={mgFunctionsLib.i18nString("no", props.language)}
|
|
186
186
|
action="primary"
|
|
187
|
-
variant="
|
|
187
|
+
variant="outline"
|
|
188
188
|
py="$4"
|
|
189
|
-
|
|
189
|
+
callback={() => setOpen(false)}
|
|
190
190
|
/>
|
|
191
191
|
</Box>
|
|
192
192
|
);
|
|
193
193
|
return (
|
|
194
|
-
<Popover isOpen={
|
|
195
|
-
<
|
|
196
|
-
{(
|
|
197
|
-
|
|
198
|
-
{props.icon
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
)}
|
|
204
|
-
</PopoverTrigger>
|
|
194
|
+
<Popover isOpen={open} onOpenChange={setOpen}>
|
|
195
|
+
<PopoverAnchor>
|
|
196
|
+
<Button action="primary" variant="solid" py="$4" onPress={() => setOpen(true)}>
|
|
197
|
+
{props.icon ? (
|
|
198
|
+
<Icon as={MaterialCommunityIcons} name={props.icon} mr="$2" color="$white" />
|
|
199
|
+
) : null}
|
|
200
|
+
<ButtonText>{props.title}</ButtonText>
|
|
201
|
+
</Button>
|
|
202
|
+
</PopoverAnchor>
|
|
205
203
|
<PopoverBackdrop />
|
|
206
204
|
<PopoverContent w={300} bg="$white">
|
|
207
205
|
<PopoverArrow />
|
|
@@ -218,17 +216,4 @@ export function MGPopover(props) {
|
|
|
218
216
|
</PopoverContent>
|
|
219
217
|
</Popover>
|
|
220
218
|
);
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export function MGDivider({ style, ...props }) {
|
|
224
|
-
return (
|
|
225
|
-
<Divider
|
|
226
|
-
h="$0.50"
|
|
227
|
-
flexGrow={1}
|
|
228
|
-
alignSelf="stretch"
|
|
229
|
-
bg="$gray300"
|
|
230
|
-
style={style}
|
|
231
|
-
{...props}
|
|
232
|
-
/>
|
|
233
|
-
);
|
|
234
219
|
}
|