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 backfaceVisibility after transform changes #39294

Closed
wants to merge 1 commit into from
Closed
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 @@ -481,8 +481,22 @@ public void setAccessibilityLiveRegion(@NonNull T view, @Nullable String liveReg
}
}

private static void setTransformProperty(
@NonNull View view, ReadableArray transforms, @Nullable ReadableArray transformOrigin) {
protected void setTransformProperty(
@NonNull T view,
@Nullable ReadableArray transforms,
@Nullable ReadableArray transformOrigin) {
if (transforms == null) {
view.setTranslationX(PixelUtil.toPixelFromDIP(0));
view.setTranslationY(PixelUtil.toPixelFromDIP(0));
view.setRotation(0);
view.setRotationX(0);
view.setRotationY(0);
view.setScaleX(1);
view.setScaleY(1);
view.setCameraDistance(0);
return;
}

sMatrixDecompositionContext.reset();
TransformHelper.processTransform(
transforms,
Expand Down Expand Up @@ -554,17 +568,6 @@ private static float sanitizeFloatPropertyValue(float value) {
throw new IllegalStateException("Invalid float property value: " + value);
}

private static void resetTransformProperty(@NonNull View view) {
view.setTranslationX(PixelUtil.toPixelFromDIP(0));
view.setTranslationY(PixelUtil.toPixelFromDIP(0));
view.setRotation(0);
view.setRotationX(0);
view.setRotationY(0);
view.setScaleX(1);
view.setScaleY(1);
view.setCameraDistance(0);
}

private void updateViewAccessibility(@NonNull T view) {
ReactAccessibilityDelegate.setDelegate(
view, view.isFocusable(), view.getImportantForAccessibility());
Expand All @@ -574,15 +577,12 @@ private void updateViewAccessibility(@NonNull T view) {
protected void onAfterUpdateTransaction(@NonNull T view) {
super.onAfterUpdateTransaction(view);
updateViewAccessibility(view);

Boolean invalidateTransform = (Boolean) view.getTag(R.id.invalidate_transform);
if (invalidateTransform != null && invalidateTransform) {
ReadableArray transformOrigin = (ReadableArray) view.getTag(R.id.transform_origin);
ReadableArray transformMatrix = (ReadableArray) view.getTag(R.id.transform);
if (transformMatrix != null) {
setTransformProperty(view, transformMatrix, transformOrigin);
} else {
resetTransformProperty(view);
}
setTransformProperty(view, transformMatrix, transformOrigin);
view.setTag(R.id.invalidate_transform, false);
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -314,8 +314,11 @@ public void setOpacity(@NonNull ReactViewGroup view, float opacity) {
}

@Override
public void setTransform(@NonNull ReactViewGroup view, @Nullable ReadableArray matrix) {
super.setTransform(view, matrix);
protected void setTransformProperty(
@NonNull ReactViewGroup view,
@Nullable ReadableArray transforms,
@Nullable ReadableArray transformOrigin) {
super.setTransformProperty(view, transforms, transformOrigin);
view.setBackfaceVisibilityDependantOpacity();
}

Expand Down