@react-navigation/native 8.0.0-alpha.2 → 8.0.0-alpha.4

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 (177) hide show
  1. package/android/build/.transforms/586a73aab4c351d3f13dc604ca6964e8/transformed/classes/classes_dex/classes.dex +0 -0
  2. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/fbreact/specs/NativeMaterialSymbolModuleSpec.dex +0 -0
  3. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerDelegate.dex +0 -0
  4. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerInterface.dex +0 -0
  5. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolModule$Companion.dex +0 -0
  6. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolModule$getImageSource$1.dex +0 -0
  7. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolModule.dex +0 -0
  8. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolTypeface.dex +0 -0
  9. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolTypefaceResult.dex +0 -0
  10. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolView.dex +0 -0
  11. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/ReactNavigationPackage.dex +0 -0
  12. package/android/build/generated/source/codegen/java/com/facebook/fbreact/specs/NativeMaterialSymbolModuleSpec.java +2 -1
  13. package/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerDelegate.java +3 -0
  14. package/android/build/generated/source/codegen/java/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerInterface.java +1 -0
  15. package/android/build/generated/source/codegen/jni/ReactNavigationSpec-generated.cpp +1 -1
  16. package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/Props.cpp +5 -0
  17. package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/Props.h +63 -0
  18. package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/ReactNavigationSpecJSI-generated.cpp +4 -4
  19. package/android/build/generated/source/codegen/jni/react/renderer/components/ReactNavigationSpec/ReactNavigationSpecJSI.h +3 -3
  20. package/android/build/generated/source/codegen/schema.json +1 -1
  21. package/android/build/intermediates/assets/debug/mergeDebugAssets/fonts/MaterialSymbols.hash +1 -0
  22. package/android/build/intermediates/{react-navigation/fonts/MaterialSymbolsOutlined.ttf → assets/debug/mergeDebugAssets/fonts/MaterialSymbolsOutlined_400.ttf} +0 -0
  23. package/android/build/intermediates/compile_library_classes_jar/debug/bundleLibCompileToJarDebug/classes.jar +0 -0
  24. package/android/build/intermediates/incremental/mergeDebugAssets/merger.xml +1 -1
  25. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/fbreact/specs/NativeMaterialSymbolModuleSpec.class +0 -0
  26. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerDelegate.class +0 -0
  27. package/android/build/intermediates/javac/debug/compileDebugJavaWithJavac/classes/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerInterface.class +0 -0
  28. package/android/build/intermediates/react-navigation/fonts/MaterialSymbols.hash +1 -0
  29. package/android/build/intermediates/{assets/debug/mergeDebugAssets/fonts/MaterialSymbolsOutlined.ttf → react-navigation/fonts/MaterialSymbolsOutlined_400.ttf} +0 -0
  30. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/fbreact/specs/NativeMaterialSymbolModuleSpec.class +0 -0
  31. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerDelegate.class +0 -0
  32. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/com/facebook/react/viewmanagers/ReactNavigationMaterialSymbolViewManagerInterface.class +0 -0
  33. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolModule$Companion.class +0 -0
  34. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolModule$getImageSource$1.class +0 -0
  35. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolModule.class +0 -0
  36. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolTypeface.class +0 -0
  37. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolTypefaceResult.class +0 -0
  38. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolView.class +0 -0
  39. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/ReactNavigationPackage.class +0 -0
  40. package/android/build/intermediates/runtime_library_classes_jar/debug/bundleLibRuntimeToJarDebug/classes.jar +0 -0
  41. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab +0 -0
  42. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/inputs/source-to-output.tab.values.at +0 -0
  43. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab +0 -0
  44. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream +0 -0
  45. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.keystream.len +0 -0
  46. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.len +0 -0
  47. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab.values.at +0 -0
  48. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-attributes.tab_i +0 -0
  49. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab +0 -0
  50. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream +0 -0
  51. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.keystream.len +0 -0
  52. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.len +0 -0
  53. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab.values.at +0 -0
  54. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/class-fq-name-to-source.tab_i +0 -0
  55. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab +0 -0
  56. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream +0 -0
  57. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.keystream.len +0 -0
  58. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.len +0 -0
  59. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab.values.at +0 -0
  60. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/constants.tab_i +0 -0
  61. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab +0 -0
  62. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream +0 -0
  63. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.keystream.len +0 -0
  64. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.len +0 -0
  65. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab.values.at +0 -0
  66. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/internal-name-to-source.tab_i +0 -0
  67. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab +0 -0
  68. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream +0 -0
  69. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.keystream.len +0 -0
  70. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.len +0 -0
  71. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab.values.at +0 -0
  72. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/proto.tab_i +0 -0
  73. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab +0 -0
  74. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/source-to-classes.tab.values.at +0 -0
  75. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab +0 -0
  76. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream +0 -0
  77. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.keystream.len +0 -0
  78. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab.values.at +0 -0
  79. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/subtypes.tab_i +0 -0
  80. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab +0 -0
  81. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/jvm/kotlin/supertypes.tab.values.at +0 -0
  82. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/counters.tab +1 -1
  83. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab +0 -0
  84. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/file-to-id.tab.values.at +0 -0
  85. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab +0 -0
  86. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream +0 -0
  87. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.keystream.len +0 -0
  88. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.len +0 -0
  89. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab.values.at +0 -0
  90. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/id-to-file.tab_i +0 -0
  91. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab +0 -0
  92. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream +0 -0
  93. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.keystream.len +0 -0
  94. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.len +0 -0
  95. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab.values.at +0 -0
  96. package/android/build/kotlin/compileDebugKotlin/cacheable/caches-jvm/lookups/lookups.tab_i +0 -0
  97. package/android/build/kotlin/compileDebugKotlin/cacheable/last-build.bin +0 -0
  98. package/android/build/kotlin/compileDebugKotlin/classpath-snapshot/shrunk-classpath-snapshot.bin +0 -0
  99. package/android/build/tmp/compileDebugJavaWithJavac/previous-compilation-data.bin +0 -0
  100. package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolModule$Companion.class +0 -0
  101. package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolModule$getImageSource$1.class +0 -0
  102. package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolModule.class +0 -0
  103. package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolTypeface.class +0 -0
  104. package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolTypefaceResult.class +0 -0
  105. package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolView.class +0 -0
  106. package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/ReactNavigationPackage.class +0 -0
  107. package/android/build.gradle +96 -15
  108. package/android/src/main/java/org/reactnavigation/MaterialSymbolModule.kt +43 -54
  109. package/android/src/main/java/org/reactnavigation/MaterialSymbolTypeface.kt +37 -3
  110. package/android/src/main/java/org/reactnavigation/MaterialSymbolView.kt +25 -5
  111. package/android/src/main/java/org/reactnavigation/ReactNavigationPackage.kt +11 -14
  112. package/assets/fonts/MaterialSymbolsOutlined_100.ttf +0 -0
  113. package/assets/fonts/MaterialSymbolsOutlined_200.ttf +0 -0
  114. package/assets/fonts/MaterialSymbolsOutlined_300.ttf +0 -0
  115. package/assets/fonts/{MaterialSymbolsOutlined.ttf → MaterialSymbolsOutlined_400.ttf} +0 -0
  116. package/assets/fonts/MaterialSymbolsOutlined_500.ttf +0 -0
  117. package/assets/fonts/MaterialSymbolsOutlined_600.ttf +0 -0
  118. package/assets/fonts/MaterialSymbolsOutlined_700.ttf +0 -0
  119. package/assets/fonts/MaterialSymbolsRounded_100.ttf +0 -0
  120. package/assets/fonts/MaterialSymbolsRounded_200.ttf +0 -0
  121. package/assets/fonts/MaterialSymbolsRounded_300.ttf +0 -0
  122. package/assets/fonts/{MaterialSymbolsRounded.ttf → MaterialSymbolsRounded_400.ttf} +0 -0
  123. package/assets/fonts/MaterialSymbolsRounded_500.ttf +0 -0
  124. package/assets/fonts/MaterialSymbolsRounded_600.ttf +0 -0
  125. package/assets/fonts/MaterialSymbolsRounded_700.ttf +0 -0
  126. package/assets/fonts/MaterialSymbolsSharp_100.ttf +0 -0
  127. package/assets/fonts/MaterialSymbolsSharp_200.ttf +0 -0
  128. package/assets/fonts/MaterialSymbolsSharp_300.ttf +0 -0
  129. package/assets/fonts/{MaterialSymbolsSharp.ttf → MaterialSymbolsSharp_400.ttf} +0 -0
  130. package/assets/fonts/MaterialSymbolsSharp_500.ttf +0 -0
  131. package/assets/fonts/MaterialSymbolsSharp_600.ttf +0 -0
  132. package/assets/fonts/MaterialSymbolsSharp_700.ttf +0 -0
  133. package/ios/ReactNavigationSFSymbolView.mm +21 -0
  134. package/ios/ReactNavigationSFSymbolView.swift +257 -7
  135. package/lib/module/native/MaterialSymbol.android.js +13 -11
  136. package/lib/module/native/MaterialSymbol.android.js.map +1 -1
  137. package/lib/module/native/MaterialSymbolData.js +0 -9
  138. package/lib/module/native/MaterialSymbolData.js.map +1 -1
  139. package/lib/module/native/MaterialSymbolViewNativeComponent.ts +5 -1
  140. package/lib/module/native/SFSymbol.ios.js +24 -1
  141. package/lib/module/native/SFSymbol.ios.js.map +1 -1
  142. package/lib/module/native/SFSymbolViewNativeComponent.ts +15 -1
  143. package/lib/module/native/constants.js +14 -0
  144. package/lib/module/native/constants.js.map +1 -0
  145. package/lib/typescript/src/native/MaterialSymbol.android.d.ts +2 -2
  146. package/lib/typescript/src/native/MaterialSymbol.android.d.ts.map +1 -1
  147. package/lib/typescript/src/native/MaterialSymbolData.d.ts +0 -5
  148. package/lib/typescript/src/native/MaterialSymbolData.d.ts.map +1 -1
  149. package/lib/typescript/src/native/MaterialSymbolViewNativeComponent.d.ts +2 -1
  150. package/lib/typescript/src/native/MaterialSymbolViewNativeComponent.d.ts.map +1 -1
  151. package/lib/typescript/src/native/NativeMaterialSymbolModule.d.ts +1 -1
  152. package/lib/typescript/src/native/NativeMaterialSymbolModule.d.ts.map +1 -1
  153. package/lib/typescript/src/native/SFSymbol.ios.d.ts +1 -1
  154. package/lib/typescript/src/native/SFSymbol.ios.d.ts.map +1 -1
  155. package/lib/typescript/src/native/SFSymbolViewNativeComponent.d.ts +15 -1
  156. package/lib/typescript/src/native/SFSymbolViewNativeComponent.d.ts.map +1 -1
  157. package/lib/typescript/src/native/constants.d.ts +12 -0
  158. package/lib/typescript/src/native/constants.d.ts.map +1 -0
  159. package/lib/typescript/src/native/types.d.ts +139 -3
  160. package/lib/typescript/src/native/types.d.ts.map +1 -1
  161. package/package.json +10 -6
  162. package/src/native/MaterialSymbol.android.tsx +15 -10
  163. package/src/native/MaterialSymbolData.tsx +0 -6
  164. package/src/native/MaterialSymbolViewNativeComponent.ts +5 -1
  165. package/src/native/NativeMaterialSymbolModule.ts +3 -3
  166. package/src/native/SFSymbol.ios.tsx +24 -1
  167. package/src/native/SFSymbolViewNativeComponent.ts +15 -1
  168. package/src/native/constants.tsx +11 -0
  169. package/src/native/types.tsx +174 -3
  170. package/android/build/.transforms/fb9c4b42fa16b6541a5819cb4bf06272/transformed/bundleLibRuntimeToDirDebug/bundleLibRuntimeToDirDebug_dex/org/reactnavigation/MaterialSymbolModule$getImageSource$future$1$1$1.dex +0 -0
  171. package/android/build/intermediates/assets/debug/mergeDebugAssets/fonts/MaterialSymbolsRounded.ttf +0 -0
  172. package/android/build/intermediates/assets/debug/mergeDebugAssets/fonts/MaterialSymbolsSharp.ttf +0 -0
  173. package/android/build/intermediates/react-navigation/fonts/MaterialSymbolsRounded.ttf +0 -0
  174. package/android/build/intermediates/react-navigation/fonts/MaterialSymbolsSharp.ttf +0 -0
  175. package/android/build/intermediates/runtime_library_classes_dir/debug/bundleLibRuntimeToDirDebug/org/reactnavigation/MaterialSymbolModule$getImageSource$future$1$1$1.class +0 -0
  176. package/android/build/tmp/kotlin-classes/debug/org/reactnavigation/MaterialSymbolModule$getImageSource$future$1$1$1.class +0 -0
  177. package/android/gradle.properties +0 -5
