epubjs-rn
epubjs-rn copied to clipboard
Unable to resolve "warnOnce"
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.
any update on this?
I am also facing the same issue
No , I don't get any update
any workaround?
me too facing same issue on this package
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.
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>
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