@react-navigation/native 8.0.0-alpha.50 → 8.0.0-alpha.51

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.
Files changed (65) hide show
  1. package/android/build.gradle +93 -21
  2. package/android/src/main/java/org/reactnavigation/MaterialSymbolModule.kt +20 -6
  3. package/android/src/main/java/org/reactnavigation/MaterialSymbolTypeface.kt +84 -29
  4. package/android/src/main/java/org/reactnavigation/MaterialSymbolView.kt +18 -18
  5. package/android/src/main/java/org/reactnavigation/MaterialSymbolViewManager.kt +11 -0
  6. package/ios/ReactNavigationSFSymbolView.mm +7 -0
  7. package/ios/ReactNavigationSFSymbolView.swift +6 -0
  8. package/lib/module/NavigationContainer.js.map +1 -1
  9. package/lib/module/native/MaterialSymbol.android.js +12 -4
  10. package/lib/module/native/MaterialSymbol.android.js.map +1 -1
  11. package/lib/module/native/MaterialSymbol.js +3 -0
  12. package/lib/module/native/MaterialSymbol.js.map +1 -1
  13. package/lib/module/native/MaterialSymbolViewNativeComponent.ts +1 -0
  14. package/lib/module/native/NativeMaterialSymbolModule.js.map +1 -1
  15. package/lib/module/useLinkProps.js +1 -1
  16. package/lib/typescript/src/NavigationContainer.d.ts +2 -1
  17. package/lib/typescript/src/NavigationContainer.d.ts.map +1 -1
  18. package/lib/typescript/src/native/MaterialSymbol.android.d.ts +4 -3
  19. package/lib/typescript/src/native/MaterialSymbol.android.d.ts.map +1 -1
  20. package/lib/typescript/src/native/MaterialSymbol.d.ts +3 -2
  21. package/lib/typescript/src/native/MaterialSymbol.d.ts.map +1 -1
  22. package/lib/typescript/src/native/MaterialSymbolData.d.ts +1 -1
  23. package/lib/typescript/src/native/MaterialSymbolData.d.ts.map +1 -1
  24. package/lib/typescript/src/native/MaterialSymbolViewNativeComponent.d.ts +1 -0
  25. package/lib/typescript/src/native/MaterialSymbolViewNativeComponent.d.ts.map +1 -1
  26. package/lib/typescript/src/native/NativeMaterialSymbolModule.d.ts +2 -1
  27. package/lib/typescript/src/native/NativeMaterialSymbolModule.d.ts.map +1 -1
  28. package/lib/typescript/src/native/types.d.ts +48 -7
  29. package/lib/typescript/src/native/types.d.ts.map +1 -1
  30. package/lib/typescript/src/types.d.ts +14 -0
  31. package/lib/typescript/src/types.d.ts.map +1 -1
  32. package/package.json +4 -4
  33. package/src/NavigationContainer.tsx +2 -1
  34. package/src/native/MaterialSymbol.android.tsx +20 -4
  35. package/src/native/MaterialSymbol.tsx +9 -2
  36. package/src/native/MaterialSymbolData.tsx +34 -373
  37. package/src/native/MaterialSymbolViewNativeComponent.ts +1 -0
  38. package/src/native/NativeMaterialSymbolModule.ts +4 -1
  39. package/src/native/types.tsx +51 -7
  40. package/src/types.tsx +15 -0
  41. package/src/useLinkProps.tsx +1 -1
  42. package/assets/fonts/MaterialSymbolsOutlined.codepoints +0 -4268
  43. package/assets/fonts/MaterialSymbolsOutlined_100.ttf +0 -0
  44. package/assets/fonts/MaterialSymbolsOutlined_200.ttf +0 -0
  45. package/assets/fonts/MaterialSymbolsOutlined_300.ttf +0 -0
  46. package/assets/fonts/MaterialSymbolsOutlined_400.ttf +0 -0
  47. package/assets/fonts/MaterialSymbolsOutlined_500.ttf +0 -0
  48. package/assets/fonts/MaterialSymbolsOutlined_600.ttf +0 -0
  49. package/assets/fonts/MaterialSymbolsOutlined_700.ttf +0 -0
  50. package/assets/fonts/MaterialSymbolsRounded.codepoints +0 -4268
  51. package/assets/fonts/MaterialSymbolsRounded_100.ttf +0 -0
  52. package/assets/fonts/MaterialSymbolsRounded_200.ttf +0 -0
  53. package/assets/fonts/MaterialSymbolsRounded_300.ttf +0 -0
  54. package/assets/fonts/MaterialSymbolsRounded_400.ttf +0 -0
  55. package/assets/fonts/MaterialSymbolsRounded_500.ttf +0 -0
  56. package/assets/fonts/MaterialSymbolsRounded_600.ttf +0 -0
  57. package/assets/fonts/MaterialSymbolsRounded_700.ttf +0 -0
  58. package/assets/fonts/MaterialSymbolsSharp.codepoints +0 -4268
  59. package/assets/fonts/MaterialSymbolsSharp_100.ttf +0 -0
  60. package/assets/fonts/MaterialSymbolsSharp_200.ttf +0 -0
  61. package/assets/fonts/MaterialSymbolsSharp_300.ttf +0 -0
  62. package/assets/fonts/MaterialSymbolsSharp_400.ttf +0 -0
  63. package/assets/fonts/MaterialSymbolsSharp_500.ttf +0 -0
  64. package/assets/fonts/MaterialSymbolsSharp_600.ttf +0 -0
  65. package/assets/fonts/MaterialSymbolsSharp_700.ttf +0 -0
