tarek360 / Instacapture

Android library to capture screenshot from your app
694 stars 113 forks source link

ReactNative / Android Studio #24

Closed jayesbe closed 7 years ago

jayesbe commented 7 years ago

Trying to use this in a react-native project. I am trying to add the package using the jitpack instructions provided but keep getting a

error: package com.tarek360.instacapture does not exist

tarek360 commented 7 years ago

@jayesbe What's the version you are trying to use?

jayesbe commented 7 years ago
buildscript {
    ext.kotlin_version = "1.1.4"
    repositories {
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:2.2.3'
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

        // NOTE: Do not place your application dependencies here; they belong
        // in the individual module build.gradle files
    }
}

allprojects {
    buildDir = "C:/tmp/${rootProject.name}/${project.name}"
    repositories {
        mavenLocal()
        jcenter()
        maven { url "https://jitpack.io" }
        maven {
            // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
            url "$rootDir/../node_modules/react-native/android"
        }
    }
}

and

dependencies {
    compile 'com.github.tarek360:instacapture:2.0.0-kotlin-beta1'
    compile project(':react-native-calendar-events')
    compile project(':react-native-splash-screen')
    compile project(':react-native-maps')
    compile project(':react-native-vector-icons')
    compile project(':react-native-svg')
    compile project(':react-native-view-shot')
    compile project(':react-native-share')
    compile project(':react-native-google-analytics-bridge')
    compile fileTree(include: ['*.jar'], dir: 'libs')
    compile 'com.android.support:appcompat-v7:23.0.1'
    compile 'com.facebook.react:react-native:+'
    // From node_modules
}
jayesbe commented 7 years ago

@tarek360

jayesbe commented 7 years ago

Actually.. got it working by moving the specific lines

ext.kotlin_version = "1.1.4" classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" compile 'com.github.tarek360:instacapture:2.0.0-kotlin-beta1'

into the module build.gradle instead of the project and app build.gradles

jayesbe commented 7 years ago

Unfortunately, it seems using this package does not help the issue with React Native and the ReactNativeART SurfaceView.

If you are using react-native and have an issue taking screenshots while using a component such as react-native-simple-gauge where the gauge is not included in the screenshot, using this package does not solve the issue. The screen is otherwise perfectly snapped, but missing the SurfaceView component entirely.