Skip to content

Commit 4e4fad3

Browse files
committed
Abstracted the image view for storage
1 parent 4e5beb1 commit 4e4fad3

File tree

2 files changed

+24
-26
lines changed

2 files changed

+24
-26
lines changed

app/views/Storage/Demos/Upload.js

Lines changed: 2 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -7,29 +7,12 @@ import {
77
} from 'react-native'
88

99
import {
10-
Container, Header, Title, Content, Button,
11-
Card, CardItem, Spinner
10+
Container, Header, Title, Content, Button, Spinner
1211
} from 'native-base';
1312
import appStyles from '../../../styles/app';
13+
import { UploadedImage } from '../components/UploadedImage';
1414
const cat = require('image!cat');
1515

16-
const UploadedImage = ({image}) => {
17-
console.log('uploadedImage ->', image);
18-
return (
19-
<Card>
20-
<CardItem>
21-
<Text>Uploaded file</Text>
22-
</CardItem>
23-
24-
<CardItem>
25-
<Image
26-
style={{ resizeMode: 'cover' }}
27-
source={image} />
28-
</CardItem>
29-
</Card>
30-
)
31-
}
32-
3316
export class UploadDemo extends React.Component {
3417

3518
constructor(props) {
@@ -86,13 +69,6 @@ export class UploadDemo extends React.Component {
8669
const { uploading, fileUploaded } = this.state;
8770
return (
8871
<Container>
89-
<View style={[appStyles.description, appStyles.center]}>
90-
<Text>
91-
This demo uploads a local resource to the firestack storage
92-
and then uses `downloadUrl()` to download and display the image
93-
</Text>
94-
</View>
95-
9672
<Content>
9773
<Button
9874
block
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
import React from 'react';
2+
import { Text, Image } from 'react-native';
3+
import { Card, CardItem } from 'native-base';
4+
5+
export const UploadedImage = ({image}) => {
6+
console.log('hi', image);
7+
return (
8+
<Card>
9+
<CardItem>
10+
<Text>Uploaded file</Text>
11+
</CardItem>
12+
13+
<CardItem>
14+
<Image
15+
style={{ resizeMode: 'cover' }}
16+
source={image} />
17+
</CardItem>
18+
</Card>
19+
)
20+
}
21+
22+
export default UploadedImage;

0 commit comments

Comments
 (0)