Mahdi
Mahdi

Reputation: 1405

How to render an epub file in react-native

Hi i was searching for a package for rendering an epub file in react native and also i found this

but i surly believe this package is not managing and developing anymore

so do you know another way to render an epub file in react-native ?

Upvotes: 4

Views: 4674

Answers (4)

Alen.Toma
Alen.Toma

Reputation: 4870

There is no epub-creator in react-native so I created one react-native-epub-creator check it out and let me know

Upvotes: 0

jayesh karma
jayesh karma

Reputation: 21

I was also trying to render Epub in react native app then I got mainly packages like epubjs epub-rn and a lot number of copies of both on them but any on them is not working with our latest code then I got the working package for epub rendering into react-native name epubjs-rn-62

to install it run the command

npm i epubjs-rn-62

it's working fine with 62,63 and more version of react

also no need to link in the current version of react native

usage

   import { Epub } from 'epubjs-rn';
Then you can add the reader element in your code:

<Epub src={"https://s3.amazonaws.com/epubjs/books/moby-dick/OPS/package.opf"}
          flow={"paginated"} />

to use with streamer

import { Epub, Streamer } from "epubjs-rn";
let streamer = new Streamer();

streamer.start("8899")
    .then((origin) => {
        console.log("Served from:", origin)
        return this.streamer.get("https://s3.amazonaws.com/epubjs/books/moby-dick.epub");
    })
    .then((src) => {
        console.log("Loading from:", src);
        return this.setState({src});
    });
 


 

Upvotes: 0

Meisam Sabaghi
Meisam Sabaghi

Reputation: 826

one way you can use open epub with webview , thats a little complicate ,

but another way use some epubjs-rn packge , check package , some resource of it is different and updater than futurepress/epubjs-rn ,

I Use @ottofeller/epubjs-rn , that compatible with react-native 0.62.2

Upvotes: 2

hong developer
hong developer

Reputation: 13926

You can use epubjs-rn

Example

import { Epub } from 'epubjs-rn';
...
<Epub src={"https://s3.amazonaws.com/epubjs/books/moby-dick/OPS/package.opf"}
          flow={"paginated"} />

Official epubjs-rn github homepage

Upvotes: 0

Related Questions