Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(🤖): remove unstable React Native Screens workaround on Android #2894

Merged
merged 1 commit into from
Jan 15, 2025
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,7 @@ public void setOpaque(boolean value) {
}
}

@Override
protected void onAttachedToWindow() {
super.onAttachedToWindow();
if (getMeasuredWidth() == 0) {
if (mView instanceof SkiaTextureView) {
((SkiaTextureView) mView).createSurfaceTexture();
}
}
}

void dropInstance() {
if (mView instanceof SkiaTextureView) {
((SkiaTextureView)mView).isDropped = true;
}
unregisterView();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ public class SkiaTextureView extends TextureView implements TextureView.SurfaceT

SkiaViewAPI mApi;
boolean mDebug;
public boolean isDropped = false;

public SkiaTextureView(Context context, SkiaViewAPI api, boolean debug) {
super(context);
Expand All @@ -25,22 +24,6 @@ public SkiaTextureView(Context context, SkiaViewAPI api, boolean debug) {
setSurfaceTextureListener(this);
}

public void createSurfaceTexture() {
if (android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.O) {
Log.i(tag, "Create SurfaceTexture");
SurfaceTexture surfaceTexture = new SurfaceTexture(false);
setSurfaceTexture(surfaceTexture);
onSurfaceTextureAvailable(surfaceTexture, getWidth(), getHeight());
}
}

private void reCreateSurfaceTexture() {
boolean surfaceIsAlreadyAvailable = getSurfaceTexture() != null;
if (surfaceIsAlreadyAvailable) {
createSurfaceTexture();
}
}

@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
Expand All @@ -55,19 +38,13 @@ public void onSurfaceTextureAvailable(@NonNull SurfaceTexture surfaceTexture, in
@Override
public void onSurfaceTextureSizeChanged(@NonNull SurfaceTexture surfaceTexture, int width, int height) {
Log.i(tag, "onSurfaceTextureSizeChanged: " + width + "x" + height);
if (isDropped) {
return;
}
mApi.onSurfaceTextureChanged(surfaceTexture, width, height);
}

@Override
public boolean onSurfaceTextureDestroyed(@NonNull SurfaceTexture surfaceTexture) {
mApi.onSurfaceDestroyed();
if (!isDropped) {
reCreateSurfaceTexture();
}
return false;
return true;
}

private long _prevTimestamp = 0;
Expand Down
Loading