futurepress / epubjs-rn

EpubJS React Native Example
Other
267 stars 151 forks source link

Unable to resolve "warnOnce" #167

Open info2programmer opened 4 years ago

info2programmer commented 4 years ago

Unable to resolve "warnOnce" from "node_modules\epubjs-rn\node_modules\react-nat ive-zip-archive\node_modules\react-native\Libraries\react-native\react-native-im plementation.js" Failed building JavaScript bundle.

jeevankumarkanuganti commented 4 years ago

any update on this?

I am also facing the same issue

info2programmer commented 4 years ago

No , I don't get any update

jeevankumarkanuganti commented 4 years ago

any workaround?

Mubeen07 commented 3 years ago

me too facing same issue on this package

tomkhenry commented 3 years ago

Hi! I was able to solve the problem by adding a blacklist in my metro.config.js. I found it here. Also I changed my react-native-webview to version 9.0.2, that seemed to work best.

swetha867 commented 3 years ago

Workaround It worked using epubjs library and react-native-webview. epubjs react-native-webview

<WebView 
  ref={webview}
  source={{ uri:'file:///android_asset/epub_renderer.html'}}  />

Add epub_renderer.html in "\android\app\src\main\assets" folder of project

<body>
    <div id="area"></div>
</body>
<script>
       var book = ePub("path/book.epub");
       var rendition = book.renderTo("area", {width: 600, height: 400});
       var displayed = rendition.display();
</script>
burak4ydin commented 3 years ago

change your metro.config.js

to:

const blacklist = require('metro-config/src/defaults/blacklist');

module.exports = { resolver: { blacklistRE: blacklist([/node_modules\/.\/node_modules\/react-native\/./]) }, transformer: { getTransformOptions: async () => ({ transform: { experimentalImportSupport: false, inlineRequires: false } }) } };

And change your webview version to -> 9.0.2

And also use -> @ottofeller/epubjs-rn

https://www.npmjs.com/package/@ottofeller/epubjs-rn

import {Epub} from '@ottofeller/epubjs-rn'

Dont forget width and height