fix: tab bar not visible on Android #21
@@ -818,6 +818,9 @@ const styles = StyleSheet.create({
|
|||||||
color: colors.text,
|
color: colors.text,
|
||||||
marginTop: spacing.lg,
|
marginTop: spacing.lg,
|
||||||
},
|
},
|
||||||
|
authTitleTablet: {
|
||||||
|
fontSize: 32,
|
||||||
|
},
|
||||||
authSubtitle: {
|
authSubtitle: {
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
color: colors.textSecondary,
|
color: colors.textSecondary,
|
||||||
@@ -825,11 +828,18 @@ const styles = StyleSheet.create({
|
|||||||
marginTop: spacing.sm,
|
marginTop: spacing.sm,
|
||||||
marginBottom: spacing.xl,
|
marginBottom: spacing.xl,
|
||||||
},
|
},
|
||||||
|
authSubtitleTablet: {
|
||||||
|
fontSize: 18,
|
||||||
|
maxWidth: 400,
|
||||||
|
},
|
||||||
avatarSection: {
|
avatarSection: {
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
padding: spacing.xl,
|
padding: spacing.xl,
|
||||||
backgroundColor: colors.card,
|
backgroundColor: colors.card,
|
||||||
},
|
},
|
||||||
|
avatarSectionTablet: {
|
||||||
|
paddingVertical: spacing.xxl,
|
||||||
|
},
|
||||||
avatarContainer: {
|
avatarContainer: {
|
||||||
width: 100,
|
width: 100,
|
||||||
height: 100,
|
height: 100,
|
||||||
@@ -839,11 +849,21 @@ const styles = StyleSheet.create({
|
|||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
overflow: 'hidden',
|
overflow: 'hidden',
|
||||||
},
|
},
|
||||||
|
avatarContainerTablet: {
|
||||||
|
width: 140,
|
||||||
|
height: 140,
|
||||||
|
borderRadius: 70,
|
||||||
|
},
|
||||||
avatarImage: {
|
avatarImage: {
|
||||||
width: 100,
|
width: 100,
|
||||||
height: 100,
|
height: 100,
|
||||||
borderRadius: 50,
|
borderRadius: 50,
|
||||||
},
|
},
|
||||||
|
avatarImageTablet: {
|
||||||
|
width: 140,
|
||||||
|
height: 140,
|
||||||
|
borderRadius: 70,
|
||||||
|
},
|
||||||
avatarOverlay: {
|
avatarOverlay: {
|
||||||
position: 'absolute',
|
position: 'absolute',
|
||||||
top: 0,
|
top: 0,
|
||||||
@@ -866,6 +886,11 @@ const styles = StyleSheet.create({
|
|||||||
marginTop: spacing.sm,
|
marginTop: spacing.sm,
|
||||||
gap: spacing.md,
|
gap: spacing.md,
|
||||||
},
|
},
|
||||||
|
infoSectionTablet: {
|
||||||
|
maxWidth: 600,
|
||||||
|
alignSelf: 'center',
|
||||||
|
width: '100%',
|
||||||
|
},
|
||||||
infoCard: {
|
infoCard: {
|
||||||
backgroundColor: colors.surfaceLow,
|
backgroundColor: colors.surfaceLow,
|
||||||
padding: spacing.md,
|
padding: spacing.md,
|
||||||
@@ -890,6 +915,11 @@ const styles = StyleSheet.create({
|
|||||||
marginTop: spacing.sm,
|
marginTop: spacing.sm,
|
||||||
backgroundColor: colors.card,
|
backgroundColor: colors.card,
|
||||||
},
|
},
|
||||||
|
menuSectionTablet: {
|
||||||
|
maxWidth: 600,
|
||||||
|
alignSelf: 'center',
|
||||||
|
width: '100%',
|
||||||
|
},
|
||||||
menuItem: {
|
menuItem: {
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
@@ -936,11 +966,18 @@ const styles = StyleSheet.create({
|
|||||||
paddingVertical: spacing.md,
|
paddingVertical: spacing.md,
|
||||||
paddingHorizontal: spacing.xl,
|
paddingHorizontal: spacing.xl,
|
||||||
},
|
},
|
||||||
|
buttonTablet: {
|
||||||
|
paddingVertical: spacing.lg,
|
||||||
|
paddingHorizontal: spacing.xl * 1.5,
|
||||||
|
},
|
||||||
buttonText: {
|
buttonText: {
|
||||||
color: colors.textInverse,
|
color: colors.textInverse,
|
||||||
fontSize: 16,
|
fontSize: 16,
|
||||||
fontWeight: '600',
|
fontWeight: '600',
|
||||||
},
|
},
|
||||||
|
buttonTextTablet: {
|
||||||
|
fontSize: 18,
|
||||||
|
},
|
||||||
linkButton: {
|
linkButton: {
|
||||||
marginTop: spacing.md,
|
marginTop: spacing.md,
|
||||||
},
|
},
|
||||||
@@ -959,6 +996,11 @@ const styles = StyleSheet.create({
|
|||||||
borderWidth: 1,
|
borderWidth: 1,
|
||||||
borderColor: colors.danger,
|
borderColor: colors.danger,
|
||||||
},
|
},
|
||||||
|
logoutButtonTablet: {
|
||||||
|
maxWidth: 600,
|
||||||
|
alignSelf: 'center',
|
||||||
|
width: '100%',
|
||||||
|
},
|
||||||
logoutText: {
|
logoutText: {
|
||||||
marginLeft: spacing.sm,
|
marginLeft: spacing.sm,
|
||||||
color: colors.danger,
|
color: colors.danger,
|
||||||
|
|||||||
@@ -1,26 +1,34 @@
|
|||||||
import React from 'react';
|
import React from 'react';
|
||||||
import { View, Text, StyleSheet, TouchableOpacity } from 'react-native';
|
import { View, Text, StyleSheet, TouchableOpacity, useWindowDimensions } from 'react-native';
|
||||||
import { useRouter } from 'expo-router';
|
import { useRouter } from 'expo-router';
|
||||||
import { Ionicons } from '@expo/vector-icons';
|
import { Ionicons } from '@expo/vector-icons';
|
||||||
import { colors, spacing, borderRadius } from '../constants/theme';
|
import { colors, spacing, borderRadius } from '../constants/theme';
|
||||||
import { StockBadge } from './StockBadge';
|
import { StockBadge } from './StockBadge';
|
||||||
import { Medicine } from '../types';
|
import { Medicine } from '../types';
|
||||||
|
|
||||||
|
const TABLET_MIN_WIDTH = 768;
|
||||||
|
|
||||||
interface MedicineCardProps {
|
interface MedicineCardProps {
|
||||||
medicine: Medicine;
|
medicine: Medicine;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function MedicineCard({ medicine }: MedicineCardProps) {
|
export function MedicineCard({ medicine }: MedicineCardProps) {
|
||||||
const router = useRouter();
|
const router = useRouter();
|
||||||
|
const { width } = useWindowDimensions();
|
||||||
|
const isTablet = width >= TABLET_MIN_WIDTH;
|
||||||
|
|
||||||
const handlePress = () => {
|
const handlePress = () => {
|
||||||
router.push(`/medicine/${medicine.nregistro}`);
|
router.push(`/medicine/${medicine.nregistro}`);
|
||||||
};
|
};
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<TouchableOpacity style={styles.card} onPress={handlePress} activeOpacity={0.7}>
|
<TouchableOpacity
|
||||||
|
style={[styles.card, isTablet && styles.cardTablet]}
|
||||||
|
onPress={handlePress}
|
||||||
|
activeOpacity={0.7}
|
||||||
|
>
|
||||||
<View style={styles.header}>
|
<View style={styles.header}>
|
||||||
<Text style={styles.name} numberOfLines={2}>
|
<Text style={[styles.name, isTablet && styles.nameTablet]} numberOfLines={2}>
|
||||||
{medicine.nombre}
|
{medicine.nombre}
|
||||||
</Text>
|
</Text>
|
||||||
<StockBadge stock={medicine.stock} />
|
<StockBadge stock={medicine.stock} />
|
||||||
@@ -33,14 +41,14 @@ export function MedicineCard({ medicine }: MedicineCardProps) {
|
|||||||
<View style={styles.footer}>
|
<View style={styles.footer}>
|
||||||
<View style={styles.priceContainer}>
|
<View style={styles.priceContainer}>
|
||||||
<Ionicons name="pricetag" size={14} color={colors.textSecondary} />
|
<Ionicons name="pricetag" size={14} color={colors.textSecondary} />
|
||||||
<Text style={styles.price}>
|
<Text style={[styles.price, isTablet && styles.priceTablet]}>
|
||||||
{medicine.precio ? `${medicine.precio.toFixed(2)} €` : 'Sin precio'}
|
{medicine.precio ? `${medicine.precio.toFixed(2)} €` : 'Sin precio'}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
|
|
||||||
<View style={styles.labContainer}>
|
<View style={styles.labContainer}>
|
||||||
<Ionicons name="business" size={14} color={colors.textSecondary} />
|
<Ionicons name="business" size={14} color={colors.textSecondary} />
|
||||||
<Text style={styles.laboratorio} numberOfLines={1}>
|
<Text style={[styles.laboratorio, isTablet && styles.laboratorioTablet]} numberOfLines={1}>
|
||||||
{medicine.laboratorio}
|
{medicine.laboratorio}
|
||||||
</Text>
|
</Text>
|
||||||
</View>
|
</View>
|
||||||
@@ -62,6 +70,12 @@ const styles = StyleSheet.create({
|
|||||||
shadowRadius: 8,
|
shadowRadius: 8,
|
||||||
elevation: 2,
|
elevation: 2,
|
||||||
},
|
},
|
||||||
|
cardTablet: {
|
||||||
|
padding: spacing.lg,
|
||||||
|
maxWidth: 700,
|
||||||
|
alignSelf: 'center',
|
||||||
|
width: '100%',
|
||||||
|
},
|
||||||
header: {
|
header: {
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
justifyContent: 'space-between',
|
justifyContent: 'space-between',
|
||||||
@@ -75,6 +89,9 @@ const styles = StyleSheet.create({
|
|||||||
color: colors.text,
|
color: colors.text,
|
||||||
marginRight: spacing.sm,
|
marginRight: spacing.sm,
|
||||||
},
|
},
|
||||||
|
nameTablet: {
|
||||||
|
fontSize: 18,
|
||||||
|
},
|
||||||
principioActivo: {
|
principioActivo: {
|
||||||
fontSize: 14,
|
fontSize: 14,
|
||||||
color: colors.textSecondary,
|
color: colors.textSecondary,
|
||||||
@@ -95,6 +112,9 @@ const styles = StyleSheet.create({
|
|||||||
color: colors.primary,
|
color: colors.primary,
|
||||||
marginLeft: spacing.xs,
|
marginLeft: spacing.xs,
|
||||||
},
|
},
|
||||||
|
priceTablet: {
|
||||||
|
fontSize: 16,
|
||||||
|
},
|
||||||
labContainer: {
|
labContainer: {
|
||||||
flexDirection: 'row',
|
flexDirection: 'row',
|
||||||
alignItems: 'center',
|
alignItems: 'center',
|
||||||
@@ -107,4 +127,8 @@ const styles = StyleSheet.create({
|
|||||||
marginLeft: spacing.xs,
|
marginLeft: spacing.xs,
|
||||||
maxWidth: 120,
|
maxWidth: 120,
|
||||||
},
|
},
|
||||||
|
laboratorioTablet: {
|
||||||
|
fontSize: 14,
|
||||||
|
maxWidth: 200,
|
||||||
|
},
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user