@@ -14,6 +14,7 @@ export interface NativeProps extends ViewProps {
14
14
  0 | 100 | 200 | 300 | 400 | 500 | 600 | 700,
15
15
  0
16
16
  >;
17
+ fill?: CodegenTypes.WithDefault<CodegenTypes.Int32, -1>;
17
18
  size: CodegenTypes.Float;
18
19
  color?: ColorValue | undefined;
19
20
  }
@@ -3,14 +3,17 @@
3
3
  import { type TurboModule, TurboModuleRegistry } from 'react-native';
4
4
 
5
5
  export interface Spec extends TurboModule {
6
+ isAvailable(): boolean;
6
7
  getImageSource(
7
8
  name: string,
8
9
  variant: string | undefined,
9
10
  weight: 100 | 200 | 300 | 400 | 500 | 600 | 700 | undefined,
11
+ fill: boolean | undefined,
10
12
  size: number,
11
13
  // Codegen requires using `Object` instead of `object
12
14
  // eslint-disable-next-line @typescript-eslint/no-wrapper-object-types
13
- color: Object
15
+ color: Object,
16
+ direction: 'ltr' | 'rtl'
14
17
  ): string;
15
18
  }
16
19
 
@@ -1,5 +1,6 @@
1
1
  import type { ColorValue } from 'react-native';
2
2
 
3
+ import type { LocaleDirection, SFSymbolNames } from '../types';
3
4
  import type { FONT_WEIGHTS } from './constants';
4
5
  import type { MaterialSymbolName } from './MaterialSymbolData';
5
6
 
