diff --git a/packages/components/src/ActionGroup/ActionGroupButtons.js b/packages/components/src/ActionGroup/ActionGroupButtons.js index a69432f7..3d0a73ce 100755 --- a/packages/components/src/ActionGroup/ActionGroupButtons.js +++ b/packages/components/src/ActionGroup/ActionGroupButtons.js @@ -1,19 +1,31 @@ import React from 'react'; -import { View } from 'react-native'; +import { Dimensions, View } from 'react-native'; -import { Button, FAB, MD3LightTheme } from '@jmstechnologiesinc/react-native-paper'; +import { Button, FAB, MD3LightTheme, } from '@jmstechnologiesinc/react-native-paper'; import { itemSeparator } from '../utils'; const isPrimaryButton = (buttonLength, index) => index === buttonLength - 1; +const isGreaterThan = (arr) => { + return arr.some(item => { + const numericValue = parseFloat(item.title.replace('Update ·', '').replace('$', '').trim().replace(',', '')); + return numericValue >= 1000; + }); +} + const ActionGroupButtons = ({ buttons, isLoading, isStretched = false, style, onPress, variant = 'button' }) => { + + const { width } = Dimensions.get('window'); + if (!buttons.length) { return null; } + const isGreaterText = width <= 600 && isGreaterThan(buttons) ? 1.2 : 1 + return ( - + {buttons.map((button, index) => { return ( onPress?.(button)} @@ -51,11 +63,12 @@ const ActionGroupButtons = ({ buttons, isLoading, isStretched = false, style, on button.mode ? button.mode : isPrimaryButton(buttons.length, index) - ? 'contained' - : 'outlined' + ? 'contained' + : 'outlined' } icon={button.icon} onPress={() => onPress?.(button)} + > {button.title} diff --git a/packages/components/src/Localization/Translations/en.json b/packages/components/src/Localization/Translations/en.json index 4e237335..d3579730 100644 --- a/packages/components/src/Localization/Translations/en.json +++ b/packages/components/src/Localization/Translations/en.json @@ -160,6 +160,7 @@ "appRequiresGeolocation": "This app needs your location to recommend nearby vendors around you, and provide positioning services, such as precise driver monitoring, real-time arrival estimate and delivery options.", "addLocation": "Add Location", "pleaseTryagain": "Please try again", + "anErrorOccurred": "An Error Occurred", "requestProcessingError": "An error occured while procesing your request.", "industries": "Industries", "isLoading": "Loading...", diff --git a/packages/components/src/Localization/Translations/es.json b/packages/components/src/Localization/Translations/es.json index e2624a5b..96301041 100644 --- a/packages/components/src/Localization/Translations/es.json +++ b/packages/components/src/Localization/Translations/es.json @@ -161,6 +161,7 @@ "appRequiresGeolocation": "Esta aplicación necesita su ubicación para recomendar vendedores cercanos a su alrededor y brindar servicios de posicionamiento, como monitoreo preciso del conductor, estimación de llegada en tiempo real y opciones de entrega.", "addLocation": "Agregar ubicación", "pleaseTryagain": "Por favor, inténtalo de nuevo", + "anErrorOccurred": "Hubo un Error", "requestProcessingError": "Se produjo un error al procesar tu solicitud.", "industries": "Industrias", "isLoading": "Cargando...",