Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
epubjs-rn-lcm
Advanced tools
Readme
Uses EPUB.js to parse and render epubs on iOS and Android using React Native.
To use the components in your own app install via npm or yarn
npm install --save epubjs-rn
then link the required libraries with
react-native link react-native-static-server && react-native link react-native-webview && react-native link react-native-zip-archive && RNFB_ANDROID_PERMISSIONS=true react-native link rn-fetch-blob && react-native link @lightbase/react-native-orientation && react-native link @react-native-community/async-storage
then require the components
you need
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"} />
src
: the url of your epub to renderflow
: paginated
: scrolled
- (default to false, which presents a scrolling view)location
: Can be an EPUBCFI, Chapter Url or Spine PositiononLocationChange
: Function called on every page change, reports current CFIonLocationsReady
: Function called once the locations has been generated. Returns the locations object.onViewAdded
: Function called once a view has been added to the screen.beforeViewRemoved
: Function called before a view will be removed from the screen.width
: width (int) of the Epub Renditionheight
: height (int) of the Epub RenditiononReady
: Function called once book has been opened. Returns the book objectthemes
: JSON object of themes names and css properties to be appliedtheme
: Name of the theme to apply, such as light
fontSize
: CSS override for font size of theme, needs a css unitfont
: CSS override for font familystylesheet
: Link to css stylesheet containing themesscript
: Url for a javascript file to be injected into the viewminSpreadWidth
: cut off width for spreadsgap
: gap (int) between columns / pagesonPress
: Single taponDlbPress
: double tap on the screenonLongPress
: Press and holdonSelected
: When the browser selects textTo unzip compressed epubs locally and use http to stream them to epubjs,
you will want to use the Streamer
class to manage the files and start a StaticServer.
An example of this method is provided in the example app.
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});
});
Install with yarn. (Don't use NPM unless you flatten the packages after install)
cd EpubReader/
yarn global add react-native-cli
yarn install
Then start the iOS or Android App
yarn start
react-native run-ios
react-native run-android
EPUB is a registered trademark of the IDPF.
FAQs
Epub.js React Native Components ================================
The npm package epubjs-rn-lcm receives a total of 3 weekly downloads. As such, epubjs-rn-lcm popularity was classified as not popular.
We found that epubjs-rn-lcm demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.