mg-library 1.0.718 → 1.0.720

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 +20 -29
  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, PopoverContent, PopoverArrow, PopoverCloseButton, PopoverBody, PopoverFooter } from '@gluestack-ui/themed';
3
+ import { Box, Text, Divider, Button, ButtonText, ButtonIcon, Icon, Popover, PopoverTrigger, 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';
@@ -170,63 +170,54 @@ export function MGButton({
170
170
  export function MGPopover(props) {
171
171
  const [visible, setVisible] = useState(false);
172
172
  const footer = (
173
- <View style={{ flexGrow: 1, flexDirection: 'row', justifyContent: 'space-around', marginTop: 20, marginBottom: 20 }}>
173
+ <Box flexDirection="row" justifyContent="space-around" mt="$5" mb="$5">
174
174
  <MGButton
175
- title={mgFunctionsLib.i18nString('yes', props.language)}
175
+ title={mgFunctionsLib.i18nString("yes", props.language)}
176
176
  action="primary"
177
177
  variant="solid"
178
178
  py="$4"
179
- style={{ flexGrow: 0.3 }}
180
179
  onPress={() => {
181
180
  setVisible(false);
182
- props.callback();
181
+ props.callback?.();
183
182
  }}
184
183
  />
185
184
  <MGButton
186
- title={mgFunctionsLib.i18nString('no', props.language)}
185
+ title={mgFunctionsLib.i18nString("no", props.language)}
187
186
  action="primary"
188
187
  variant="solid"
189
188
  py="$4"
190
- style={{ flexGrow: 0.3 }}
191
189
  onPress={() => setVisible(false)}
192
190
  />
193
- </View>
191
+ </Box>
194
192
  );
195
193
  return (
196
- <Popover isOpen={visible} onClose={() => setVisible(false)}>
194
+ <Popover isOpen={visible} onOpenChange={setVisible}>
197
195
  <PopoverTrigger>
198
- <MGButton
199
- icon={props.icon}
200
- title={props.title}
201
- action="primary"
202
- variant="solid"
203
- py="$4"
204
- onPress={() => setVisible(true)}
205
- />
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
+ )}
206
204
  </PopoverTrigger>
205
+ <PopoverBackdrop />
207
206
  <PopoverContent w={300} bg="$white">
208
207
  <PopoverArrow />
209
208
  <PopoverCloseButton />
210
209
  <PopoverBody>
211
210
  <Box alignItems="center" justifyContent="center">
212
- <Icon
213
- as={MaterialCommunityIcons}
214
- name="alert-outline"
215
- size={16}
216
- color="$primary500"
217
- mb="$3"
218
- />
211
+ <Icon as={MaterialCommunityIcons} name="alert-outline" size={16} color="$primary500" mb="$3" />
219
212
  <MGText textAlign="center">
220
- {mgFunctionsLib.i18nString('confirm', props.language)}?
213
+ {mgFunctionsLib.i18nString("confirm", props.language)}?
221
214
  </MGText>
222
215
  </Box>
223
216
  </PopoverBody>
224
- <PopoverFooter>
225
- {footer}
226
- </PopoverFooter>
217
+ <PopoverFooter>{footer}</PopoverFooter>
227
218
  </PopoverContent>
228
219
  </Popover>
229
- )
220
+ );
230
221
  }
231
222
 
232
223
  export function MGDivider({ style, ...props }) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "mg-library",
3
- "version": "1.0.718",
3
+ "version": "1.0.720",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "react-native": "index.js",