Open
Description
Tested on iOS 18.0, not sure if any other OS has the problem.
import React from 'react';
import type {PropsWithChildren} from 'react';
import {
ScrollView,
StatusBar,
StyleSheet,
Text,
useColorScheme,
View,
SafeAreaView,
Dimensions,
} from 'react-native';
import Pdf from 'react-native-pdf';
function App(): React.JSX.Element {
const source = {
uri: 'https://file-examples.com/storage/feb7c2eda267d3071a102e4/2017/10/file-sample_150kB.pdf',
cache: false,
};
return (
<SafeAreaView style={{flex: 1, backgroundColor: '#adf'}}>
<View style={{flex: 1, backgroundColor: '#fda', padding: 22}}>
<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}`);
}}
onLoadProgress={progress => {
console.log(`Loading progress: ${progress}`);
}}
style={styles.pdf}
/>
</View>
</SafeAreaView>
);
}
const styles = StyleSheet.create({
pdf: {
flex: 1,
width: Dimensions.get('window').width,
height: Dimensions.get('window').height,
},
});
export default App;
Metadata
Metadata
Assignees
Labels
No labels