Skip to content

Commit 9785ae4

Browse files
committed
fix(android): fixed source-element sometimes briefly visible
1 parent 92a999c commit 9785ae4

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

android/src/main/java/com/ijzerenhein/sharedelement/RNSharedElementTransition.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -227,7 +227,7 @@ private void updateLayout() {
227227
// Calculate clipped layout
228228
mRequiresClipping = !parentLayout.contains(interpolatedLayout);
229229

230-
Log.d(LOG_TAG, "updateLayout: " + mNodePosition);
230+
//Log.d(LOG_TAG, "updateLayout: " + mNodePosition);
231231

232232
// Update outer viewgroup layout. The outer viewgroup hosts 2 inner views
233233
// which draw the content & elevation. The outer viewgroup performs additional
@@ -326,10 +326,12 @@ private void updateLayout() {
326326
}
327327

328328
private void updateNodeVisibility() {
329+
RNSharedElementTransitionItem startItem = mItems.get(Item.START.getValue());
330+
RNSharedElementTransitionItem endItem = mItems.get(Item.END.getValue());
331+
boolean hidden = mInitialLayoutPassCompleted
332+
&& (((startItem.getStyle() != null) && (startItem.getContent() != null))
333+
|| ((endItem.getStyle() != null) && (endItem.getContent() != null)));
329334
for (RNSharedElementTransitionItem item : mItems) {
330-
boolean hidden = mInitialLayoutPassCompleted
331-
&& (item.getStyle() != null)
332-
&& (item.getContent() != null);
333335
if (hidden && (mAnimation == RNSharedElementAnimation.FADE_IN) && item.getName().equals("start")) hidden = false;
334336
if (hidden && (mAnimation == RNSharedElementAnimation.FADE_OUT) && item.getName().equals("end")) hidden = false;
335337
item.setHidden(hidden);

0 commit comments

Comments
 (0)