React Native image viewing component: react-native-image-viewer, pure JS component, small and fast icon viewing component. Supports image zooming in and out, supports setting replacement images if images fail to load, supports saving images locally, and other functions. This article mainly introduces you to the method of React Native image viewing component, I hope it can help you.
Rendering
Installation method
npm i react-native-image-zoom-viewer --save
Usage example
const images = [ { url: 'https://avatars2.githubusercontent.com/u/7970947?v=3&s=460', }, { url: 'https://avatars2.githubusercontent.com/u/7970947?v=3&s=460', }, { url: 'https://avatars2.githubusercontent.com/u/7970947?v=3&s=460', }, ]; export default class Component06 extends Component { constructor(props) { super(props); } render() { return ( <View style={{ flex: 1 }}> <ImageViewer imageUrls={images} failImageSource={{ url: 'https://avatars2.githubusercontent.com/u/7970947?v=3&s=460', width: Dimensions.get('window').width, height: Dimensions.get('window').width, }} /> </View> ); } }
Main parameter description
imageUrls array of image url addresses
enableImageZoom Whether to allow zooming
failImageSource The image displayed when loading fails
loadingRender loading loading
renderHeader Header style
renderFooter bottom style
renderIndicator page indicator style
Related recommendations:
The above is the detailed content of How to implement picture viewing component in React Native. For more information, please follow other related articles on the PHP Chinese website!