import React, { useState } from "react";
import { Button, StyleSheet, Text, View } from "react-native";
import * as DocumentPicker from "expo-document-picker";
export default function App() {
const [document, setDocument] = useState(null);
const pickDocument = async () => {
const result = await DocumentPicker.getDocumentAsync({ type: 'application/pdf' });
if (result.type === "success") {
setDocument(result);
}
};
return (
Selected Document: {document ? document.name : "None"}
);
}
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: "center",
justifyContent: "center",
padding: 20,
},
paragraph: {
marginTop: 24,
fontSize: 18,
fontWeight: "bold",
textAlign: "center",
},
});
0 comments:
Post a Comment
Thanks