-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathApp.js
44 lines (39 loc) · 1.01 KB
/
App.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
import React from 'react';
import { Button, Image, View, Text, ScrollView } from 'react-native';
import { ImagePicker } from 'expo';
import FilteredImage from './js/filteredImage';
export default class ImagePickerExample extends React.Component {
state = {
image: null,
};
render() {
return (
<View>
<Button
title="Pick an image from camera roll"
onPress={this._pickImage}
/>
{this.state.image &&
<ScrollView style={{width: "100%", height: "100%"}}>
<FilteredImage
source={{uri: this.state.image}}
width={300}
height={300}
style={{backgroundColor: "#ccc"}}
/>
</ScrollView>
}
</View>
);
}
_pickImage = async () => {
let result = await ImagePicker.launchImageLibraryAsync({
allowsEditing: true,
aspect: [4, 4],
});
if (!result.cancelled) {
console.log(result);
this.setState({ image: result.uri });
}
};
}