@react-navigation/native 8.0.0-alpha.15 → 8.0.0-alpha.17

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,5 +1,6 @@
1
1
  package org.reactnavigation
2
2
 
3
+ import android.net.Uri
3
4
  import android.graphics.Bitmap
4
5
  import android.graphics.Canvas
5
6
  import android.graphics.Paint
@@ -15,6 +16,7 @@ import kotlinx.coroutines.SupervisorJob
15
16
  import kotlinx.coroutines.launch
16
17
  import java.io.File
17
18
  import java.io.FileOutputStream
19
+ import java.util.concurrent.ConcurrentHashMap
18
20
  import kotlin.math.roundToInt
19
21
 
20
22
  class MaterialSymbolModule(reactContext: ReactApplicationContext) :
@@ -24,6 +26,7 @@ class MaterialSymbolModule(reactContext: ReactApplicationContext) :
24
26
  const val NAME = NativeMaterialSymbolModuleSpec.NAME
25
27
 
26
28
  private val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())
29
+ private val cleanedCacheDirs = ConcurrentHashMap.newKeySet<String>()
27
30
  }
28
31
 
29
32
  private val fontHash: String by lazy {
@@ -42,8 +45,9 @@ class MaterialSymbolModule(reactContext: ReactApplicationContext) :
42
45
  }
43
46
  }
44
47
 
45
- val resolvedColor = ColorPropConverter.getColor(colorValue, reactApplicationContext)
46
- ?: throw IllegalArgumentException("Could not resolve color")
48
+ val resolvedColor = ColorPropConverter.getColor(
49
+ colorValue, currentActivity ?: reactApplicationContext
50
+ ) ?: throw IllegalArgumentException("Could not resolve color")
47
51
 
48
52
  val density = reactApplicationContext.resources.displayMetrics.density
49
53
  val scaledSize = (size * density).roundToInt().coerceAtLeast(1)
@@ -57,16 +61,23 @@ class MaterialSymbolModule(reactContext: ReactApplicationContext) :
57
61
  "react_navigation/material_symbols/$typefaceSuffix/$fontHash"
58
62
  )
59
63
 
60
- val cacheKey = "${name.hashCode()}_${scaledSize}_$resolvedColor"
61
- val cacheFile = File(cacheDir, "$cacheKey.png")
64
+ val cacheFile = File(
65
+ cacheDir, "${Uri.encode(name)}_${scaledSize}_$resolvedColor.png"
66
+ )
67
+
68
+ val cacheUri = cacheFile.toUri().toString()
62
69
 
63
70
  if (cacheFile.exists()) {
64
- return cacheFile.toUri().toString()
71
+ return cacheUri
65
72
  }
66
73
 
67
- scope.launch {
68
- cacheDir.parentFile?.listFiles { it.isDirectory && it.name != fontHash }
69
- ?.forEach { it.deleteRecursively() }
74
+ val cacheParent = cacheDir.parentFile
75
+
76
+ if (cacheParent != null && cleanedCacheDirs.add(cacheParent.absolutePath)) {
77
+ scope.launch {
78
+ cacheParent.listFiles { it.isDirectory && it.name != fontHash }
79
+ ?.forEach { it.deleteRecursively() }
80
+ }
70
81
  }
71
82
 
72
83
  cacheDir.mkdirs()
@@ -95,6 +106,6 @@ class MaterialSymbolModule(reactContext: ReactApplicationContext) :
95
106
  bitmap.recycle()
96
107
  }
97
108
 
98
- return cacheFile.toUri().toString()
109
+ return cacheUri
99
110
  }
100
111
  }
@@ -2,11 +2,12 @@ package org.reactnavigation
2
2
 
3
3
  import android.content.Context
4
4
  import android.graphics.Typeface
5
+ import java.util.concurrent.ConcurrentHashMap
5
6
 
6
7
  data class MaterialSymbolTypefaceResult(val typeface: Typeface, val suffix: String)
7
8
 