@@ -15,12 +16,13 @@ export type MaterialSymbolOptions = {
15
16
  *
16
17
  * ```json
17
18
  * "react-navigation": {
18
- * "material-symbol": {
19
+ * "material-symbols": {
19
20
  * "fonts": [
20
21
  * {
21
22
  * "variant": "rounded",
22
- * "weight": 300,
23
- * },
23
+ * "weights": [300],
24
+ * "fills": [0, 1]
25
+ * }
24
26
  * ]
25
27
  * }
26
28
  * }
@@ -38,12 +40,13 @@ export type MaterialSymbolOptions = {
38
40
  *
39
41
  * ```json
40
42
  * "react-navigation": {
41
- * "material-symbol": {
43
+ * "material-symbols": {
42
44
  * "fonts": [
43
45
  * {
44
46
  * "variant": "rounded",
45
- * "weight": 300,
46
- * },
47
+ * "weights": [300],
48
+ * "fills": [0, 1]
49
+ * }
47
50
  * ]
48
51
  * }
49
52
  * }
@@ -71,6 +74,34 @@ export type MaterialSymbolOptions = {
71
74
  | 600
72
75
  | 700
73
76
  | undefined;
77
+ /**
78
+ * Whether to use the filled version of the symbol.
79
+ *
80
+ * Can be customized using `react-navigation` key in `package.json`:
81
+ *
82
+ * ```json
83
+ * "react-navigation": {
84
+ * "material-symbols": {
85
+ * "fonts": [
86
+ * {
87
+ * "variant": "rounded",
88
+ * "weights": [300],
89
+ * "fills": [0, 1]
90
+ * }
91
+ * ]
92
+ * }
93
+ * }
94
+ * ```
95
+ *
96
+ * Here:
97
+ * - `0`: Unfilled version
98
+ * - `1`: Filled version
99
+ *
100
+ * Automatically set if a single fill is available.
101
+ *
102
+ * @default false
103
+ */
104
+ fill?: boolean | undefined;
74
105
  /**
75
106
  * The size of the symbol.
76
107
  *
@@ -85,6 +116,17 @@ export type MaterialSymbolOptions = {
85
116
  color?: ColorValue | undefined;
86
117
  };
87
118
 
119
+ export type MaterialSymbolImageSourceOptions = MaterialSymbolOptions & {
120
+ /**
121
+ * The layout direction to render the symbol for.
122
+ *
123
+ * Symbols that support auto-mirroring are flipped horizontally in RTL.
124
+ *
125
+ * @default I18nManager.getConstants().isRTL ? 'rtl' : 'ltr'
126
+ */
127
+ direction?: LocaleDirection | undefined;
128
+ };
129
+
88
130
  type SFSymbolScale = 'small' | 'medium' | 'large';
89
131
 
90
132
  type SFSymbolRenderingMode =
@@ -364,7 +406,9 @@ export type SFSymbolOptions = {
364
406
  /**
365
407
  * The name of the SF Symbol to display.
366
408
  */
367
- name: import('sf-symbols-typescript').SFSymbol;
409
+ name:
410
+ | import('sf-symbols-typescript').SFSymbol
411
+ | Extract<keyof SFSymbolNames, string>;
368
412
  /**
369
413
  * The size of the symbol.
370
414
  *
package/src/types.tsx CHANGED
@@ -58,6 +58,21 @@ declare module '@react-navigation/core' {
58
58
  interface Theme extends NativeTheme {}
59
59
  }
60
60
 
61
+ /**
62
+ * Names of custom SF Symbols available in the app, such as symbols from the asset catalog.
63
+ * Custom names can be added using declaration merging:
64
+ *
65
+ * ```ts
66
+ * declare module '@react-navigation/native' {
67
+ * interface SFSymbolNames {
68
+ * 'my.custom.symbol': true;
69
+ * }
70
+ * }
71
+ * ```
72
+ */
73
+ // eslint-disable-next-line @typescript-eslint/no-empty-interface
74
+ export interface SFSymbolNames {}
75
+
61
76
  export type LocaleDirection = 'ltr' | 'rtl';
62
77
 
63
78
  export type LinkingPrefix = '*' | (string & {});
@@ -119,7 +119,7 @@ const NAVIGATE_ACTION_TYPES = [
119
119
  * Nested params are tracked as consumed after handling
120
120
  * So navigating with same params again won't work
121
121
  * This can happen if the action or params are memoized
122
- * Or component hasn't re-renderd to re-create inline objects
122
+ * Or component hasn't re-rendered to re-create inline objects
123
123
  * So we clone the action and params when necessary before dispatch
124
124
  */
125
125
  function clone<T>(value: T): T;