@shopify/react-native-skia 1.10.1 → 1.10.2
Sign up to get free protection for your applications and to get access to all the features.
@@ -32,20 +32,7 @@ public abstract class SkiaBaseView extends ReactViewGroup implements SkiaViewAPI
|
|
32
32
|
}
|
33
33
|
}
|
34
34
|
|
35
|
-
@Override
|
36
|
-
protected void onAttachedToWindow() {
|
37
|
-
super.onAttachedToWindow();
|
38
|
-
if (getMeasuredWidth() == 0) {
|
39
|
-
if (mView instanceof SkiaTextureView) {
|
40
|
-
((SkiaTextureView) mView).createSurfaceTexture();
|
41
|
-
}
|
42
|
-
}
|
43
|
-
}
|
44
|
-
|
45
35
|
void dropInstance() {
|
46
|
-
if (mView instanceof SkiaTextureView) {
|
47
|
-
((SkiaTextureView)mView).isDropped = true;
|
48
|
-
}
|
49
36
|
unregisterView();
|
50
37
|
}
|
51
38
|
|
@@ -15,7 +15,6 @@ public class SkiaTextureView extends TextureView implements TextureView.SurfaceT
|
|
15
15
|
|
16
16
|
SkiaViewAPI mApi;
|
17
17
|
boolean mDebug;
|
18
|
-
public boolean isDropped = false;
|
19
18
|
|
20
19
|
public SkiaTextureView(Context context, SkiaViewAPI api, boolean debug) {
|
21
20
|
super(context);
|
@@ -25,22 +24,6 @@ public class SkiaTextureView extends TextureView implements TextureView.SurfaceT
|
|
25
24
|
setSurfaceTextureListener(this);
|
26
25
|
}
|
27
26
|
|
28
|
-
public void createSurfaceTexture() {
|
29
|
-
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
|
30
|
-
Log.i(tag, "Create SurfaceTexture");
|
31
|
-
SurfaceTexture surfaceTexture = new SurfaceTexture(false);
|
32
|
-
setSurfaceTexture(surfaceTexture);
|
33
|
-
onSurfaceTextureAvailable(surfaceTexture, getWidth(), getHeight());
|
34
|
-
}
|
35
|
-
}
|
36
|
-
|
37
|
-
private void reCreateSurfaceTexture() {
|
38
|
-
boolean surfaceIsAlreadyAvailable = getSurfaceTexture() != null;
|
39
|
-
if (surfaceIsAlreadyAvailable) {
|
40
|
-
createSurfaceTexture();
|
41
|
-
}
|
42
|
-
}
|
43
|
-
|
44
27
|
@Override
|
45
28
|
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
|
46
29
|
super.onLayout(changed, left, top, right, bottom);
|
@@ -55,19 +38,13 @@ public class SkiaTextureView extends TextureView implements TextureView.SurfaceT
|
|
55
38
|
@Override
|
56
39
|
public void onSurfaceTextureSizeChanged(@NonNull SurfaceTexture surfaceTexture, int width, int height) {
|
57
40
|
Log.i(tag, "onSurfaceTextureSizeChanged: " + width + "x" + height);
|
58
|
-
if (isDropped) {
|
59
|
-
return;
|
60
|
-
}
|
61
41
|
mApi.onSurfaceTextureChanged(surfaceTexture, width, height);
|
62
42
|
}
|
63
43
|
|
64
44
|
@Override
|
65
45
|
public boolean onSurfaceTextureDestroyed(@NonNull SurfaceTexture surfaceTexture) {
|
66
46
|
mApi.onSurfaceDestroyed();
|
67
|
-
|
68
|
-
reCreateSurfaceTexture();
|
69
|
-
}
|
70
|
-
return false;
|
47
|
+
return true;
|
71
48
|
}
|
72
49
|
|
73
50
|
private long _prevTimestamp = 0;
|
package/package.json
CHANGED
@@ -7,7 +7,7 @@
|
|
7
7
|
"setup-skia-web": "./scripts/setup-canvaskit.js"
|
8
8
|
},
|
9
9
|
"title": "React Native Skia",
|
10
|
-
"version": "1.10.
|
10
|
+
"version": "1.10.2",
|
11
11
|
"description": "High-performance React Native Graphics using Skia",
|
12
12
|
"main": "lib/module/index.js",
|
13
13
|
"react-native": "src/index.ts",
|