33#### Responsive Remote Image
44
55``` jsx
6- import React from ' react' ;
7- import { Image , View } from ' react-native' ;
8- import { useResponsiveImageView } from ' react-native-responsive-image-view' ;
6+ import React from " react" ;
7+ import { Image , View } from " react-native" ;
8+ import { useResponsiveImageView } from " react-native-responsive-image-view" ;
99
1010const MyComponent = ({ imageUri }) => {
1111 const { getViewProps , getImageProps } = useResponsiveImageView ({
@@ -23,10 +23,10 @@ const MyComponent = ({ imageUri }) => {
2323#### Fixed (Controlled) Aspect Ratio and Local Image Resource
2424
2525``` jsx
26- import React from ' react' ;
27- import { Image , View } from ' react-native' ;
28- import { useResponsiveImageView } from ' react-native-responsive-image-view' ;
29- import headerImage from ' ./header.jpg' ;
26+ import React from " react" ;
27+ import { Image , View } from " react-native" ;
28+ import { useResponsiveImageView } from " react-native-responsive-image-view" ;
29+ import headerImage from " ./header.jpg" ;
3030
3131const DrawerHeader = () => {
3232 const { getViewProps , getImageProps } = useResponsiveImageView ({
@@ -45,9 +45,9 @@ const DrawerHeader = () => {
4545#### Touchable
4646
4747``` jsx
48- import React from ' react' ;
49- import { Image , TouchableHighlight , View } from ' react-native' ;
50- import { useResponsiveImageView } from ' react-native-responsive-image-view' ;
48+ import React from " react" ;
49+ import { Image , TouchableHighlight , View } from " react-native" ;
50+ import { useResponsiveImageView } from " react-native-responsive-image-view" ;
5151
5252const MyTouchableComponent = ({ imageUri, onPress }) => {
5353 const { getViewProps , getImageProps } = useResponsiveImageView ({
@@ -67,14 +67,15 @@ const MyTouchableComponent = ({ imageUri, onPress }) => {
6767#### Loading and Error Handling
6868
6969``` jsx
70- import React from ' react' ;
71- import { ActivityIndicator , Image , Text , Button , View } from ' react-native' ;
72- import { useResponsiveImageView } from ' react-native-responsive-image-view' ;
70+ import React from " react" ;
71+ import { ActivityIndicator , Image , Text , Button , View } from " react-native" ;
72+ import { useResponsiveImageView } from " react-native-responsive-image-view" ;
7373
7474const MyComponent = ({ imageUri }) => {
75- const { error , loading , retry , getViewProps , getImageProps } = useResponsiveImageView ({
76- source: { uri: imageUri },
77- });
75+ const { error , loading , retry , getViewProps , getImageProps } =
76+ useResponsiveImageView ({
77+ source: { uri: imageUri },
78+ });
7879
7980 if (loading) {
8081 return < ActivityIndicator animating= {true } size= " large" / > ;
@@ -100,16 +101,16 @@ const MyComponent = ({ imageUri }) => {
100101#### Composing Props
101102
102103``` jsx
103- import React from ' react' ;
104- import { StyleSheet , Image , View } from ' react-native' ;
105- import { useResponsiveImageView } from ' react-native-responsive-image-view' ;
104+ import React from " react" ;
105+ import { StyleSheet , Image , View } from " react-native" ;
106+ import { useResponsiveImageView } from " react-native-responsive-image-view" ;
106107
107108const styles = StyleSheet .create ({
108109 imageContainer: {
109110 padding: 20 , // will be merged into RNRIV View props!
110111 },
111112 image: {
112- width: ' 50%' , // will be overwritten by RNRIV Image props!
113+ width: " 50%" , // will be overwritten by RNRIV Image props!
113114 },
114115});
115116
@@ -129,13 +130,13 @@ const MyComponent = ({ imageUri }) => {
129130#### Success/Failure Callbacks
130131
131132``` jsx
132- import React from ' react' ;
133- import { Image , Text , View } from ' react-native' ;
134- import { useResponsiveImageView } from ' react-native-responsive-image-view' ;
133+ import React from " react" ;
134+ import { Image , Text , View } from " react-native" ;
135+ import { useResponsiveImageView } from " react-native-responsive-image-view" ;
135136
136137const MyComponentWithCallbacks = ({ imageUri }) => {
137138 const onLoad = React .useCallback (() => {
138- console .log (' Image has been loaded.' );
139+ console .log (" Image has been loaded." );
139140 }, []);
140141
141142 const onError = React .useCallback ((err ) => {
0 commit comments