Skip to content

Commit 6fa47a7

Browse files
authored
Merge pull request #10 from contagt/main
Fix: Android changed canvas to non-optional
2 parents a392c34 + 1ca9de6 commit 6fa47a7

File tree

5 files changed

+14
-8
lines changed

5 files changed

+14
-8
lines changed

android/build.gradle

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ def getExtOrIntegerDefault(name) {
2626
}
2727

2828
android {
29+
def agpVersion = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
30+
if (agpVersion.tokenize('.')[0].toInteger() >= 7) {
31+
namespace "com.reactnativeshadowview"
32+
}
33+
2934
compileSdkVersion getExtOrIntegerDefault('compileSdkVersion')
3035
buildToolsVersion getExtOrDefault('buildToolsVersion')
3136
defaultConfig {
@@ -122,10 +127,11 @@ repositories {
122127
}
123128

124129
def kotlin_version = getExtOrDefault('kotlinVersion')
130+
def ktx_version = getExtOrDefault('ktxVersion')
125131

126132
dependencies {
127133
// noinspection GradleDynamicVersion
128134
api 'com.facebook.react:react-native:+'
129135
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
130-
implementation "androidx.core:core-ktx:$kotlin_version"
136+
implementation "androidx.core:core-ktx:$ktx_version"
131137
}

android/gradle.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
ShadowView_kotlinVersion=1.5.0
2+
ShadowView_ktxVersion=1.7.0
23
ShadowView_compileSdkVersion=29
34
ShadowView_buildToolsVersion=29.0.2
45
ShadowView_targetSdkVersion=29

android/src/main/AndroidManifest.xml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
1-
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
2-
package="com.reactnativeshadowview">
3-
1+
<manifest xmlns:android="http://schemas.android.com/apk/res/android">
42
</manifest>

android/src/main/java/com/reactnativeshadowview/ShadowLayout.kt

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ open class ShadowLayout @JvmOverloads constructor(
260260
shadow_y_shift / shadow_downscale / cssRatio
261261
)
262262

263-
override fun draw(canvas: Canvas?) {
263+
override fun draw(canvas: Canvas) {
264264
canvas ?: return
265265
if (isInEditMode) {
266266
super.draw(canvas)
@@ -272,7 +272,7 @@ open class ShadowLayout @JvmOverloads constructor(
272272
if (shadow_cast_only_background) {
273273
background.bounds = viewBounds
274274
background?.draw(blurCanvas!!)
275-
} else super.draw(blurCanvas)
275+
} else super.draw(blurCanvas!!)
276276
}
277277
if (realRadius > 0f) { // Do not blur if no radius
278278
val (script) = getScript()
@@ -289,3 +289,4 @@ open class ShadowLayout @JvmOverloads constructor(
289289
}
290290

291291
}
292+

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@dimaportenko/react-native-shadow-view",
3-
"version": "0.1.4",
3+
"version": "0.1.6",
44
"description": "React Native library with Android native view which supports same shadows styles as iOS ",
55
"main": "lib/commonjs/index",
66
"module": "lib/module/index",
@@ -37,7 +37,7 @@
3737
"android"
3838
],
3939
"repository": "https://github.com/dimaportenko/react-native-shadow-view",
40-
"author": "Dima Portenko <[email protected]> (https://github.com/dimaportenko)",
40+
"author": "Dima Portenko (https://github.com/dimaportenko)",
4141
"license": "MIT",
4242
"bugs": {
4343
"url": "https://github.com/dimaportenko/react-native-shadow-view/issues"

0 commit comments

Comments
 (0)