@solidnative-dev/navigation 0.0.0-stage → 0.1.0-alpha.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.
- package/LICENSE +21 -0
- package/README.md +922 -2
- package/backend/react-native-screens-4.27.0.json +24 -0
- package/dist/error-reporting.d.ts +6 -0
- package/dist/error-reporting.d.ts.map +1 -0
- package/dist/error-reporting.js +17 -0
- package/dist/error-reporting.js.map +1 -0
- package/dist/index.d.ts +592 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +3427 -0
- package/dist/index.js.map +1 -0
- package/dist/tanstack-matches.d.ts +66 -0
- package/dist/tanstack-matches.d.ts.map +1 -0
- package/dist/tanstack-matches.js +255 -0
- package/dist/tanstack-matches.js.map +1 -0
- package/dist/tanstack-router.d.ts +98 -0
- package/dist/tanstack-router.d.ts.map +1 -0
- package/dist/tanstack-router.js +501 -0
- package/dist/tanstack-router.js.map +1 -0
- package/package.json +47 -3
- package/patches/react-native-screens@4.27.0.patch +169 -0
package/package.json
CHANGED
|
@@ -1,6 +1,50 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@solidnative-dev/navigation",
|
|
3
|
-
"version": "0.0.0
|
|
4
|
-
"
|
|
5
|
-
"description": "
|
|
3
|
+
"version": "0.1.0-alpha.0",
|
|
4
|
+
"type": "module",
|
|
5
|
+
"description": "TanStack Router history synchronization and Solid-owned native presentation.",
|
|
6
|
+
"license": "MIT",
|
|
7
|
+
"homepage": "https://solidnative.dev",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/solid-native/solid-native.git",
|
|
11
|
+
"directory": "packages/navigation"
|
|
12
|
+
},
|
|
13
|
+
"publishConfig": {
|
|
14
|
+
"access": "public"
|
|
15
|
+
},
|
|
16
|
+
"engines": {
|
|
17
|
+
"node": "^22.13.0 || ^24.3.0 || >=26.0.0"
|
|
18
|
+
},
|
|
19
|
+
"exports": {
|
|
20
|
+
".": {
|
|
21
|
+
"types": "./dist/index.d.ts",
|
|
22
|
+
"default": "./dist/index.js"
|
|
23
|
+
},
|
|
24
|
+
"./react-native-screens-backend": "./backend/react-native-screens-4.27.0.json",
|
|
25
|
+
"./react-native-screens-patch": "./patches/react-native-screens@4.27.0.patch"
|
|
26
|
+
},
|
|
27
|
+
"files": [
|
|
28
|
+
"backend",
|
|
29
|
+
"dist",
|
|
30
|
+
"patches"
|
|
31
|
+
],
|
|
32
|
+
"dependencies": {
|
|
33
|
+
"@solidnative-dev/core": "0.1.0-alpha.0",
|
|
34
|
+
"@solidnative-dev/host-contract": "0.1.0-alpha.0",
|
|
35
|
+
"@solidnative-dev/renderer": "0.1.0-alpha.0",
|
|
36
|
+
"@tanstack/history": "1.162.1",
|
|
37
|
+
"@tanstack/router-core": "1.171.26"
|
|
38
|
+
},
|
|
39
|
+
"peerDependencies": {
|
|
40
|
+
"react-native-screens": "4.27.0",
|
|
41
|
+
"solid-js": "2.0.4"
|
|
42
|
+
},
|
|
43
|
+
"devDependencies": {
|
|
44
|
+
"solid-js": "2.0.4"
|
|
45
|
+
},
|
|
46
|
+
"scripts": {
|
|
47
|
+
"build": "tsc -p tsconfig.json",
|
|
48
|
+
"check": "tsc -p tsconfig.json --noEmit && tsc -p tsconfig.type-tests.json"
|
|
49
|
+
}
|
|
6
50
|
}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
diff --git a/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/screen/TabsScreen.kt b/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/screen/TabsScreen.kt
|
|
2
|
+
--- a/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/screen/TabsScreen.kt
|
|
3
|
+
+++ b/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/screen/TabsScreen.kt
|
|
4
|
+
@@ -9,7 +9,8 @@
|
|
5
|
+
import com.swmansion.rnscreens.gamma.common.container.Container
|
|
6
|
+
import com.swmansion.rnscreens.gamma.common.container.ContainerItem
|
|
7
|
+
import com.swmansion.rnscreens.gamma.common.container.ContainerItemSupport
|
|
8
|
+
-import com.swmansion.rnscreens.gamma.helpers.getSystemDrawableResource
|
|
9
|
+
+import com.swmansion.rnscreens.gamma.helpers.IconResolution
|
|
10
|
+
+import com.swmansion.rnscreens.gamma.helpers.PropIconResolver
|
|
11
|
+
import com.swmansion.rnscreens.gamma.scrollviewmarker.ScrollViewMarker
|
|
12
|
+
import com.swmansion.rnscreens.gamma.scrollviewmarker.ScrollViewSeeking
|
|
13
|
+
import com.swmansion.rnscreens.gamma.tabs.appearance.TabsAppearance
|
|
14
|
+
@@ -78,18 +79,15 @@
|
|
15
|
+
// endregion
|
|
16
|
+
|
|
17
|
+
// region Icon
|
|
18
|
+
- var drawableIconResourceName: String? by Delegates.observable(null) { _, oldValue, newValue ->
|
|
19
|
+
- if (newValue != oldValue) {
|
|
20
|
+
- icon = getSystemDrawableResource(reactContext, newValue)
|
|
21
|
+
- }
|
|
22
|
+
- }
|
|
23
|
+
+ private val iconResolver = PropIconResolver()
|
|
24
|
+
+ private val selectedIconResolver = PropIconResolver()
|
|
25
|
+
|
|
26
|
+
- var selectedDrawableIconResourceName: String? by Delegates.observable(null) { _, oldValue, newValue ->
|
|
27
|
+
- if (newValue != oldValue) {
|
|
28
|
+
- selectedIcon = getSystemDrawableResource(reactContext, newValue)
|
|
29
|
+
- }
|
|
30
|
+
- }
|
|
31
|
+
+ var drawableIconResourceName: String? = null
|
|
32
|
+
+ var imageIconResourceUri: String? = null
|
|
33
|
+
|
|
34
|
+
+ var selectedDrawableIconResourceName: String? = null
|
|
35
|
+
+ var selectedImageIconResourceUri: String? = null
|
|
36
|
+
+
|
|
37
|
+
var icon: Drawable? by Delegates.observable(null) { _, oldValue, newValue ->
|
|
38
|
+
updateMenuItemAttributesIfNeeded(oldValue, newValue)
|
|
39
|
+
}
|
|
40
|
+
@@ -98,6 +96,23 @@
|
|
41
|
+
updateMenuItemAttributesIfNeeded(oldValue, newValue)
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
+ internal fun reconcileIconResources() {
|
|
45
|
+
+ iconResolver.resolve(reactContext, drawableIconResourceName, imageIconResourceUri) { resolution ->
|
|
46
|
+
+ if (resolution is IconResolution.Resolved) {
|
|
47
|
+
+ icon = resolution.drawable
|
|
48
|
+
+ }
|
|
49
|
+
+ }
|
|
50
|
+
+ selectedIconResolver.resolve(
|
|
51
|
+
+ reactContext,
|
|
52
|
+
+ selectedDrawableIconResourceName,
|
|
53
|
+
+ selectedImageIconResourceUri,
|
|
54
|
+
+ ) { resolution ->
|
|
55
|
+
+ if (resolution is IconResolution.Resolved) {
|
|
56
|
+
+ selectedIcon = resolution.drawable
|
|
57
|
+
+ }
|
|
58
|
+
+ }
|
|
59
|
+
+ }
|
|
60
|
+
+
|
|
61
|
+
// endregion
|
|
62
|
+
|
|
63
|
+
var shouldUseRepeatedTabSelectionScrollToTopSpecialEffect: Boolean = true
|
|
64
|
+
diff --git a/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/screen/TabsScreenViewManager.kt b/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/screen/TabsScreenViewManager.kt
|
|
65
|
+
--- a/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/screen/TabsScreenViewManager.kt
|
|
66
|
+
+++ b/android/src/main/java/com/swmansion/rnscreens/gamma/tabs/screen/TabsScreenViewManager.kt
|
|
67
|
+
@@ -8,7 +8,6 @@
|
|
68
|
+
import com.facebook.react.uimanager.ViewManagerDelegate
|
|
69
|
+
import com.facebook.react.viewmanagers.RNSTabsScreenAndroidManagerDelegate
|
|
70
|
+
import com.facebook.react.viewmanagers.RNSTabsScreenAndroidManagerInterface
|
|
71
|
+
-import com.swmansion.rnscreens.gamma.helpers.loadImage
|
|
72
|
+
import com.swmansion.rnscreens.gamma.helpers.makeEventRegistrationInfo
|
|
73
|
+
import com.swmansion.rnscreens.gamma.helpers.readOptionalBoolean
|
|
74
|
+
import com.swmansion.rnscreens.gamma.helpers.readOptionalColor
|
|
75
|
+
@@ -139,30 +138,21 @@
|
|
76
|
+
view: TabsScreen,
|
|
77
|
+
value: ReadableMap?,
|
|
78
|
+
) {
|
|
79
|
+
- val uri = value?.getString("uri")
|
|
80
|
+
- if (uri != null) {
|
|
81
|
+
- loadImage(view.context, uri) { drawable ->
|
|
82
|
+
- if (drawable != null) {
|
|
83
|
+
- view.icon = drawable
|
|
84
|
+
- }
|
|
85
|
+
- }
|
|
86
|
+
- }
|
|
87
|
+
+ view.imageIconResourceUri = value?.getString("uri")
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
override fun setSelectedImageIconResource(
|
|
91
|
+
view: TabsScreen,
|
|
92
|
+
value: ReadableMap?,
|
|
93
|
+
) {
|
|
94
|
+
- val uri = value?.getString("uri")
|
|
95
|
+
- if (uri != null) {
|
|
96
|
+
- loadImage(view.context, uri) { drawable ->
|
|
97
|
+
- if (drawable != null) {
|
|
98
|
+
- view.selectedIcon = drawable
|
|
99
|
+
- }
|
|
100
|
+
- }
|
|
101
|
+
- }
|
|
102
|
+
+ view.selectedImageIconResourceUri = value?.getString("uri")
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
+ override fun onAfterUpdateTransaction(view: TabsScreen) {
|
|
106
|
+
+ super.onAfterUpdateTransaction(view)
|
|
107
|
+
+ view.reconcileIconResources()
|
|
108
|
+
+ }
|
|
109
|
+
+
|
|
110
|
+
override fun setStandardAppearance(
|
|
111
|
+
view: TabsScreen,
|
|
112
|
+
value: ReadableMap?,
|
|
113
|
+
diff --git a/ios/tabs/RNSTabBarAppearanceCoordinator.mm b/ios/tabs/RNSTabBarAppearanceCoordinator.mm
|
|
114
|
+
--- a/ios/tabs/RNSTabBarAppearanceCoordinator.mm
|
|
115
|
+
+++ b/ios/tabs/RNSTabBarAppearanceCoordinator.mm
|
|
116
|
+
@@ -100,14 +100,23 @@
|
|
117
|
+
|
|
118
|
+
// Normal icon
|
|
119
|
+
if (screenView.iconImageSource != nil) {
|
|
120
|
+
- [RNSImageLoadingHelper loadImageFromSource:screenView.iconImageSource
|
|
121
|
+
+ RCTImageSource *requestedImageSource = screenView.iconImageSource;
|
|
122
|
+
+ RNSTabsIconType requestedIconType = screenView.iconType;
|
|
123
|
+
+ [RNSImageLoadingHelper loadImageFromSource:requestedImageSource
|
|
124
|
+
withImageLoader:imageLoader
|
|
125
|
+
asTemplate:isTemplate
|
|
126
|
+
completionBlock:^(UIImage *image) {
|
|
127
|
+
- [self updateTabBarItem:weakTabBarItem
|
|
128
|
+
+ RNSTabsScreenComponentView *strongScreenView = weakScreenView;
|
|
129
|
+
+ UITabBarItem *strongTabBarItem = weakTabBarItem;
|
|
130
|
+
+ if (strongScreenView == nil || strongTabBarItem == nil ||
|
|
131
|
+
+ strongScreenView.iconImageSource != requestedImageSource ||
|
|
132
|
+
+ strongScreenView.iconType != requestedIconType) {
|
|
133
|
+
+ return;
|
|
134
|
+
+ }
|
|
135
|
+
+ [self updateTabBarItem:strongTabBarItem
|
|
136
|
+
withImage:image
|
|
137
|
+
isSelected:NO
|
|
138
|
+
- forScreenView:weakScreenView];
|
|
139
|
+
+ forScreenView:strongScreenView];
|
|
140
|
+
}];
|
|
141
|
+
} else {
|
|
142
|
+
tabBarItem.image = nil;
|
|
143
|
+
@@ -115,14 +124,23 @@
|
|
144
|
+
|
|
145
|
+
// Selected icon
|
|
146
|
+
if (screenView.selectedIconImageSource != nil) {
|
|
147
|
+
- [RNSImageLoadingHelper loadImageFromSource:screenView.selectedIconImageSource
|
|
148
|
+
+ RCTImageSource *requestedImageSource = screenView.selectedIconImageSource;
|
|
149
|
+
+ RNSTabsIconType requestedIconType = screenView.iconType;
|
|
150
|
+
+ [RNSImageLoadingHelper loadImageFromSource:requestedImageSource
|
|
151
|
+
withImageLoader:imageLoader
|
|
152
|
+
asTemplate:isTemplate
|
|
153
|
+
completionBlock:^(UIImage *image) {
|
|
154
|
+
- [self updateTabBarItem:weakTabBarItem
|
|
155
|
+
+ RNSTabsScreenComponentView *strongScreenView = weakScreenView;
|
|
156
|
+
+ UITabBarItem *strongTabBarItem = weakTabBarItem;
|
|
157
|
+
+ if (strongScreenView == nil || strongTabBarItem == nil ||
|
|
158
|
+
+ strongScreenView.selectedIconImageSource != requestedImageSource ||
|
|
159
|
+
+ strongScreenView.iconType != requestedIconType) {
|
|
160
|
+
+ return;
|
|
161
|
+
+ }
|
|
162
|
+
+ [self updateTabBarItem:strongTabBarItem
|
|
163
|
+
withImage:image
|
|
164
|
+
isSelected:YES
|
|
165
|
+
- forScreenView:weakScreenView];
|
|
166
|
+
+ forScreenView:strongScreenView];
|
|
167
|
+
}];
|
|
168
|
+
} else {
|
|
169
|
+
tabBarItem.selectedImage = nil;
|