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.
Files changed (2) hide show
  1. package/components.js +16 -31
  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, View } from "react-native";
3
- import { Box, Text, Divider, Button, ButtonText, ButtonIcon, Icon, Popover, PopoverTrigger, PopoverBackdrop, PopoverContent, PopoverArrow, PopoverCloseButton, PopoverBody, PopoverFooter } from '@gluestack-ui/themed';
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 [visible, setVisible] = useState(false);
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
- onPress={() => {
180
- setVisible(false);
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="solid"
187
+ variant="outline"
188
188
  py="$4"
189
- onPress={() => setVisible(false)}
189
+ callback={() => setOpen(false)}
190
190
  />
191
191
  </Box>
192
192
  );
193
193
  return (
194
- <Popover isOpen={visible} onOpenChange={setVisible}>
195
- <PopoverTrigger>
196
- {(triggerProps) => (
197
- <Button {...triggerProps} action="primary" variant="solid" py="$4">
198
- {props.icon ? (
199
- <Icon as={MaterialCommunityIcons} name={props.icon} mr="$2" color="$white" />
200
- ) : null}
201
- <ButtonText>{props.title}</ButtonText>
202
- </Button>
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
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mg-library",
3
- "version": "1.0.720",
3
+ "version": "1.0.722",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "react-native": "index.js",