UNPKG

@fto-consult/expo-ui

Version:

Bibliothèque de composants UI Expo,react-native

22 lines (16 loc) • 530 B
import React from 'react'; import { Animated, Image, ImageBackground } from 'react-native'; function AnimatableImage(props) { const { animated, children, ...rest } = props; const ImageComponent = children ? ImageBackground : animated ? Animated.Image : Image; return <ImageComponent {...rest}>{children}</ImageComponent>; } AnimatableImage.propTypes = Image.propTypes | Animated.Image.propTypes; AnimatableImage.defaultProps = { animated: false }; export default AnimatableImage;