8
9
  object MaterialSymbolTypeface {
9
- private val typefaces = mutableMapOf<String, Typeface>()
10
+ private val typefaces = ConcurrentHashMap<String, Typeface>()
10
11
  private var availableFonts: Map<String, Set<Int>>? = null
11
12
 
12
13
  fun get(context: Context, variant: String?, weight: Int?): MaterialSymbolTypefaceResult {
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
 
3
- import { createComponentForStaticNavigation, createPathConfigForStaticNavigation } from '@react-navigation/core';
3
+ import { createPathConfigForStaticNavigation } from '@react-navigation/core';
4
4
  import * as React from 'react';
5
5
  import { NavigationContainer } from "./NavigationContainer.js";
6
6
  import { jsx as _jsx } from "react/jsx-runtime";
@@ -12,7 +12,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
12
12
  * @returns Navigation component to use in your app.
13
13
  */
14
14
  export function createStaticNavigation(tree) {
15
- const Component = createComponentForStaticNavigation(tree, 'RootNavigator');
15
+ const Component = tree.getComponent();
16
16
  function Navigation({
17
17
  linking,
18
18
  ...rest
@@ -1 +1 @@
1
- {"version":3,"names":["createComponentForStaticNavigation","createPathConfigForStaticNavigation","React","NavigationContainer","jsx","_jsx","createStaticNavigation","tree","Component","Navigation","linking","rest","ref","linkingConfig","useMemo","screens","initialRouteName","config","enabled","path","memoizedLinking","Error","children","forwardRef"],"sourceRoot":"../../src","sources":["createStaticNavigation.tsx"],"mappings":";;AAAA,SACEA,kCAAkC,EAClCC,mCAAmC,QAI9B,wBAAwB;AAC/B,OAAO,KAAKC,KAAK,MAAM,OAAO;AAE9B,SAASC,mBAAmB,QAAQ,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AA8B5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAACC,IAAqC,EAAE;EAC5E,MAAMC,SAAS,GAAGR,kCAAkC,CAACO,IAAI,EAAE,eAAe,CAAC;EAE3E,SAASE,UAAUA,CACjB;IAAEC,OAAO;IAAE,GAAGC;EAAY,CAAC,EAC3BC,GAAqD,EACrD;IACA,MAAMC,aAAa,GAAGX,KAAK,CAACY,OAAO,CAAC,MAAM;MACxC,MAAMC,OAAO,GAAGd,mCAAmC,CACjDM,IAAI,EACJ;QAAES,gBAAgB,EAAEN,OAAO,EAAEO,MAAM,EAAED;MAAiB,CAAC,EACvDN,OAAO,EAAEQ,OAAO,IAAI,IAAI,IAAIR,OAAO,CAACQ,OAAO,KAAK,MAClD,CAAC;MAED,IAAI,CAACH,OAAO,EAAE;MAEd,OAAO;QACLI,IAAI,EAAET,OAAO,EAAEO,MAAM,EAAEE,IAAI;QAC3BH,gBAAgB,EAAEN,OAAO,EAAEO,MAAM,EAAED,gBAAgB;QACnDD;MACF,CAAC;IACH,CAAC,EAAE,CACDL,OAAO,EAAEQ,OAAO,EAChBR,OAAO,EAAEO,MAAM,EAAEE,IAAI,EACrBT,OAAO,EAAEO,MAAM,EAAED,gBAAgB,CAClC,CAAC;IAEF,MAAMI,eAAe,GAAGlB,KAAK,CAACY,OAAO,CAAC,MAAM;MAC1C,MAAMI,OAAO,GACXR,OAAO,EAAEQ,OAAO,IAAI,IAAI,IAAIR,OAAO,CAACQ,OAAO,KAAK,MAAM,GAClD,IAAI,GACJR,OAAO,CAACQ,OAAO;MAErB,OAAO;QACL,GAAGR,OAAO;QACVQ,OAAO;QACPD,MAAM,EAAEJ;MACV,CAAC;IACH,CAAC,EAAE,CAACH,OAAO,EAAEG,aAAa,CAAC,CAAC;IAE5B,IAAIH,OAAO,EAAEQ,OAAO,KAAK,IAAI,IAAIL,aAAa,EAAEE,OAAO,IAAI,IAAI,EAAE;MAC/D,MAAM,IAAIM,KAAK,CACb,gFAAgF,GAC9E,kBAAkB,GAClB,0FAA0F,GAC1F,2EAA2E,GAC3E,gFACJ,CAAC;IACH;IAEA,oBACEhB,IAAA,CAACF,mBAAmB;MAAA,GAAKQ,IAAI;MAAEC,GAAG,EAAEA,GAAI;MAACF,OAAO,EAAEU,eAAgB;MAAAE,QAAA,eAChEjB,IAAA,CAACG,SAAS,IAAE;IAAC,CACM,CAAC;EAE1B;EAEA,oBAAON,KAAK,CAACqB,UAAU,CAACd,UAAU,CAAC;AACrC","ignoreList":[]}
1
+ {"version":3,"names":["createPathConfigForStaticNavigation","React","NavigationContainer","jsx","_jsx","createStaticNavigation","tree","Component","getComponent","Navigation","linking","rest","ref","linkingConfig","useMemo","screens","initialRouteName","config","enabled","path","memoizedLinking","Error","children","forwardRef"],"sourceRoot":"../../src","sources":["createStaticNavigation.tsx"],"mappings":";;AAAA,SACEA,mCAAmC,QAI9B,wBAAwB;AAC/B,OAAO,KAAKC,KAAK,MAAM,OAAO;AAE9B,SAASC,mBAAmB,QAAQ,0BAAuB;AAAC,SAAAC,GAAA,IAAAC,IAAA;AA8B5D;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,sBAAsBA,CAACC,IAA2B,EAAE;EAClE,MAAMC,SAAS,GAAGD,IAAI,CAACE,YAAY,CAAC,CAAC;EAErC,SAASC,UAAUA,CACjB;IAAEC,OAAO;IAAE,GAAGC;EAAY,CAAC,EAC3BC,GAAqD,EACrD;IACA,MAAMC,aAAa,GAAGZ,KAAK,CAACa,OAAO,CAAC,MAAM;MACxC,MAAMC,OAAO,GAAGf,mCAAmC,CACjDM,IAAI,EACJ;QAAEU,gBAAgB,EAAEN,OAAO,EAAEO,MAAM,EAAED;MAAiB,CAAC,EACvDN,OAAO,EAAEQ,OAAO,IAAI,IAAI,IAAIR,OAAO,CAACQ,OAAO,KAAK,MAClD,CAAC;MAED,IAAI,CAACH,OAAO,EAAE;MAEd,OAAO;QACLI,IAAI,EAAET,OAAO,EAAEO,MAAM,EAAEE,IAAI;QAC3BH,gBAAgB,EAAEN,OAAO,EAAEO,MAAM,EAAED,gBAAgB;QACnDD;MACF,CAAC;IACH,CAAC,EAAE,CACDL,OAAO,EAAEQ,OAAO,EAChBR,OAAO,EAAEO,MAAM,EAAEE,IAAI,EACrBT,OAAO,EAAEO,MAAM,EAAED,gBAAgB,CAClC,CAAC;IAEF,MAAMI,eAAe,GAAGnB,KAAK,CAACa,OAAO,CAAC,MAAM;MAC1C,MAAMI,OAAO,GACXR,OAAO,EAAEQ,OAAO,IAAI,IAAI,IAAIR,OAAO,CAACQ,OAAO,KAAK,MAAM,GAClD,IAAI,GACJR,OAAO,CAACQ,OAAO;MAErB,OAAO;QACL,GAAGR,OAAO;QACVQ,OAAO;QACPD,MAAM,EAAEJ;MACV,CAAC;IACH,CAAC,EAAE,CAACH,OAAO,EAAEG,aAAa,CAAC,CAAC;IAE5B,IAAIH,OAAO,EAAEQ,OAAO,KAAK,IAAI,IAAIL,aAAa,EAAEE,OAAO,IAAI,IAAI,EAAE;MAC/D,MAAM,IAAIM,KAAK,CACb,gFAAgF,GAC9E,kBAAkB,GAClB,0FAA0F,GAC1F,2EAA2E,GAC3E,gFACJ,CAAC;IACH;IAEA,oBACEjB,IAAA,CAACF,mBAAmB;MAAA,GAAKS,IAAI;MAAEC,GAAG,EAAEA,GAAI;MAACF,OAAO,EAAEU,eAAgB;MAAAE,QAAA,eAChElB,IAAA,CAACG,SAAS,IAAE;IAAC,CACM,CAAC;EAE1B;EAEA,oBAAON,KAAK,CAACsB,UAAU,CAACd,UAAU,CAAC;AACrC","ignoreList":[]}
@@ -5,7 +5,6 @@ import { FONT_WEIGHTS } from "./constants.js";
5
5
  import MaterialSymbolViewNativeComponent from './MaterialSymbolViewNativeComponent';
6
6
  import NativeMaterialSymbolModule from "./NativeMaterialSymbolModule.js";
7
7
  import { jsx as _jsx } from "react/jsx-runtime";
8
- const imageSourceCache = new Map();
9
8
  export function MaterialSymbol({
10
9
  name,
11
10
  weight,
@@ -37,22 +36,15 @@ MaterialSymbol.getImageSource = ({
37
36
  if (processedColor == null) {
38
37
  throw new Error(`Invalid color value: ${String(color)}`);
39
38
  }
40
- const scale = PixelRatio.get();
41
- const cacheKey = `${name}:${variant}:${weight}:${size}:${scale}:${JSON.stringify(processedColor)}`;
42
- const cached = imageSourceCache.get(cacheKey);
43
- if (cached !== undefined) {
44
- return cached;
45
- }
46
39
  const uri = NativeMaterialSymbolModule.getImageSource(name, variant, typeof weight === 'string' ? FONT_WEIGHTS[weight] : weight, size, {
47
40
  value: processedColor
48
41
  });
49
42
  const source = {
50
43
  uri,
51
- scale,
44
+ scale: PixelRatio.get(),
52
45
  width: size,
53
46
  height: size
54
47
  };
55
- imageSourceCache.set(cacheKey, source);
56
48
  return source;
57
49
  };
58
50
  //# sourceMappingURL=MaterialSymbol.android.js.map
@@ -1 +1 @@
1
- {"version":3,"names":["PixelRatio","processColor","FONT_WEIGHTS","MaterialSymbolViewNativeComponent","NativeMaterialSymbolModule","jsx","_jsx","imageSourceCache","Map","MaterialSymbol","name","weight","size","color","style","rest","width","height","getImageSource","variant","processedColor","Error","String","scale","get","cacheKey","JSON","stringify","cached","undefined","uri","value","source","set"],"sourceRoot":"../../../src","sources":["native/MaterialSymbol.android.tsx"],"mappings":";;AAAA,SAEEA,UAAU,EACVC,YAAY,QAEP,cAAc;AAErB,SAASC,YAAY,QAAQ,gBAAa;AAC1C,OAAOC,iCAAiC,MAAM,qCAAqC;AACnF,OAAOC,0BAA0B,MAAM,iCAA8B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAKtE,MAAMC,gBAAgB,GAAG,IAAIC,GAAG,CAA8B,CAAC;AAE/D,OAAO,SAASC,cAAcA,CAAC;EAC7BC,IAAI;EACJC,MAAM;EACNC,IAAI,GAAG,EAAE;EACTC,KAAK;EACLC,KAAK;EACL,GAAGC;AACgB,CAAC,EAAsB;EAC1C,oBACET,IAAA,CAACH,iCAAiC;IAChCO,IAAI,EAAEA,IAAK;IACXC,MAAM,EAAE,OAAOA,MAAM,KAAK,QAAQ,GAAGT,YAAY,CAACS,MAAM,CAAC,GAAIA,MAAM,IAAI,CAAG;IAC1EC,IAAI,EAAEA,IAAK;IACXC,KAAK,EAAEA,KAAM;IACbC,KAAK,EAAE,CACL;MACEE,KAAK,EAAEJ,IAAI;MACXK,MAAM,EAAEL;IACV,CAAC,EACDE,KAAK,CACL;IAAA,GACEC;EAAI,CACT,CAAC;AAEN;AAEAN,cAAc,CAACS,cAAc,GAAG,CAAC;EAC/BR,IAAI;EACJS,OAAO;EACPR,MAAM;EACNC,IAAI,GAAG,EAAE;EACTC,KAAK,GAAG;AACa,CAAC,KAA0B;EAChD,MAAMO,cAAc,GAAGnB,YAAY,CAACY,KAAK,CAAC;EAE1C,IAAIO,cAAc,IAAI,IAAI,EAAE;IAC1B,MAAM,IAAIC,KAAK,CAAC,wBAAwBC,MAAM,CAACT,KAAK,CAAC,EAAE,CAAC;EAC1D;EAEA,MAAMU,KAAK,GAAGvB,UAAU,CAACwB,GAAG,CAAC,CAAC;EAE9B,MAAMC,QAAQ,GAAG,GAAGf,IAAI,IAAIS,OAAO,IAAIR,MAAM,IAAIC,IAAI,IAAIW,KAAK,IAAIG,IAAI,CAACC,SAAS,CAACP,cAAc,CAAC,EAAE;EAClG,MAAMQ,MAAM,GAAGrB,gBAAgB,CAACiB,GAAG,CAACC,QAAQ,CAAC;EAE7C,IAAIG,MAAM,KAAKC,SAAS,EAAE;IACxB,OAAOD,MAAM;EACf;EAEA,MAAME,GAAG,GAAG1B,0BAA0B,CAACc,cAAc,CACnDR,IAAI,EACJS,OAAO,EACP,OAAOR,MAAM,KAAK,QAAQ,GAAGT,YAAY,CAACS,MAAM,CAAC,GAAGA,MAAM,EAC1DC,IAAI,EACJ;IAAEmB,KAAK,EAAEX;EAAe,CAC1B,CAAC;EAED,MAAMY,MAA2B,GAAG;IAClCF,GAAG;IACHP,KAAK;IACLP,KAAK,EAAEJ,IAAI;IACXK,MAAM,EAAEL;EACV,CAAC;EAEDL,gBAAgB,CAAC0B,GAAG,CAACR,QAAQ,EAAEO,MAAM,CAAC;EAEtC,OAAOA,MAAM;AACf,CAAC","ignoreList":[]}
1
+ {"version":3,"names":["PixelRatio","processColor","FONT_WEIGHTS","MaterialSymbolViewNativeComponent","NativeMaterialSymbolModule","jsx","_jsx","MaterialSymbol","name","weight","size","color","style","rest","width","height","getImageSource","variant","processedColor","Error","String","uri","value","source","scale","get"],"sourceRoot":"../../../src","sources":["native/MaterialSymbol.android.tsx"],"mappings":";;AAAA,SAEEA,UAAU,EACVC,YAAY,QAEP,cAAc;AAErB,SAASC,YAAY,QAAQ,gBAAa;AAC1C,OAAOC,iCAAiC,MAAM,qCAAqC;AACnF,OAAOC,0BAA0B,MAAM,iCAA8B;AAAC,SAAAC,GAAA,IAAAC,IAAA;AAKtE,OAAO,SAASC,cAAcA,CAAC;EAC7BC,IAAI;EACJC,MAAM;EACNC,IAAI,GAAG,EAAE;EACTC,KAAK;EACLC,KAAK;EACL,GAAGC;AACgB,CAAC,EAAsB;EAC1C,oBACEP,IAAA,CAACH,iCAAiC;IAChCK,IAAI,EAAEA,IAAK;IACXC,MAAM,EAAE,OAAOA,MAAM,KAAK,QAAQ,GAAGP,YAAY,CAACO,MAAM,CAAC,GAAIA,MAAM,IAAI,CAAG;IAC1EC,IAAI,EAAEA,IAAK;IACXC,KAAK,EAAEA,KAAM;IACbC,KAAK,EAAE,CACL;MACEE,KAAK,EAAEJ,IAAI;MACXK,MAAM,EAAEL;IACV,CAAC,EACDE,KAAK,CACL;IAAA,GACEC;EAAI,CACT,CAAC;AAEN;AAEAN,cAAc,CAACS,cAAc,GAAG,CAAC;EAC/BR,IAAI;EACJS,OAAO;EACPR,MAAM;EACNC,IAAI,GAAG,EAAE;EACTC,KAAK,GAAG;AACa,CAAC,KAA0B;EAChD,MAAMO,cAAc,GAAGjB,YAAY,CAACU,KAAK,CAAC;EAE1C,IAAIO,cAAc,IAAI,IAAI,EAAE;IAC1B,MAAM,IAAIC,KAAK,CAAC,wBAAwBC,MAAM,CAACT,KAAK,CAAC,EAAE,CAAC;EAC1D;EAEA,MAAMU,GAAG,GAAGjB,0BAA0B,CAACY,cAAc,CACnDR,IAAI,EACJS,OAAO,EACP,OAAOR,MAAM,KAAK,QAAQ,GAAGP,YAAY,CAACO,MAAM,CAAC,GAAGA,MAAM,EAC1DC,IAAI,EACJ;IAAEY,KAAK,EAAEJ;EAAe,CAC1B,CAAC;EAED,MAAMK,MAA2B,GAAG;IAClCF,GAAG;IACHG,KAAK,EAAExB,UAAU,CAACyB,GAAG,CAAC,CAAC;IACvBX,KAAK,EAAEJ,IAAI;IACXK,MAAM,EAAEL;EACV,CAAC;EAED,OAAOa,MAAM;AACf,CAAC","ignoreList":[]}
@@ -29,6 +29,6 @@ type Props = Omit<React.ComponentProps<typeof NavigationContainer>, 'linking' |
29
29
  * @param tree Static navigation config.
30
30
  * @returns Navigation component to use in your app.
31
31
  */
32
- export declare function createStaticNavigation(tree: StaticNavigation<any, any, any>): React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<NavigationContainerRef<ParamListBase>>>;
32
+ export declare function createStaticNavigation(tree: StaticNavigation<any>): React.ForwardRefExoticComponent<Omit<Props, "ref"> & React.RefAttributes<NavigationContainerRef<ParamListBase>>>;
33
33
  export {};
34
34
  //# sourceMappingURL=createStaticNavigation.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"createStaticNavigation.d.ts","sourceRoot":"","sources":["../../../src/createStaticNavigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,KAAK,KAAK,GAAG,IAAI,CACf,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,EAChD,SAAS,GAAG,UAAU,CACvB,GAAG;IACF;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC,GAAG;QACpE;;;;;;;WAOG;QACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,KAAK,CAAC;QAChC;;WAEG;QACH,MAAM,CAAC,EAAE,IAAI,CACX,WAAW,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,CAAC,EACpD,SAAS,CACV,CAAC;KACH,CAAC;CACH,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,oHA0D3E"}
1
+ {"version":3,"file":"createStaticNavigation.d.ts","sourceRoot":"","sources":["../../../src/createStaticNavigation.tsx"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,sBAAsB,EAC3B,KAAK,aAAa,EAClB,KAAK,gBAAgB,EACtB,MAAM,wBAAwB,CAAC;AAChC,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAE,mBAAmB,EAAE,MAAM,uBAAuB,CAAC;AAC5D,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,SAAS,CAAC;AAE9C,KAAK,KAAK,GAAG,IAAI,CACf,KAAK,CAAC,cAAc,CAAC,OAAO,mBAAmB,CAAC,EAChD,SAAS,GAAG,UAAU,CACvB,GAAG;IACF;;OAEG;IACH,OAAO,CAAC,EAAE,IAAI,CAAC,cAAc,CAAC,aAAa,CAAC,EAAE,QAAQ,GAAG,SAAS,CAAC,GAAG;QACpE;;;;;;;WAOG;QACH,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,GAAG,KAAK,CAAC;QAChC;;WAEG;QACH,MAAM,CAAC,EAAE,IAAI,CACX,WAAW,CAAC,cAAc,CAAC,aAAa,CAAC,CAAC,QAAQ,CAAC,CAAC,EACpD,SAAS,CACV,CAAC;KACH,CAAC;CACH,CAAC;AAEF;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,IAAI,EAAE,gBAAgB,CAAC,GAAG,CAAC,oHA0DjE"}
@@ -1 +1 @@
1
- {"version":3,"file":"MaterialSymbol.android.d.ts","sourceRoot":"","sources":["../../../../src/native/MaterialSymbol.android.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EAGxB,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAKtB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,GAAG,SAAS,CAAC;AAIpE,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,MAAM,EACN,IAAS,EACT,KAAK,EACL,KAAK,EACL,GAAG,IAAI,EACR,EAAE,mBAAmB,GAAG,KAAK,CAAC,YAAY,CAiB1C;yBAxBe,cAAc;kEAgC3B,qBAAqB,KAAG,mBAAmB"}
1
+ {"version":3,"file":"MaterialSymbol.android.d.ts","sourceRoot":"","sources":["../../../../src/native/MaterialSymbol.android.tsx"],"names":[],"mappings":"AAAA,OAAO,EACL,KAAK,mBAAmB,EAGxB,KAAK,SAAS,EACf,MAAM,cAAc,CAAC;AAKtB,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,SAAS,CAAC;AAErD,MAAM,MAAM,mBAAmB,GAAG,qBAAqB,GAAG,SAAS,CAAC;AAEpE,wBAAgB,cAAc,CAAC,EAC7B,IAAI,EACJ,MAAM,EACN,IAAS,EACT,KAAK,EACL,KAAK,EACL,GAAG,IAAI,EACR,EAAE,mBAAmB,GAAG,KAAK,CAAC,YAAY,CAiB1C;yBAxBe,cAAc;kEAgC3B,qBAAqB,KAAG,mBAAmB"}
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@react-navigation/native",
3
3
  "description": "React Native integration for React Navigation",
4
- "version": "8.0.0-alpha.15",
4
+ "version": "8.0.0-alpha.17",
5
5
  "keywords": [
6
6
  "react-native",
7
7
  "react-navigation",
@@ -57,7 +57,7 @@
57
57
  "clean": "del lib"
58
58
  },
59
59
  "dependencies": {
60
- "@react-navigation/core": "^8.0.0-alpha.7",
60
+ "@react-navigation/core": "^8.0.0-alpha.9",
61
61
  "escape-string-regexp": "^4.0.0",
62
62
  "fast-deep-equal": "^3.1.3",
63
63
  "nanoid": "^3.3.11",
@@ -75,7 +75,7 @@
75
75
  "react-native": "0.83.2",
76
76
  "react-native-builder-bob": "^0.40.12",
77
77
  "react-test-renderer": "19.2.0",
78
- "typescript": "^5.9.2"
78
+ "typescript": "^6.0.2"
79
79
  },
80
80
  "peerDependencies": {
81
81
  "react": ">= 19.2.0",
@@ -121,5 +121,5 @@
121
121
  }
122
122
  }
123
123
  },
124
- "gitHead": "1f1525607d00eb924e466889ec0e703a3f5474b7"
124
+ "gitHead": "2e3c1f2571a3fdfcb47245e963633cd34a42ccff"
125
125
  }
@@ -1,5 +1,4 @@
1
1
  import {
2
- createComponentForStaticNavigation,
3
2
  createPathConfigForStaticNavigation,
4
3
  type NavigationContainerRef,
5
4
  type ParamListBase,
@@ -44,8 +43,8 @@ type Props = Omit<
44
43
  * @param tree Static navigation config.
45
44
  * @returns Navigation component to use in your app.
46
45
  */
47
- export function createStaticNavigation(tree: StaticNavigation<any, any, any>) {
48
- const Component = createComponentForStaticNavigation(tree, 'RootNavigator');
46
+ export function createStaticNavigation(tree: StaticNavigation<any>) {
47
+ const Component = tree.getComponent();
49
48
 
50
49
  function Navigation(
51
50
  { linking, ...rest }: Props,
@@ -12,8 +12,6 @@ import type { MaterialSymbolOptions } from './types';
12
12
 
13
13
  export type MaterialSymbolProps = MaterialSymbolOptions & ViewProps;
14
14
 
15
- const imageSourceCache = new Map<string, ImageSourcePropType>();
16
-
17
15
  export function MaterialSymbol({
18
16
  name,
19
17
  weight,
@@ -53,15 +51,6 @@ MaterialSymbol.getImageSource = ({
53
51
  throw new Error(`Invalid color value: ${String(color)}`);
54
52
  }
55
53
 
56
- const scale = PixelRatio.get();
57
-
58
- const cacheKey = `${name}:${variant}:${weight}:${size}:${scale}:${JSON.stringify(processedColor)}`;
59
- const cached = imageSourceCache.get(cacheKey);
60
-
61
- if (cached !== undefined) {
62
- return cached;
63
- }
64
-
65
54
  const uri = NativeMaterialSymbolModule.getImageSource(
66
55
  name,
67
56
  variant,
@@ -72,12 +61,10 @@ MaterialSymbol.getImageSource = ({
72
61
 
73
62
  const source: ImageSourcePropType = {
74
63
  uri,
75
- scale,
64
+ scale: PixelRatio.get(),
76
65
  width: size,
77
66
  height: size,
78
67
  };
79
68
 
80
- imageSourceCache.set(cacheKey, source);
81
-
82
69
  return source;
83
70
  };