react-native-navigation 8.6.3 → 8.7.0

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.
@@ -1,9 +1,6 @@
1
1
  package com.reactnativenavigation.utils
2
2
 
3
- import com.facebook.react.common.annotations.UnstableReactNativeAPI
4
- import com.facebook.react.uimanager.drawable.CSSBackgroundDrawable
5
3
  import com.facebook.react.views.view.ReactViewGroup
6
4
 
7
- @OptIn(UnstableReactNativeAPI::class)
8
5
  val ReactViewGroup.borderRadius: Float
9
- get() = (background as? CSSBackgroundDrawable)?.fullBorderWidth ?: 0f
6
+ get() = 0f // CSSBackgroundDrawable is no longer available, return 0f as fallback
@@ -1,6 +1,9 @@
1
1
  package com.reactnativenavigation.utils;
2
2
 
3
+ import android.graphics.Color;
3
4
  import android.graphics.Point;
5
+ import android.graphics.drawable.ColorDrawable;
6
+ import android.graphics.drawable.Drawable;
4
7
  import android.view.View;
5
8
  import android.view.ViewGroup;
6
9
  import android.view.ViewParent;
@@ -12,9 +15,6 @@ import androidx.annotation.Nullable;
12
15
 
13
16
  import static com.reactnativenavigation.utils.ObjectUtils.perform;
14
17
 
