import * as React from 'react'; import { Animated } from 'react-native'; import { Div, Button, Image, Text, Tag, Icon } from 'react-native-magnus'; import { useAnimation } from 'react-native-animation-hooks'; import SvgIcon from './SvgIcon'; const map = new Map([ [ 'bad', { name: '差评', }, ], [ 'good', { name: '好评', }, ], ]); export default function Choose(props) { const { chooseValue, changeValue } = props; const badOpacity = useAnimation({ type: 'timing', initialValue: 1, duration: 100, toValue: chooseValue && chooseValue !== 'bad' ? 0 : 1, }); const goodOpacity = useAnimation({ type: 'timing', initialValue: 1, duration: 100, toValue: chooseValue && chooseValue !== 'good' ? 0 : 1, }); const chooseStyle = { position: 'absolute', left: '50%', transform: [{ translateX: 0 - 53 / 2 }], top: 12, }; return (
{!!chooseValue && ( } color="brand500" onPress={() => changeValue('')} > 当前已选择:{map.get(chooseValue).name} )}
); }