import React from 'react';
import { Image, StyleSheet, Text, TouchableOpacity, View } from 'react-native';
import * as ImagePicker from 'expo-image-picker';
import * as Sharing from 'expo-sharing';
export default function App() {
const [selectedImage, setSelectedImage] = React.useState(null);
let openImagePickerAsync = async () => {
setSelectedImage({ localUri: pickerResult.uri });
};
let openShareDialogAsync = async () => {
if (!(await Sharing.isAvailableAsync())) {
alert(`Uh oh, sharing isn't available on your platform`);
return;
}
await Sharing.shareAsync(selectedImage.localUri);
};
if (selectedImage !== null) {
return (
<View style={styles.container}>
<Image source={{ uri: selectedImage.localUri }} style={styles.thumbnail} />
<TouchableOpacity onPress={openShareDialogAsync} style={styles.button}>
<Text style={styles.buttonText}>Share this photo</Text>
</TouchableOpacity>
</View>
);
}
return (
<View style={styles.container}>
{}
</View>
);
}