In react native I am using react-native-paper
and react-native-view-pdf
to show pdf in accordion on react native paper.
Below is my code:
import React, { useState } from "react";
import { View, StyleSheet, Text } from "react-native";
import { List } from "react-native-paper";
import PDFView from "react-native-view-pdf";
const PDFAccordion = () => {
const [expanded, setExpanded] = useState(false);
const handlePress = () => {
setExpanded(!expanded);
};
return (
<List.Section title="Accordions">
<List.Accordion
title="Controlled Accordion"
left={(props) => <List.Icon {...props} icon="folder" />}
expanded={expanded}
onPress={handlePress}
children={renderContent}
>
<View style={styles.pdfContainer}>
<Text>hi</Text>
<PDFView
fadeInDuration={250.0}
style={{ flex: 1 }}
resource={"http://www.pdf995.com/samples/pdf.pdf"}
/>
</View>
</List.Accordion>
</List.Section>
);
};
const styles = StyleSheet.create({
container: {
flex: 1,
},
pdfContainer: {
backgroundColor: "red",
},
});
export default PDFAccordion;
My accordion is working, I can see hi text, but I cant see pdf in that.