react-native-morph-card 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -362,7 +362,18 @@ class MorphCardSourceView(context: Context) : ReactViewGroup(context) {
362
362
  // Capture snapshot
363
363
  val cardImage = captureSnapshot()
364
364
 
365
- // Create overlay at source position
365
+ // Create a full-screen overlay container that blocks the modal target screen
366
+ // from being visible. We use a transparent overlay — the source screen remains
367
+ // visible underneath. The overlay just ensures our card wrapper is above everything.
368
+ val fullScreenOverlay = FrameLayout(context)
369
+ fullScreenOverlay.layoutParams = FrameLayout.LayoutParams(
370
+ FrameLayout.LayoutParams.MATCH_PARENT,
371
+ FrameLayout.LayoutParams.MATCH_PARENT
372
+ )
373
+ // Intercept all touches while overlay is up
374
+ fullScreenOverlay.isClickable = true
375
+
376
+ // Create card overlay at source position (on top of screen capture)
366
377
  val bgColor = cardBgColor
367
378
  val wrapper = FrameLayout(context)
368
379
  wrapper.layoutParams = FrameLayout.LayoutParams(cardWidth.toInt(), cardHeight.toInt())
@@ -380,9 +391,11 @@ class MorphCardSourceView(context: Context) : ReactViewGroup(context) {
380
391
  content.scaleType = ImageView.ScaleType.FIT_XY
381
392
  content.layoutParams = FrameLayout.LayoutParams(cardWidth.toInt(), cardHeight.toInt())
382
393
  wrapper.addView(content)
394
+ wrapper.tag = "morphCardWrapper"
395
+ fullScreenOverlay.addView(wrapper)
383
396
 
384
- decorView.addView(wrapper)
385
- overlayContainer = wrapper
397
+ decorView.addView(fullScreenOverlay)
398
+ overlayContainer = fullScreenOverlay
386
399
 
387
400
  // Hide source card — overlay covers it
388
401
  alpha = 0f
@@ -468,7 +481,9 @@ class MorphCardSourceView(context: Context) : ReactViewGroup(context) {
468
481
  Log.d(TAG, "animateExpand: pendingTarget w=${pendingTargetWidth} h=${pendingTargetHeight} br=${pendingTargetBorderRadius}")
469
482
 
470
483
  val dur = duration.toLong()
471
- val content = if (wrapper.childCount > 0) wrapper.getChildAt(0) else null
484
+ // Find the card wrapper inside the full-screen overlay
485
+ val cardWrapper = wrapper.findViewWithTag<FrameLayout>("morphCardWrapper") ?: wrapper
486
+ val content = if (cardWrapper.childCount > 0) cardWrapper.getChildAt(0) else null
472
487
 
473
488
  // Compute content offset for wrapper mode
474
489
  val contentCx = if (hasWrapper && pendingContentCentered) (targetWidthPx - cardWidth) / 2f else 0f
@@ -486,13 +501,14 @@ class MorphCardSourceView(context: Context) : ReactViewGroup(context) {
486
501
 
487
502
  animator.addUpdateListener { anim ->
488
503
  val t = anim.animatedValue as Float
489
- wrapper.x = lerp(cardLeft, targetLeft, t)
490
- wrapper.y = lerp(cardTop, targetTop, t)
491
- val lp = wrapper.layoutParams
504
+
505
+ cardWrapper.x = lerp(cardLeft, targetLeft, t)
506
+ cardWrapper.y = lerp(cardTop, targetTop, t)
507
+ val lp = cardWrapper.layoutParams
492
508
  lp.width = lerp(cardWidth, targetWidthPx, t).toInt()
493
509
  lp.height = lerp(cardHeight, targetHeightPx, t).toInt()
494
- wrapper.layoutParams = lp
495
- setRoundedCorners(wrapper, lerp(cardCornerRadiusPx, targetCornerRadiusPx, t))
510
+ cardWrapper.layoutParams = lp
511
+ setRoundedCorners(cardWrapper, lerp(cardCornerRadiusPx, targetCornerRadiusPx, t))
496
512
 
497
513
  if (content != null) {
498
514
  if (hasWrapper) {
@@ -569,8 +585,9 @@ class MorphCardSourceView(context: Context) : ReactViewGroup(context) {
569
585
  return
570
586
  }
571
587
 
572
- // Get the bitmap from the overlay
573
- val origImg = if (overlay.childCount > 0) overlay.getChildAt(0) as? ImageView else null
588
+ // Get the bitmap from the card wrapper inside the overlay
589
+ val cardWrap = overlay.findViewWithTag<FrameLayout>("morphCardWrapper") ?: overlay
590
+ val origImg = if (cardWrap.childCount > 0) cardWrap.getChildAt(0) as? ImageView else null
574
591
  val bitmap = if (origImg != null) {
575
592
  // Extract the bitmap from the drawable
576
593
  val drawable = origImg.drawable
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-morph-card",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "Native card-to-modal morph transition for React Native. iOS App Store-style expand animation.",
5
5
  "main": "lib/commonjs/index.js",
6
6
  "module": "lib/module/index.js",