Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 10 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ A React Native component for drawing by touching on both iOS and Android, with T

## Features

- Supports New Architecture
- Supports New Architecture only
- Support iOS and Android
- Full TypeScript support
- Stroke thickness and color are changeable while drawing
Expand All @@ -28,6 +28,15 @@ A React Native component for drawing by touching on both iOS and Android, with T
- Initial paths loading with native batch processing for optimal performance
- Real-time path loading feedback with onInitialPathsLoaded callback

## Compatibility

| Sketch Canvas Version | React Native Version | New Architecture Support | Old Architecture Support |
|-----------------------|----------------------|--------------------------|--------------------------|
| 2.4.0 and above | 0.76.7 and above | Yes | No |
| 2.3.x and below | 0.76.6 and below | Yes | Yes |

> **Note**: Starting from version 2.4.0, this library only supports React Native's New Architecture. For projects still using the old architecture, please use version 2.3.x or below.

## Installation

---
Expand Down
50 changes: 11 additions & 39 deletions android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,9 @@ def reactNativeArchitectures() {
return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
}

def isNewArchitectureEnabled() {
return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true"
}

apply plugin: "com.android.library"
apply plugin: "kotlin-android"

if (isNewArchitectureEnabled()) {
apply plugin: "com.facebook.react"
}
apply plugin: "com.facebook.react"

def getExtOrDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties["RNTSketchCanvas_" + name]
Expand All @@ -38,32 +31,15 @@ def getExtOrIntegerDefault(name) {
return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["RNTSketchCanvas_" + name]).toInteger()
}

def supportsNamespace() {
def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.')
def major = parsed[0].toInteger()
def minor = parsed[1].toInteger()

// Namespace support was added in 7.3.0
return (major == 7 && minor >= 3) || major >= 8
}

android {
if (supportsNamespace()) {
namespace "com.sourcetoad.reactnativesketchcanvas"

sourceSets {
main {
manifest.srcFile "src/main/AndroidManifestNew.xml"
}
}
}
namespace "com.sourcetoad.reactnativesketchcanvas"

compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")

defaultConfig {
minSdkVersion getExtOrIntegerDefault("minSdkVersion")
targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString()
buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", "true"

}

Expand All @@ -88,12 +64,10 @@ android {

sourceSets {
main {
if (isNewArchitectureEnabled()) {
java.srcDirs += [
"generated/java",
"generated/jni"
]
}
java.srcDirs += [
"generated/java",
"generated/jni"
]
}
}
}
Expand All @@ -114,10 +88,8 @@ dependencies {
implementation 'androidx.exifinterface:exifinterface:1.3.6'
}

if (isNewArchitectureEnabled()) {
react {
jsRootDir = file("../src/")
libraryName = "RNTSketchCanvasView"
codegenJavaPackageName = "com.sourcetoad.reactnativesketchcanvas"
}
react {
jsRootDir = file("../src/")
libraryName = "RNTSketchCanvasView"
codegenJavaPackageName = "com.sourcetoad.reactnativesketchcanvas"
}
3 changes: 1 addition & 2 deletions android/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.sourcetoad.reactnativesketchcanvas">
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
</manifest>
2 changes: 0 additions & 2 deletions android/src/main/AndroidManifestNew.xml

This file was deleted.

23 changes: 0 additions & 23 deletions ios/RNSketchCanvasViewManager.mm

This file was deleted.

Loading