import React, { PropTypes } from 'react' import { requireNativeComponent, Image, View } from 'react-native' const resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource') const FastImage = ({ source, onError, onLoad, ...props }) => { // If there's no source or source uri just fallback to Image. if (!source || !source.uri) { return ( ) } const resolvedSource = resolveAssetSource(source) return ( ) } FastImage.resizeMode = { contain: 'contain', cover: 'cover', stretch: 'stretch', center: 'center', } FastImage.priority = { low: 'low', normal: 'normal', high: 'high', } const FastImageSourcePropType = PropTypes.shape({ uri: PropTypes.string, headers: PropTypes.objectOf(PropTypes.string), priority: PropTypes.oneOf(Object.keys(FastImage.priority)), }) FastImage.propTypes = { ...View.propTypes, source: FastImageSourcePropType, } FastImage.defaultProps = { resizeMode: FastImage.resizeMode.cover, onLoad: Function.prototype, onError: Function.prototype, } const FastImageView = requireNativeComponent('FastImageView', FastImage, { nativeOnly: { onError: true, onLoad: true }, }) export default FastImage