wonday / react-native-pdf

A <Pdf /> component for react-native
MIT License
1.6k stars 555 forks source link

Warning: Native component for "RCTPdfPageView" does not exist #124

Closed yoavkamary closed 6 years ago

yoavkamary commented 6 years ago

Hi All, I got it working on IOS but I get this warning on Android and it does not work on Android at all

Warning: Native component for "RCTPdfPageView" does not exist

I installed with yarn and linked with react-native link Any help will be appreciated 👍

wonday commented 6 years ago

link failed, try again

yoavkamary commented 6 years ago

Hi, Not sure why it is failing.. I removed the library and node modules and did everything all over again and still getting this error.

package.json

"react-native-pdf": "^3.0.2"

MainApplication.java

import org.wonday.pdf.RCTPdfView;
...
@Override
   protected List<ReactPackage> getPackages() {
     return Arrays.<ReactPackage>asList(
          new MainReactPackage(),
          new RCTPdfView(), 
          new RNFetchBlobPackage(),
          new SplashScreenReactPackage(),
          new ReactNativeI18n(),
          new RSSignatureCapturePackage()
      );
    }

android/app/build.gradle

    compile project(':react-native-pdf')
    compile project(':react-native-fetch-blob')
    compile project(':react-native-splash-screen')
    compile project(':react-native-i18n')
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.facebook.react:react-native:+'
    compile 'com.facebook.fresco:fresco:1.5.0'
    compile 'com.facebook.fresco:animated-gif:1.5.0'
    compile project(':react-native-splash-screen')
    compile project(':reactnativesignaturecapture')

    // From node_modules
}

android/settings.gradle

include ':react-native-pdf'
project(':react-native-pdf').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-pdf/android')
include ':react-native-fetch-blob'
project(':react-native-fetch-blob').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-fetch-blob/android')
include ':react-native-splash-screen'
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
include ':react-native-i18n'
project(':react-native-i18n').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-i18n/android')
include ':react-native-splash-screen'
project(':react-native-splash-screen').projectDir = new File(rootProject.projectDir, '../node_modules/react-native-splash-screen/android')
include ':reactnativesignaturecapture',':app'
project(':reactnativesignaturecapture').projectDir = new File(settingsDir, '../App/Lib/react-native-signature-capture/android')
include ':app'

Not sure what's wrong here

cshen4 commented 6 years ago

I'm actually getting the same problem here. I've done a quick patch by not using the native component and replacing it with react-native-pdf-view however its still very buggy. (fork is here: [https://github.com/cshen4/react-native-pdf]) I'd really appreciate a better solution.

MoOx commented 6 years ago

For my concern, I have this warning but it's working (my pdf is visible is zoomable); I was working on #99 and wanted to check a change on android an saw this warning. Weird isn't it?