Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 | 2x 1x 2x 1x | import { StyleSheet, View } from 'react-native';
import { Card, Text, YStack } from 'tamagui';
import type { Additive } from '@/src/lib/supabase';
import { AdditiveBubble } from './AdditiveBubble';
interface AdditiveSectionProps {
additives: Additive[];
onAdditivePress: (additive: Additive) => void;
}
export function AdditiveSection({ additives, onAdditivePress }: AdditiveSectionProps) {
if (!additives || additives.length === 0) return null;
return (
<Card
padding="$4"
marginHorizontal="$3"
marginBottom="$3"
backgroundColor="white"
borderRadius="$5"
bordered
borderColor="$gray4"
>
<YStack gap="$3">
<Text fontSize="$6" fontWeight="600" color="$color">
添加剂成分
</Text>
<Text fontSize="$2" color="$gray10">
点击气泡查看详情
</Text>
<View style={styles.bubblesContainer}>
{additives.map((additive, index) => (
<AdditiveBubble
key={index}
additive={additive}
index={index}
total={additives.length}
onPress={onAdditivePress}
/>
))}
</View>
</YStack>
</Card>
);
}
const styles = StyleSheet.create({
bubblesContainer: {
height: 300,
alignItems: 'center',
justifyContent: 'center',
position: 'relative',
},
});
|