victorsoares96 / epubjs-react-native

ePub.js Reader for React Native

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

How do I make changeFontSize and changeFontFamily methods work?

SamuelPremji opened this issue · comments

The issue seem to be with the library but I have no idea what causes the issue and I've been trying to fix it for weeks.

you need to wrap all component where you using a hook in ReaderProvider

you need to wrap all component where you using a hook in ReaderProvider

Can you give an example? Like isn't this supposed to work:

export default function App() {
const { width, height } = useWindowDimensions();
const {changeFontSize} = useReader();

return (


<Reader
src="https://s3.amazonaws.com/moby-dick/OPS/package.opf"
width={width}
height={height}
fileSystem={useFileSystem}
onPress={() => changeFontSize('66px')}
/>


);
}

const App = () => { return ( <ReaderProvider > <ViewEpubScreen /> </ReaderProvider> ) }

const ViewEpubScreen = () => {
// You can use useReader() here
const {changeFontSize} = useReader();

return (
<Reader />
)
}

i hope it can help you

const App = () => { return ( <ReaderProvider > <ViewEpubScreen /> </ReaderProvider> ) }

const ViewEpubScreen = () => { // You can use useReader() here const {changeFontSize} = useReader();

return ( <Reader /> ) }

i hope it can help you

That's what I did but it does not work.

This issue is stale because it has been open for 90 days with no activity.