Skip to content
This repository has been archived by the owner on Jan 28, 2024. It is now read-only.

Commit

Permalink
feat: updated example tsx
Browse files Browse the repository at this point in the history
  • Loading branch information
killi8n committed Nov 4, 2020
1 parent 9b2995c commit 928320e
Showing 1 changed file with 30 additions and 8 deletions.
38 changes: 30 additions & 8 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import * as React from 'react';
import { StyleSheet, Button, SafeAreaView, Image } from 'react-native';
import { StyleSheet, Button, SafeAreaView, Image, Text } from 'react-native';
import ImageSelector, {
ImageSelectorCallbackResponse,
} from 'react-native-image-selector';
Expand All @@ -17,7 +17,6 @@ export default function App() {
console.log(error);
return;
}
console.log(response);
setResponse(response);
}
);
Expand All @@ -30,12 +29,26 @@ export default function App() {
<SafeAreaView style={styles.container}>
<Button title="GET USER PHOTOS" onPress={handlePhotos} />
{response !== null && (
<Image
style={{ width: 150, height: 150 }}
source={{
uri: response.uri,
}}
/>
<>
<Text style={styles.textStyle}>Base64 Image</Text>
<Image
style={styles.imageStyle}
source={{
uri: `data:image/png;base64,${response.data}`,
}}
/>
<Text style={styles.textStyle}>URI Image</Text>
<Image
style={styles.imageStyle}
source={{
uri: response.uri,
}}
/>
<Text style={styles.textStyle}>path: {response.path}</Text>
<Text style={styles.textStyle}>fileName: {response.fileName}</Text>
<Text style={styles.textStyle}>fileSize: {response.fileSize}</Text>
<Text style={styles.textStyle}>fileType: {response.type}</Text>
</>
)}
</SafeAreaView>
);
Expand All @@ -47,4 +60,13 @@ const styles = StyleSheet.create({
alignItems: 'center',
justifyContent: 'center',
},
textStyle: {
marginTop: 15,
},
imageStyle: {
width: 150,
height: 150,
borderWidth: 1,
borderColor: '#ababab',
},
});

0 comments on commit 928320e

Please sign in to comment.