-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathShare.js
60 lines (54 loc) · 1.46 KB
/
Share.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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
import React, {Component} from 'react';
import {Text, TouchableOpacity, View} from 'react-native';
import Modal from 'react-native-modalbox';
import ShareExtension from 'react-native-share-extension';
export default class Share extends Component {
constructor(props, context) {
super(props, context);
this.state = {
isOpen: true,
type: '',
value: '',
};
}
async componentDidMount() {
try {
const {type, value} = await ShareExtension.data();
this.setState({
type,
value,
});
} catch (e) {
console.log('errrr', e);
}
}
onClose = () => ShareExtension.close();
closing = () => this.setState({isOpen: false});
render() {
return (
<Modal
backdrop={false}
style={{backgroundColor: 'transparent'}}
position="center"
isOpen={this.state.isOpen}
onClosed={this.onClose}>
<View style={{alignItems: 'center', justifyContent: 'center', flex: 1}}>
<View
style={{
borderColor: 'green',
borderWidth: 1,
backgroundColor: 'white',
height: 200,
width: 300,
}}>
<TouchableOpacity onPress={this.closing}>
<Text>Close</Text>
<Text>type: {this.state.type}</Text>
<Text>value: {this.state.value}</Text>
</TouchableOpacity>
</View>
</View>
</Modal>
);
}
}