epubjs-rn
epubjs-rn copied to clipboard
not working with [email protected]
hii, I am using this library but it's not working with [email protected]. I am getting this error "Cannot find module 'warnOnce' from 'react-native-implementation.js' ".
https://stackoverflow.com/questions/58716199/react-native-unable-to-resolve-module-warnonce
Try by editing the your metro.config.js to
module.exports = {
resolver: {
blacklistRE: blacklist([
/node_modules\/.*\/node_modules\/react-native\/.*/,
])
},
transformer: {
getTransformOptions: async () => ({
transform: {
experimentalImportSupport: false,
inlineRequires: false,
},
}),
},
};```
@GrinchakAndrew Hi thank you for your reply I already tried that but then i am getting this error

Yes I am getting the same error in react-naive 0.61.3.Please help !!
I resolved by edit metro.config.js to: module.exports = { resolver: { blacklistRE: blacklist([ /node_modules/./node_modules/react-native/./, /node_modules/./node_modules/react/./, ]) }, ....... };
What worked for me was:
- Change the
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
}
})
}
};
- Change my
react-native-webview
dependency to the same version of theepubjs-rn
- Double check the configuration section of the react-native-orientation for Android and iOS.
- Then run project
I was having these exact same problems (although I was using react-native 0.62.2) and was stuck with the Element Ref error. I switched to @ottofeller/epubjs-rn and all the problems went away.
I was having these exact same problems (although I was using react-native 0.62.2) and was stuck with the Element Ref error. I switched to @ottofeller/epubjs-rn and all the problems went away.
Were you able to make it work in IOS? using @ottofeller/epubjs-rn? Because I am using that also, but the problem is, in IOS, the paginated flow doesn't work.
Could you try to delete the epubjs-rn/node-modules/react-native.
I was having these exact same problems (although I was using react-native 0.62.2) and was stuck with the Element Ref error. I switched to @ottofeller/epubjs-rn and all the problems went away.
@piyachetk can you guide me about the @ottofeller/epubjs-rn as I'm using this one, It's work fine for only opf source but when I use the code to load .epub then error occurred https://github.com/futurepress/epubjs-rn/issues/127#issuecomment-664597544 Here is the error which I'm facing with this @ottofeller/epubjs-rn package.
@Mubeen07 This could be a link issue with the react-native-zip-archive library, make sure your follow all the installation steps
Thank you @vitorverasm I'm on latest react-native version and it's not support link command anymore. any other workarounds?
@Mubeen07 try
npx react-native link package-name
Thanks @vitorverasm It worked for me, thank you so mush. You made my day.
Cheers
what have you done that worked? what version of react-native?
how have you linked the libs from epubjs-rn ? I cannot run the instructions to link, when using rn 0.60+.
@muriloneo you can try to:
- Check instalation instructions and link instructions of all dependencies
- Use
npx react-native-link package-name
instead ofreact-native link
directly - All dependencies: - react-native-static-server - react-native-webview - react-native-zip-archive - rn-fetch-blob - react-native-orientation - async-storage
- Use
- Check if the
react-native-webview
on your project is in the same version of the one in theepubjs-rn ``package.json
- Try to dele
node_modules
folder in pathnode_modules/epubjs-rn/node_modules/
- Check this comment if it helps
I've managed to work on a private fork in my use case, good luck!
Thanks a lot @vitorverasm. I did what you said. Installed every one of these packages at epubjs-rn version (did not installed @ottofeller fork).
I also changed the metro config but on iOS the simulator stays blank, with errors:
TypeError: Cannot read property 'DocumentDir' of undefined
ExceptionsManager.js:179 TypeError: hmrClient.send is not a function
Invariant Violation: Module AppRegistry is not a registered callable module (calling runApplication)
using this package:
"dependencies": {
"@lightbase/react-native-orientation": "3.2.1",
"@react-native-community/async-storage": "1.5.0",
"epubjs-rn": "^0.1.5",
"react": "16.13.1",
"react-native": "0.63.2",
"react-native-static-server": "0.4.2",
"react-native-webview": "5.12.0",
"react-native-zip-archive": "4.1.1",
"rn-fetch-blob": "0.10.15"
},
"devDependencies": {
"@babel/core": "^7.11.0",
"@babel/runtime": "^7.11.0",
"@react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.2.2",
"eslint": "^7.6.0",
"jest": "^26.2.2",
"metro-react-native-babel-preset": "^0.61.0",
"react-test-renderer": "16.13.1"
},
Can you please share your working package.json, please?
@muriloneo I no longer have access to the project that I used epubjs-rn
.
On your comment your have two problems:
-
TypeError: Cannot read property 'DocumentDir' of undefined
-
ExceptionsManager.js:179 TypeError: hmrClient.send is not a function
-
DocumentDir
is related torn-fetch-blob
directories, you can check this part of the docs - Form
hmrClient.send
I don't remember exactly what I did, but it was related to metro version, you can check that
Thanks @vitorverasm. I think I'm going somewhere! lol.
I have to install ottofeller package. epubjs-rn has a ref problem but I'm getting:
error: Error: While trying to resolve module @ottofeller/epubjs-rn
from file App.js
, the package /node_modules/@ottofeller/epubjs-rn/package.json
was successfully found. However, this package itself specifies a main
module field that could not be resolved (/node_modules/@ottofeller/epubjs-rn/components/index.js
..
How to install a forked project?
@muriloneo Did you install with? It should've worked :thinking:
npm i @ottofeller/epubjs-rn
Yeah, I did just like that. with '@' without, with NPM and YARN!
@muriloneo if you'd like I can send you a documentation I've made when I was working with a fork of epujs-rn
in a project. Just leave your email.
Just sent you an email! Thanks
@muriloneo I've created a gist for this maybe it helps others beyond yourself, but feel free to send me an email if wanted Check it out
It's a pity that a library that helps several people does not have adequate maintenance, currently in react-native there is no concrete way to view epub files and this library facilitates this process. However, more and more people continue to create library forks, as the basic structure of the library does not meet the needs.
I don't feel that I have the capacity to help maintain the library, but I can help with documentation and help wanted questions.
@vitorverasm with your @vitorverasm/react-native-static-server the project did not build. I've installed "react-native-static-server": "0.4.2" and now it does build, but it has the same problem as the actual project, which ottofeller has it right.
Error: Element ref was specified as a string (framer) but no owner was set.
Rendition (at Epub.js:320)
This works (on mac):
package.json
"dependencies": {
"@lightbase/react-native-orientation": "^3.2.1",
"@ottofeller/epubjs-rn": "^0.2.41",
"@react-native-community/async-storage": "^1.5.0",
"core-js": "^3.6.5",
"react": "16.13.1",
"react-native": "0.63.2",
"react-native-static-server": "^0.4.2",
"react-native-vector-icons": "^7.0.0",
"react-native-webview": "^9.4.0",
"react-native-zip-archive": "^4.1.1",
"rn-fetch-blob": "^0.12.0"
},
"devDependencies": {
"@babel/core": "^7.11.0",
"@babel/runtime": "^7.11.0",
"@react-native-community/eslint-config": "^2.0.0",
"babel-jest": "^26.2.2",
"eslint": "^7.6.0",
"jest": "^26.2.2",
"metro-react-native-babel-preset": "^0.61.0",
"react-test-renderer": "16.13.1"
},
npx react-native link react-native-static-server && npx react-native link react-native-webview && npx react-native link react-native-zip-archive &&
RNFB_ANDROID_PERMISSIONS=truenpx react-native link rn-fetch-blob && npx react-native link @lightbase/react-native-orientation && npx react-native link @react-native-community/async-storage
npx pod-install
Using Ottofeller fork he uses another props like pagingEnabled, which is fine.
It's great!
npx react-native link react-native-static-server && npx react-native link react-native-webview && npx react-native link react-native-zip-archive && RNFB_ANDROID_PERMISSIONS=truenpx react-native link rn-fetch-blob && npx react-native link @lightbase/react-native-orientation && npx react-native link @react-native-community/async-storage
after doing this, the error is gone but the screen is blank and doesn't show anything (sometimes a loading indicator) edit: it gives me this warning: require cycle @ottofeller/epubjs-rn