mirror of
https://github.com/gosticks/DefinitelyTyped.git
synced 2025-10-16 12:05:41 +00:00
* Added React Native Share Extension * Fixed Linting Issues Fixed linting issues, added tests. * Fixed other linting issues Data returns a promise. * Removed Public from state Removed public from state.
40 lines
1.1 KiB
TypeScript
40 lines
1.1 KiB
TypeScript
import * as React from 'react';
|
|
import ShareExtension from 'react-native-share-extension';
|
|
|
|
import { Text, View } from 'react-native';
|
|
|
|
export default class Share extends React.Component {
|
|
state = {
|
|
type: '',
|
|
value: '',
|
|
};
|
|
|
|
async componentDidMount() {
|
|
try {
|
|
const { type, value } = await ShareExtension.data();
|
|
await ShareExtension.data();
|
|
ShareExtension.openURL('sample://example/url');
|
|
ShareExtension.close();
|
|
this.setState({
|
|
type,
|
|
value,
|
|
});
|
|
} catch (e) {
|
|
console.log('errrr', e);
|
|
}
|
|
}
|
|
|
|
render() {
|
|
return (
|
|
<View style={{ alignItems: 'center', justifyContent: 'center', flex: 1 }}>
|
|
<View
|
|
style={{ borderColor: 'green', borderWidth: 1, backgroundColor: 'white', height: 200, width: 300 }}
|
|
>
|
|
<Text>type: {this.state.type}</Text>
|
|
<Text>value: {this.state.value}</Text>
|
|
</View>
|
|
</View>
|
|
);
|
|
}
|
|
}
|