({ x, y, snake }: PixelProps)
| 29 | } |
| 30 | |
| 31 | const Pixel = ({ x, y, snake }: PixelProps) => { |
| 32 | const style = useAnimatedStyle(() => { |
| 33 | const on = |
| 34 | eq({ x, y }, snake.value.food) || contains(snake.value.tail, { x, y }); |
| 35 | return { |
| 36 | backgroundColor: on ? ON : OFF, |
| 37 | }; |
| 38 | }); |
| 39 | return <Animated.View style={[styles.pixel, style]} />; |
| 40 | }; |
| 41 | |
| 42 | export default Pixel; |