react-native-doc-viewer icon indicating copy to clipboard operation
react-native-doc-viewer copied to clipboard

Error on import

Open peni4142 opened this issue 7 years ago • 12 comments

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

peni4142 avatar Mar 29 '18 15:03 peni4142

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 avatar Apr 03 '18 11:04 peni4142

@peni4142 Same problem "react": "^16.3.0-rc.0", "react-native": "^0.55.0", "react-native-doc-viewer": "^2.7.8"

feng-zhang0712 avatar Apr 04 '18 09:04 feng-zhang0712

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.

sam1463 avatar Apr 05 '18 14:04 sam1463

I have no Xcode...

peni4142 avatar Apr 06 '18 07:04 peni4142

@sam1463 nice!

feng-zhang0712 avatar Apr 08 '18 00:04 feng-zhang0712

@peni4142 good point, my comment only fixes on ios. Not sure how to manually import on windows...

sam1463 avatar Apr 11 '18 16:04 sam1463

@sam1463 maybe he said Android...

feng-zhang0712 avatar Apr 12 '18 01:04 feng-zhang0712

I have this problem, Can it be solved in Android?

tsurumure avatar Apr 21 '18 08:04 tsurumure

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

anil1712 avatar May 22 '18 05:05 anil1712

For those of you having issues with the automatic installation on android, have you also tried using the manual android installation instructions?

sam1463 avatar May 30 '18 13:05 sam1463

I installed it again and run the link command and everything worked out. Have no idea what happened :D

thinklinux avatar Jun 13 '18 10:06 thinklinux

I had this happen when I forgot to run pod install after react-native link

zypher2004 avatar Jul 22 '19 19:07 zypher2004