react-native-imageview-cache
Version:
react native image with cache
46 lines (45 loc) • 1.74 kB
JavaScript
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
/**
* Created by WheelerLee on 2019-08-06 14:20.
* Contacts
* Copyright 2019 https://github.com/WheelerLee
*/
import React from 'react';
import { Component } from 'react';
import { View, requireNativeComponent, StyleSheet } from 'react-native';
var RNImageView = requireNativeComponent("RNImageView");
/**
* 网络图片加载组件,自动包含缓存
*/
var ImageView = /** @class */ (function (_super) {
__extends(ImageView, _super);
function ImageView(props) {
return _super.call(this, props) || this;
}
ImageView.prototype.render = function () {
var _this = this;
return (<View style={[styles.container, this.props.style]}>
<RNImageView {...this.props} onProgress={function (event) { return _this.props.onProgress && _this.props.onProgress(event['nativeEvent']); }} onError={function (event) { return _this.props.onError && _this.props.onError(event['nativeEvent']); }} style={{ flex: 1 }}/>
</View>);
};
return ImageView;
}(Component));
export default ImageView;
var styles = StyleSheet.create({
container: {
overflow: 'hidden',
alignItems: 'stretch'
}
});