15
- import com.facebook.react.common.annotations.UnstableReactNativeAPI;
16
- import com.facebook.react.uimanager.drawable.CSSBackgroundDrawable;
17
-
18
18
  public class ViewUtils {
19
19
  @Nullable
20
20
  public static <T extends View> T findChildByClass(ViewGroup root, Class<T> clazz) {
@@ -108,15 +108,15 @@ public class ViewUtils {
108
108
  return ((ViewGroup) parent).indexOfChild(view);
109
109
  }
110
110
 
111
- @UnstableReactNativeAPI
112
111
  public static int getBackgroundColor(View view) {
113
- if (view.getBackground() instanceof CSSBackgroundDrawable) {
114
- return ((CSSBackgroundDrawable) view.getBackground()).getColor();
112
+ Drawable background = view.getBackground();
113
+ if (background instanceof ColorDrawable) {
114
+ return ((ColorDrawable) background).getColor();
115
115
  }
116
- throw new RuntimeException(view.getBackground().getClass().getSimpleName() + " is not ReactViewBackgroundDrawable");
116
+ // Fallback: return transparent if background is not a ColorDrawable
117
+ return Color.TRANSPARENT;
117
118
  }
118
119
 
119
-
120
120
  public static boolean isVisible(View view) {
121
121
  return perform(view, false, v -> v.getVisibility() == View.VISIBLE);
122
122
  }
@@ -4,27 +4,43 @@ import android.animation.Animator
4
4
  import android.animation.ObjectAnimator
5
5
  import android.view.View
6
6
  import android.view.ViewGroup
7
- import com.facebook.react.common.annotations.UnstableReactNativeAPI
8
- import com.facebook.react.uimanager.drawable.CSSBackgroundDrawable
7
+ import android.graphics.drawable.ColorDrawable
9
8
  import com.facebook.react.views.text.ReactTextView
10
9
  import com.reactnativenavigation.options.SharedElementTransitionOptions
11
10
  import com.reactnativenavigation.utils.*
12
11
 
13
- @OptIn(UnstableReactNativeAPI::class)
14
12
  class BackgroundColorAnimator(from: View, to: View) : PropertyAnimatorCreator<ViewGroup>(from, to) {
15
13
  override fun shouldAnimateProperty(fromChild: ViewGroup, toChild: ViewGroup): Boolean {
16
- return fromChild.background is CSSBackgroundDrawable &&
17
- toChild.background is CSSBackgroundDrawable && (fromChild.background as CSSBackgroundDrawable).color != (toChild.background as CSSBackgroundDrawable).color
14
+ // Only animate if both backgrounds are ColorDrawable and colors are different
15
+ val fromBg = fromChild.background
16
+ val toBg = toChild.background
17
+ return fromBg is ColorDrawable &&
18
+ toBg is ColorDrawable &&
19
+ fromBg.color != toBg.color
18
20
  }
19
21
 
20
22
  override fun excludedViews() = listOf(ReactTextView::class.java)
21
23
 
22
24
  override fun create(options: SharedElementTransitionOptions): Animator {
23
- val backgroundColorEvaluator = BackgroundColorEvaluator(to.background as CSSBackgroundDrawable)
24
- val fromColor = ColorUtils.colorToLAB(ViewUtils.getBackgroundColor(from))
25
- val toColor = ColorUtils.colorToLAB(ViewUtils.getBackgroundColor(to))
25
+ val toBackground = to.background
26
+ if (toBackground !is ColorDrawable) {
27
+ // Fallback: return a no-op animator if background is not a ColorDrawable but this should happen.
28
+ // Just for code safety
29
+ return ObjectAnimator.ofFloat(to, "alpha", 1f, 1f).apply {
30
+ duration = 0
31
+ }
32
+ }
33
+
34
+ val backgroundColorEvaluator = BackgroundColorEvaluator(toBackground)
35
+ val fromColor = try {
36
+ ColorUtils.colorToLAB(ViewUtils.getBackgroundColor(from))
37
+ } catch (e: Exception) {
38
+ // Fallback to transparent if we can't get the color
39
+ ColorUtils.colorToLAB(android.graphics.Color.TRANSPARENT)
40
+ }
41
+ val toColor = ColorUtils.colorToLAB(toBackground.color)
26
42
 
27
43
  backgroundColorEvaluator.evaluate(0f, fromColor, toColor)
28
44
  return ObjectAnimator.ofObject(backgroundColorEvaluator, fromColor, toColor)
29
45
  }
30
- }
46
+ }
@@ -2,16 +2,20 @@ package com.reactnativenavigation.views.element.animators
2
2
 
3
3
  import android.animation.TypeEvaluator
4
4
  import androidx.core.graphics.ColorUtils
5
- import com.facebook.react.common.annotations.UnstableReactNativeAPI
6
- import com.facebook.react.uimanager.drawable.CSSBackgroundDrawable
5
+ import android.graphics.drawable.Drawable
6
+ import android.graphics.drawable.ColorDrawable
7
+ import com.reactnativenavigation.utils.ColorUtils.*
7
8
 
8
- class BackgroundColorEvaluator @OptIn(UnstableReactNativeAPI::class) constructor(private val background: CSSBackgroundDrawable) : TypeEvaluator<DoubleArray> {
9
+ class BackgroundColorEvaluator(private val background: Drawable) : TypeEvaluator<DoubleArray> {
9
10
  private val color = DoubleArray(3)
10
11
 
11
- @OptIn(UnstableReactNativeAPI::class)
12
12
  override fun evaluate(ratio: Float, from: DoubleArray, to: DoubleArray): DoubleArray {
13
13
  ColorUtils.blendLAB(from, to, ratio.toDouble(), color)
14
- background.color = com.reactnativenavigation.utils.ColorUtils.labToColor(color)
14
+ val colorInt = labToColor(color)
15
+ // Try to set color on ColorDrawable if the background is a ColorDrawable
16
+ if (background is ColorDrawable) {
17
+ background.color = colorInt
18
+ }
15
19
  return color
16
20
  }
17
21
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-navigation",
3
- "version": "8.6.3",
3
+ "version": "8.7.0",
4
4
  "description": "React Native Navigation - truly native navigation for iOS and Android",
5
5
  "license": "MIT",
6
6
  "nativePackage": true,
@@ -93,10 +93,10 @@
93
93
  "@react-native-community/cli-platform-ios": "20.0.0",
94
94
  "@react-native-community/datetimepicker": "^8.2.0",
95
95
  "@react-native-community/netinfo": "^11.4.1",
96
- "@react-native/babel-preset": "0.82.1",
97
- "@react-native/eslint-config": "0.82.1",
98
- "@react-native/metro-config": "0.82.1",
99
- "@react-native/typescript-config": "0.82.1",
96
+ "@react-native/babel-preset": "0.83.0",
97
+ "@react-native/eslint-config": "0.83.0",
98
+ "@react-native/metro-config": "0.83.0",
99
+ "@react-native/typescript-config": "0.83.0",
100
100
  "@testing-library/jest-native": "^5.4.2",
101
101
  "@testing-library/react-native": "^13.0.1",
102
102
  "@types/hoist-non-react-statics": "^3.3.6",
@@ -104,7 +104,7 @@
104
104
  "@types/jest": "^29.5.13",
105
105
  "@types/lodash": "^4.17.20",
106
106
  "@types/prop-types": "^15.7.14",
107
- "@types/react": "^19.1.1",
107
+ "@types/react": "^19.2.0",
108
108
  "@types/react-test-renderer": "^19.1.0",
109
109
  "@typescript-eslint/eslint-plugin": "8.21.0",
110
110
  "@typescript-eslint/parser": "8.21.0",
@@ -124,15 +124,15 @@
124
124
  "pixelmatch": "^5.2.1",
125
125
  "pngjs": "^6.0.0",
126
126
  "prettier": "2.8.8",
127
- "react": "19.1.1",
128
- "react-native": "0.82.1",
127
+ "react": "19.2.0",
128
+ "react-native": "0.83.0",
129
129
  "react-native-builder-bob": "^0.40.13",
130
130
  "react-native-fast-image": "^8.6.3",
131
131
  "react-native-gesture-handler": "^2.29.1",
132
132
  "react-native-reanimated": "4.1.5",
133
133
  "react-native-worklets": "0.5.0",
134
134
  "react-redux": "9.1.2",
135
- "react-test-renderer": "19.1.1",
135
+ "react-test-renderer": "19.2.0",
136
136
  "redux": "^5.0.1",
137
137
  "remx": "3.x.x",
138
138
  "semver": "5.x.x",