1.7.1 • Published 6 years ago
rc-image-previewer v1.7.1
ImagePreviewer
How to use
Install package:
npm install --save rc-image-previewer
Import to your app:
import ImagePreviewer from 'rc-image-previewer';
Use the component:
const { width } = Dimensions.get('window');
export default class App extends React.Component {
render() {
const ImgWidth = width;
const ImgHeight = ImgWidth * 0.6;
return (
<View style={{
flex: 1,
backgroundColor: '#fff',
alignItems: 'center',
justifyContent: 'center',
}}>
<ImagePreviewer
source={MountHuang}
style={{
width: ImgWidth,
height: ImgHeight,
}}
resizeMode="stretch"
/>
</View>
);
}
}
API
API table
API name | Usage |
---|---|
style | The style of element. |
source | The image source, same as source. |
resizeMode | The image resize mode, default is contain.(Optional) |