import React from 'react' ; import { SafeAreaView , StyleSheet , useWindowDimensions } from 'react-native' ; import Pdf from 'react-native-pdf' ; const source = { uri : "https://samples.leanpub.com/thereactnativebook-sample.pdf" , cache : true , } ; export default function App ( ) { const { width , height } = useWindowDimensions ( ) ; return ( < SafeAreaView style = { styles . container } > < Pdf source = { source } onLoadComplete = { ( numberOfPages , filePath ) => { console . log ( `Number of pages: ${ numberOfPages }` ) ; } } onPageChanged = { ( page , numberOfPages ) => { console . log ( `Current page: ${ page }` ) ; } } onError = { ( error ) => { console . log ( error ) ; } } onPressLink = { ( uri ) => { console . log ( `Link pressed: ${ uri }` ) ; } } style = { { flex : 1 , width , height } } /> < /SafeAreaView>); } const styles = StyleSheet . create ( { container : { flex : 1 , justifyContent : "flex-start" , alignItems : "center" , } , } ) ;