@@ -1,6 +1,19 @@
1
+ import groovy.json.JsonSlurper
2
+
1
3
  buildscript {
2
- ext.getExtOrDefault = {name ->
3
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['ReactNavigation_' + name]
4
+ ext.ReactNavigation = [
5
+ kotlinVersion: "2.0.21",
6
+ minSdkVersion: 24,
7
+ compileSdkVersion: 36,
8
+ targetSdkVersion: 36
9
+ ]
10
+
11
+ ext.getExtOrDefault = { prop ->
12
+ if (rootProject.ext.has(prop)) {
13
+ return rootProject.ext.get(prop)
14
+ }
15
+
16
+ return ReactNavigation[prop]
4
17
  }
5
18
 
6
19
  repositories {
@@ -21,18 +34,14 @@ apply plugin: "kotlin-android"
21
34
 
22
35
  apply plugin: "com.facebook.react"
23
36
 
24
- def getExtOrIntegerDefault(name) {
25
- return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["ReactNavigation_" + name]).toInteger()
26
- }
27
-
28
37
  android {
29
38
  namespace "org.reactnavigation"
30
39
 
31
- compileSdkVersion getExtOrIntegerDefault("compileSdkVersion")
40
+ compileSdkVersion getExtOrDefault("compileSdkVersion")
32
41
 
33
42
  defaultConfig {
34
- minSdkVersion getExtOrIntegerDefault("minSdkVersion")
35
- targetSdkVersion getExtOrIntegerDefault("targetSdkVersion")
43
+ minSdkVersion getExtOrDefault("minSdkVersion")
44
+ targetSdkVersion getExtOrDefault("targetSdkVersion")
36
45
  }
37
46
 
38
47
  buildTypes {
@@ -51,15 +60,87 @@ android {
51
60
  }
52
61
  }
53
62
 
54
- task copyAssets(type: Copy) {
55
- from "../assets/fonts"
56
- include "*.ttf"
57
- into "${buildDir}/intermediates/react-navigation/fonts"
63
+ tasks.register('copyMaterialFonts', Copy) {
64
+ def packageJsonFile = file(rootDir.path + "/../package.json")
65
+ def fontsConfig = null
66
+
67
+ if (packageJsonFile.exists()) {
68
+ def packageJson = new JsonSlurper().parse(packageJsonFile)
69
+
70
+ fontsConfig = packageJson["react-navigation"]?.get("material-symbols")?.get("fonts")
71
+ }
72
+
73
+ fontsConfig = fontsConfig != null ? fontsConfig : [[variant: "outlined", weights: [400]]]
74
+
75
+ def assetsFontsDir = file("../assets/fonts")
76
+ def availableFonts = assetsFontsDir.listFiles()
77
+ ?.findAll { it.name.startsWith("MaterialSymbols") && it.name.endsWith(".ttf") }
78
+ ?.collect { it.name.replaceFirst(/^MaterialSymbols/, '').replaceFirst(/\.ttf$/, '') } ?: []
79
+
80
+ def validVariants = availableFonts.collect { it.split('_')[0].toLowerCase() }.unique().sort()
81
+ def validWeights = availableFonts.collect { it.split('_')[1] as int }.unique().sort()
82
+
83
+ def errors = [] as Set
84
+
85
+ fontsConfig.each { font ->
86
+ if (font.variant && !validVariants.contains(font.variant.toLowerCase())) {
87
+ errors << "Invalid font variant: ${font.variant}"
88
+ }
89
+
90
+ font.weights.each { weight ->
91
+ if (!validWeights.contains(weight)) {
92
+ errors << "Invalid font weight: ${weight}"
93
+ }
94
+ }
95
+ }
96
+
97
+ if (errors) {
98
+ throw new GradleException(
99
+ errors.join("\n") + "\n\nAvailable variants: ${validVariants.join(", ")}.\nAvailable weights: ${validWeights.join(", ")}."
100
+ )
101
+ }
102
+
103
+ def fontFiles = fontsConfig.collectMany { font ->
104
+ def variant = font.variant?.capitalize() ?: ""
105
+
106
+ font.weights.collect { weight -> "MaterialSymbols${variant}_${weight}.ttf" }
107
+ }
108
+
109
+ if (fontFiles) {
110
+ from(assetsFontsDir) { include fontFiles }
111
+ }
112
+
113
+ into layout.buildDirectory.dir("intermediates/react-navigation/fonts")
114
+
115
+ doFirst {
116
+ if (destinationDir.exists()) {
117
+ def extraFiles = destinationDir.listFiles()?.findAll { file -> !fontFiles.contains(file.name) }
118
+
119
+ extraFiles?.each { file -> file.delete() }
120
+ }
121
+ }
122
+
123
+ doLast {
124
+ def digest = java.security.MessageDigest.getInstance("MD5")
125
+
126
+ fontFiles.sort().each { name ->
127
+ def fontFile = new File(assetsFontsDir, name)
128
+
129
+ if (fontFile.exists()) {
130
+ digest.update(fontFile.bytes)
131
+ }
132
+ }
133
+
134
+ def hash = digest.digest().encodeHex().toString().take(8)
135
+ def hashFile = new File(destinationDir, "MaterialSymbols.hash")
136
+
137
+ hashFile.text = hash
138
+ }
58
139
  }
59
140
 
60
- android.sourceSets.main.assets.srcDirs += file("${buildDir}/intermediates/react-navigation")
141
+ android.sourceSets.main.assets.srcDirs += layout.buildDirectory.dir("intermediates/react-navigation")
61
142
 
62
- preBuild.dependsOn(copyAssets)
143
+ preBuild.dependsOn(copyMaterialFonts)
63
144
 
64
145
  dependencies {
65
146
  implementation "com.facebook.react:react-android"
@@ -3,6 +3,7 @@ package org.reactnavigation
3
3
  import android.graphics.Bitmap
4
4
  import android.graphics.Canvas
5
5
  import android.graphics.Paint
6
+ import androidx.core.graphics.createBitmap
6
7
  import androidx.core.net.toUri
7
8
  import com.facebook.fbreact.specs.NativeMaterialSymbolModuleSpec
8
9
  import com.facebook.react.bridge.ColorPropConverter
@@ -14,23 +15,24 @@ import kotlinx.coroutines.SupervisorJob
14
15
  import kotlinx.coroutines.launch
15
16
  import java.io.File
16
17
  import java.io.FileOutputStream
17
- import java.util.concurrent.Callable
18
- import java.util.concurrent.ConcurrentHashMap
19
- import java.util.concurrent.Executors
20
- import java.util.concurrent.Future
21
18
  import kotlin.math.roundToInt
22
19
 
23
20
  class MaterialSymbolModule(reactContext: ReactApplicationContext) :
24
21
  NativeMaterialSymbolModuleSpec(reactContext) {
25
22
 
26
23
  companion object {
27
- private val executor = Executors.newCachedThreadPool()
28
- private val futures = ConcurrentHashMap<String, Future<String>>()
24
+ const val NAME = NativeMaterialSymbolModuleSpec.NAME
25
+
29
26
  private val scope = CoroutineScope(Dispatchers.IO + SupervisorJob())
30
27
  }
31
28
 
29
+ private val fontHash: String by lazy {
30
+ reactApplicationContext.assets.open("fonts/MaterialSymbols.hash").bufferedReader().readText()
31
+ .trim()
32
+ }
33
+
32
34
  override fun getImageSource(
33
- name: String, variant: String, size: Double, color: ReadableMap, hash: String
35
+ name: String, variant: String?, weight: Double?, size: Double, color: ReadableMap
34
36
  ): String {
35
37
  val colorValue = color.getDynamic("value").let {
36
38
  when (it.type) {
@@ -46,8 +48,13 @@ class MaterialSymbolModule(reactContext: ReactApplicationContext) :
46
48
  val density = reactApplicationContext.resources.displayMetrics.density
47
49
  val scaledSize = (size * density).roundToInt().coerceAtLeast(1)
48
50
 
51
+ val (resolvedTypeface, typefaceSuffix) = MaterialSymbolTypeface.get(
52
+ reactApplicationContext, variant, weight?.toInt()
53
+ )
54
+
49
55
  val cacheDir = File(
50
- reactApplicationContext.cacheDir, "react_navigation/material_symbols/$variant/$hash"
56
+ reactApplicationContext.cacheDir,
57
+ "react_navigation/material_symbols/$typefaceSuffix/$fontHash"
51
58
  )
52
59
 
53
60
  val cacheKey = "${name.hashCode()}_${scaledSize}_$resolvedColor"
@@ -57,55 +64,37 @@ class MaterialSymbolModule(reactContext: ReactApplicationContext) :
57
64
  return cacheFile.toUri().toString()
58
65
  }
59
66
 
60
- val future = futures.computeIfAbsent(cacheKey) {
61
- executor.submit(
62
- Callable {
63
- try {
64
- scope.launch {
65
- cacheDir.parentFile?.listFiles { it.isDirectory && it.name != hash }
66
- ?.forEach { it.deleteRecursively() }
67
- }
68
-
69
- cacheDir.mkdirs()
70
-
71
- val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
72
- typeface = MaterialSymbolTypeface.get(reactApplicationContext, variant)
73
- textSize = scaledSize.toFloat()
74
- textAlign = Paint.Align.CENTER
75
-
76
- this.color = resolvedColor
77
- }
78
-
79
- val fontMetrics = paint.fontMetrics
80
- val bitmap = Bitmap.createBitmap(scaledSize, scaledSize, Bitmap.Config.ARGB_8888)
81
-
82
- try {
83
- val canvas = Canvas(bitmap)
84
- val y =
85
- (scaledSize - (fontMetrics.descent - fontMetrics.ascent)) / 2f - fontMetrics.ascent
86
-
87
- canvas.drawText(name, scaledSize / 2f, y, paint)
88
-
89
- FileOutputStream(cacheFile).use {
90
- bitmap.compress(Bitmap.CompressFormat.PNG, 100, it)
91
- }
92
- } finally {
93
- bitmap.recycle()
94
- }
95
-
96
- return@Callable cacheFile.toUri().toString()
97
- } catch (e: Exception) {
98
- futures.remove(cacheKey)
99
-
100
- throw e
101
- }
102
- })
67
+ scope.launch {
68
+ cacheDir.parentFile?.listFiles { it.isDirectory && it.name != fontHash }
69
+ ?.forEach { it.deleteRecursively() }
70
+ }
71
+
72
+ cacheDir.mkdirs()
73
+
74
+ val paint = Paint(Paint.ANTI_ALIAS_FLAG).apply {
75
+ typeface = resolvedTypeface
76
+ textSize = scaledSize.toFloat()
77
+ textAlign = Paint.Align.CENTER
78
+
79
+ this.color = resolvedColor
103
80
  }
104
81
 
82
+ val fontMetrics = paint.fontMetrics
83
+ val bitmap = createBitmap(scaledSize, scaledSize)
84
+
105
85
  try {
106
- return future.get()
107
- } catch (e: Exception) {
108
- throw (e.cause as? Exception) ?: e
86
+ val canvas = Canvas(bitmap)
87
+ val y = (scaledSize - (fontMetrics.descent - fontMetrics.ascent)) / 2f - fontMetrics.ascent
88
+
89
+ canvas.drawText(name, scaledSize / 2f, y, paint)
90
+
91
+ FileOutputStream(cacheFile).use {
92
+ bitmap.compress(Bitmap.CompressFormat.PNG, 100, it)
93
+ }
94
+ } finally {
95
+ bitmap.recycle()
109
96
  }
97
+
98
+ return cacheFile.toUri().toString()
110
99
  }
111
100
  }
@@ -3,17 +3,26 @@ package org.reactnavigation
3
3
  import android.content.Context
4
4
  import android.graphics.Typeface
5
5
 
6
+ data class MaterialSymbolTypefaceResult(val typeface: Typeface, val suffix: String)
7
+
6
8
  object MaterialSymbolTypeface {
7
9
  private val typefaces = mutableMapOf<String, Typeface>()
10
+ private var defaultSuffix: String? = null
8
11
 
9
- fun get(context: Context, variant: String?): Typeface {
10
- return typefaces.getOrPut(variant ?: "outlined") {
11
- val suffix = when (variant) {
12
+ fun get(context: Context, variant: String?, weight: Int?): MaterialSymbolTypefaceResult {
13
+ val suffix = if (variant != null && weight != null) {
14
+ val resolvedVariant = when (variant) {
12
15
  "rounded" -> "Rounded"
13
16
  "sharp" -> "Sharp"
14
17
  else -> "Outlined"
15
18
  }
16
19
 
20
+ "${resolvedVariant}_$weight"
21
+ } else {
22
+ getDefaultSuffix(context)
23
+ }
24
+
25
+ val typeface = typefaces.getOrPut(suffix) {
17
26
  val path = "fonts/MaterialSymbols${suffix}.ttf"
18
27
 
19
28
  try {
@@ -22,5 +31,30 @@ object MaterialSymbolTypeface {
22
31
  throw RuntimeException("$path not found.", e)
23
32
  }
24
33
  }
34
+
35
+ return MaterialSymbolTypefaceResult(typeface, suffix)
36
+ }
37
+
38
+ private fun getDefaultSuffix(context: Context): String {
39
+ defaultSuffix?.let { return it }
40
+
41
+ val fonts = context.assets.list("fonts")
42
+ ?.filter { it.startsWith("MaterialSymbols") && it.endsWith(".ttf") } ?: emptyList()
43
+
44
+ if (fonts.isEmpty()) {
45
+ throw RuntimeException("No MaterialSymbols font found in assets.")
46
+ }
47
+
48
+ if (fonts.size > 1) {
49
+ throw RuntimeException(
50
+ "Multiple MaterialSymbols fonts found in assets: ${fonts.joinToString()}. " + "Please specify a variant and weight explicitly."
51
+ )
52
+ }
53
+
54
+ val suffix = fonts[0].removePrefix("MaterialSymbols").removeSuffix(".ttf")
55
+
56
+ defaultSuffix = suffix
57
+
58
+ return suffix
25
59
  }
26
60
  }
@@ -4,13 +4,17 @@ import android.content.Context
4
4
  import android.graphics.Canvas
5
5
  import android.graphics.Paint
6
6
  import android.util.AttributeSet
7
- import android.widget.TextView
8
7
 
9
8
  class MaterialSymbolView @JvmOverloads constructor(
10
9
  context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
11
- ) : TextView(context, attrs, defStyleAttr) {
10
+ ) : androidx.appcompat.widget.AppCompatTextView(context, attrs, defStyleAttr) {
12
11
 
13
12
  private var variant: String? = null
13
+ private var weight: Int? = null
14
+
15
+ init {
16
+ updateTypeface()
17
+ }
14
18
 
15
19
  override fun onDraw(canvas: Canvas) {
16
20
  val text = text?.toString() ?: return
@@ -30,13 +34,29 @@ class MaterialSymbolView @JvmOverloads constructor(
30
34
  }
31
35
 
32
36
  fun setVariant(variant: String) {
33
- if (this.variant == variant) {
37
+ val resolvedVariant = variant.ifEmpty { null }
38
+
39
+ if (this.variant == resolvedVariant) {
40
+ return
41
+ }
42
+
43
+ this.variant = resolvedVariant
44
+ updateTypeface()
45
+ }
46
+
47
+ fun setWeight(weight: Int) {
48
+ val resolvedWeight = weight.takeIf { it != 0 }
49
+
50
+ if (this.weight == resolvedWeight) {
34
51
  return
35
52
  }
36
53
 
37
- this.variant = variant
54
+ this.weight = resolvedWeight
55
+ updateTypeface()
56
+ }
38
57
 
39
- setTypeface(MaterialSymbolTypeface.get(context, variant))
58
+ private fun updateTypeface() {
59
+ setTypeface(MaterialSymbolTypeface.get(context, variant, weight).typeface)
40
60
  invalidate()
41
61
  }
42
62
 
@@ -1,6 +1,5 @@
1
1
  package org.reactnavigation
2
2
 
3
- import com.facebook.fbreact.specs.NativeMaterialSymbolModuleSpec
4
3
  import com.facebook.react.BaseReactPackage
5
4
  import com.facebook.react.bridge.NativeModule
6
5
  import com.facebook.react.bridge.ReactApplicationContext
@@ -15,23 +14,21 @@ class ReactNavigationPackage : BaseReactPackage() {
15
14
 
16
15
  override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? {
17
16
  return when (name) {
18
- NativeMaterialSymbolModuleSpec.NAME -> MaterialSymbolModule(reactContext)
17
+ MaterialSymbolModule.NAME -> MaterialSymbolModule(reactContext)
19
18
  else -> null
20
19
  }
21
20
  }
22
21
 
23
- override fun getReactModuleInfoProvider(): ReactModuleInfoProvider {
24
- return ReactModuleInfoProvider {
25
- mapOf(
26
- NativeMaterialSymbolModuleSpec.NAME to ReactModuleInfo(
27
- NativeMaterialSymbolModuleSpec.NAME,
28
- MaterialSymbolModule::class.java.name,
29
- false, // canOverrideExistingModule
30
- false, // needsEagerInit
31
- false, // isCxxModule
32
- true // isTurboModule
33
- )
22
+ override fun getReactModuleInfoProvider() = ReactModuleInfoProvider {
23
+ mapOf(
24
+ MaterialSymbolModule.NAME to ReactModuleInfo(
25
+ name = MaterialSymbolModule.NAME,
26
+ className = MaterialSymbolModule.NAME,
27
+ canOverrideExistingModule = false,
28
+ needsEagerInit = false,
29
+ isCxxModule = false,
30
+ isTurboModule = true
34
31
  )
35
- }
32
+ )
36
33
  }
37
34
  }
@@ -45,6 +45,27 @@ static ReactNavigationSFSymbolViewImplProps *convertProps(const Props::Shared &p
45
45
  swiftProps.name = RCTNSStringFromString(viewProps.name);
46
46
  swiftProps.size = viewProps.size;
47
47
  swiftProps.color = RCTUIColorFromSharedColor(viewProps.color);
48
+ swiftProps.weight = viewProps.weight;
49
+ swiftProps.scale = RCTNSStringFromString(viewProps.scale);
50
+ swiftProps.mode = RCTNSStringFromString(viewProps.mode);
51
+ swiftProps.animation = RCTNSStringFromString(viewProps.animation);
52
+ swiftProps.animationRepeating = viewProps.animationRepeating;
53
+ swiftProps.animationRepeatCount = viewProps.animationRepeatCount;
54
+ swiftProps.animationSpeed = viewProps.animationSpeed;
55
+ swiftProps.animationWholeSymbol = viewProps.animationWholeSymbol;
56
+ swiftProps.animationDirection = RCTNSStringFromString(viewProps.animationDirection);
57
+ swiftProps.animationReversing = viewProps.animationReversing;
58
+ swiftProps.animationCumulative = viewProps.animationCumulative;
59
+
60
+ if (viewProps.colorPrimary) {
61
+ swiftProps.colorPrimary = RCTUIColorFromSharedColor(viewProps.colorPrimary);
62
+ }
63
+ if (viewProps.colorSecondary) {
64
+ swiftProps.colorSecondary = RCTUIColorFromSharedColor(viewProps.colorSecondary);
65
+ }
66
+ if (viewProps.colorTertiary) {
67
+ swiftProps.colorTertiary = RCTUIColorFromSharedColor(viewProps.colorTertiary);
68
+ }
48
69
 
49
70
  return swiftProps;
50
71
  }