react-native-doc-viewer
react-native-doc-viewer copied to clipboard
Error on import
I installed it like the docs:
npm install react-native-doc-viewer --save
react-native link react-native-doc-viewer
but when I import it to my Project, I get an Error:
import OpenFile from 'react-native-doc-viewer';
Error: undefined is not an object (evaluating 'RNReactNativeDocViewer.openDoc')
react-native info: Environment: OS: Windows 10 Node: 6.11.3 Yarn: 1.5.1 npm: 5.5.0 Watchman: Not Found Xcode: N/A Android Studio: Version 3.1.0.0 AI-173.4670197
Packages: (wanted => installed) react: 16.3.0-alpha.1 => 16.3.0-alpha.1 react-native: 0.52.0 => 0.52.0
now everything is up to date and error persist on import package.json:
{
"name": "ProdPrototype",
"version": "0.1.0",
"private": true,
"devDependencies": {
"jest-expo": "26.0.0",
"react-native-scripts": "1.13.1",
"react-test-renderer": "16.3.0-alpha.1"
},
"main": "./node_modules/react-native-scripts/build/bin/crna-entry.js",
"scripts": {
"start": "react-native-scripts start",
"eject": "react-native-scripts eject",
"android": "react-native-scripts android",
"ios": "react-native-scripts ios",
"test": "jest"
},
"jest": {
"preset": "jest-expo"
},
"dependencies": {
"expo": "^26.0.0",
"react": "16.3.0-alpha.1",
"react-native": "0.54.0",
"react-native-doc-viewer": "^2.7.8",
"react-navigation": "^1.5.9"
}
}
@peni4142 Same problem
"react": "^16.3.0-rc.0", "react-native": "^0.55.0", "react-native-doc-viewer": "^2.7.8"

I had this issue, so I manually copied the RNReactNativeDocViewer.xcodeproj from node_modules/react-native-doc-viewer/ios to my projects "Libraries" section in xcode, then manually added libRNReactNativeDocViewer.a from the "products" section to "Linked Frameworks and Libraries". Fixed the issue for me.
I have no Xcode...
@sam1463 nice!
@peni4142 good point, my comment only fixes on ios. Not sure how to manually import on windows...
@sam1463 maybe he said Android...
I have this problem, Can it be solved in Android?
I am getting the same issue. I want it for Android only.
Is someone got any solution?
FYI: I am using expo with React Native
For those of you having issues with the automatic installation on android, have you also tried using the manual android installation instructions?
I installed it again and run the link command and everything worked out. Have no idea what happened :D
I had this happen when I forgot to run pod install after react-native link