@react-navigation/native 8.0.0-alpha.11 → 8.0.0-alpha.12
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/android/src/main/java/org/reactnavigation/ReactNavigationPackage.kt +3 -1
- package/ios/ReactNavigationCornerInsetView.h +14 -0
- package/ios/ReactNavigationCornerInsetView.mm +182 -0
- package/ios/ReactNavigationCornerInsetView.swift +193 -0
- package/ios/ReactNavigationCornerInsetViewComponentDescriptor.h +23 -0
- package/ios/ReactNavigationCornerInsetViewShadowNode.h +27 -0
- package/ios/ReactNavigationCornerInsetViewShadowNode.mm +42 -0
- package/ios/ReactNavigationCornerInsetViewState.h +19 -0
- package/lib/module/ServerContext.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/native/CornerInset.ios.js +61 -0
- package/lib/module/native/CornerInset.ios.js.map +1 -0
- package/lib/module/native/CornerInset.js +15 -0
- package/lib/module/native/CornerInset.js.map +1 -0
- package/lib/module/native/ReactNavigationCornerInsetViewNativeComponent.ts +32 -0
- package/lib/module/useLinkBuilder.js.map +1 -1
- package/lib/module/useLinkProps.js +2 -23
- package/lib/module/useLinkProps.js.map +1 -1
- package/lib/typescript/src/ServerContext.d.ts +1 -1
- package/lib/typescript/src/ServerContext.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/native/CornerInset.d.ts +40 -0
- package/lib/typescript/src/native/CornerInset.d.ts.map +1 -0
- package/lib/typescript/src/native/CornerInset.ios.d.ts +8 -0
- package/lib/typescript/src/native/CornerInset.ios.d.ts.map +1 -0
- package/lib/typescript/src/native/ReactNavigationCornerInsetViewNativeComponent.d.ts +14 -0
- package/lib/typescript/src/native/ReactNavigationCornerInsetViewNativeComponent.d.ts.map +1 -0
- package/lib/typescript/src/native/types.d.ts +21 -21
- package/lib/typescript/src/native/types.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +13 -13
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/lib/typescript/src/useLinkBuilder.d.ts +54 -66
- package/lib/typescript/src/useLinkBuilder.d.ts.map +1 -1
- package/lib/typescript/src/useLinkProps.d.ts.map +1 -1
- package/lib/typescript/src/useLinking.d.ts +10 -10
- package/lib/typescript/src/useLinking.native.d.ts +20 -20
- package/package.json +12 -9
- package/src/ServerContext.tsx +6 -4
- package/src/index.tsx +5 -0
- package/src/native/CornerInset.ios.tsx +82 -0
- package/src/native/CornerInset.tsx +41 -0
- package/src/native/ReactNavigationCornerInsetViewNativeComponent.ts +32 -0
- package/src/native/types.tsx +26 -22
- package/src/types.tsx +38 -36
- package/src/useLinkBuilder.tsx +7 -1
- package/src/useLinkProps.tsx +5 -38
package/src/native/types.tsx
CHANGED
|
@@ -30,7 +30,7 @@ export type MaterialSymbolOptions = {
|
|
|
30
30
|
*
|
|
31
31
|
* @default 'outlined'
|
|
32
32
|
*/
|
|
33
|
-
variant?: 'outlined' | 'rounded' | 'sharp';
|
|
33
|
+
variant?: 'outlined' | 'rounded' | 'sharp' | undefined;
|
|
34
34
|
/**
|
|
35
35
|
* The weight of the symbol.
|
|
36
36
|
*
|
|
@@ -69,19 +69,20 @@ export type MaterialSymbolOptions = {
|
|
|
69
69
|
| 400
|
|
70
70
|
| 500
|
|
71
71
|
| 600
|
|
72
|
-
| 700
|
|
72
|
+
| 700
|
|
73
|
+
| undefined;
|
|
73
74
|
/**
|
|
74
75
|
* The size of the symbol.
|
|
75
76
|
*
|
|
76
77
|
* @default 24
|
|
77
78
|
*/
|
|
78
|
-
size?: number;
|
|
79
|
+
size?: number | undefined;
|
|
79
80
|
/**
|
|
80
81
|
* The color of the symbol.
|
|
81
82
|
*
|
|
82
83
|
* @default 'black'
|
|
83
84
|
*/
|
|
84
|
-
color?: ColorValue;
|
|
85
|
+
color?: ColorValue | undefined;
|
|
85
86
|
};
|
|
86
87
|
|
|
87
88
|
export type SFSymbolScale = 'small' | 'medium' | 'large';
|
|
@@ -112,43 +113,43 @@ export type SFSymbolAnimationConfig = {
|
|
|
112
113
|
*
|
|
113
114
|
* @default false
|
|
114
115
|
*/
|
|
115
|
-
repeating?: boolean;
|
|
116
|
+
repeating?: boolean | undefined;
|
|
116
117
|
/**
|
|
117
118
|
* Number of times to repeat the animation.
|
|
118
119
|
* Ignored if `repeating` is `true`.
|
|
119
120
|
*/
|
|
120
|
-
repeatCount?: number;
|
|
121
|
+
repeatCount?: number | undefined;
|
|
121
122
|
/**
|
|
122
123
|
* Speed multiplier for the animation.
|
|
123
124
|
*
|
|
124
125
|
* @default 1
|
|
125
126
|
*/
|
|
126
|
-
speed?: number;
|
|
127
|
+
speed?: number | undefined;
|
|
127
128
|
/**
|
|
128
129
|
* Whether to animate the whole symbol at once or layer by layer.
|
|
129
130
|
*
|
|
130
131
|
* @default false
|
|
131
132
|
*/
|
|
132
|
-
wholeSymbol?: boolean;
|
|
133
|
+
wholeSymbol?: boolean | undefined;
|
|
133
134
|
/**
|
|
134
135
|
* Direction of the animation.
|
|
135
136
|
* Applicable to `bounce` and `wiggle`.
|
|
136
137
|
*/
|
|
137
|
-
direction?: 'up' | 'down';
|
|
138
|
+
direction?: 'up' | 'down' | undefined;
|
|
138
139
|
/**
|
|
139
140
|
* Whether the variable color effect reverses with each cycle.
|
|
140
141
|
* Only applicable to `variableColor`.
|
|
141
142
|
*
|
|
142
143
|
* @default false
|
|
143
144
|
*/
|
|
144
|
-
reversing?: boolean;
|
|
145
|
+
reversing?: boolean | undefined;
|
|
145
146
|
/**
|
|
146
147
|
* Whether each layer remains changed until the end of the cycle.
|
|
147
148
|
* Only applicable to `variableColor`.
|
|
148
149
|
*
|
|
149
150
|
* @default false
|
|
150
151
|
*/
|
|
151
|
-
cumulative?: boolean;
|
|
152
|
+
cumulative?: boolean | undefined;
|
|
152
153
|
};
|
|
153
154
|
|
|
154
155
|
export type SFSymbolAnimation =
|
|
@@ -164,7 +165,7 @@ export type SFSymbolOptions = {
|
|
|
164
165
|
* The size of the symbol.
|
|
165
166
|
* @default 24
|
|
166
167
|
*/
|
|
167
|
-
size?: number;
|
|
168
|
+
size?: number | undefined;
|
|
168
169
|
/**
|
|
169
170
|
* The color of the symbol.
|
|
170
171
|
* Used as the tint color in monochrome mode, and as the fallback for
|
|
@@ -172,7 +173,7 @@ export type SFSymbolOptions = {
|
|
|
172
173
|
*
|
|
173
174
|
* @default 'black'
|
|
174
175
|
*/
|
|
175
|
-
color?: ColorValue;
|
|
176
|
+
color?: ColorValue | undefined;
|
|
176
177
|
/**
|
|
177
178
|
* The weight of the symbol.
|
|
178
179
|
*
|
|
@@ -180,13 +181,14 @@ export type SFSymbolOptions = {
|
|
|
180
181
|
*/
|
|
181
182
|
weight?:
|
|
182
183
|
| keyof typeof FONT_WEIGHTS
|
|
183
|
-
| (typeof FONT_WEIGHTS)[keyof typeof FONT_WEIGHTS]
|
|
184
|
+
| (typeof FONT_WEIGHTS)[keyof typeof FONT_WEIGHTS]
|
|
185
|
+
| undefined;
|
|
184
186
|
/**
|
|
185
187
|
* The scale of the symbol relative to the font size.
|
|
186
188
|
*
|
|
187
189
|
* @default 'medium'
|
|
188
190
|
*/
|
|
189
|
-
scale?: SFSymbolScale;
|
|
191
|
+
scale?: SFSymbolScale | undefined;
|
|
190
192
|
/**
|
|
191
193
|
* The rendering mode of the symbol.
|
|
192
194
|
* - `monochrome`: Single color tint (default).
|
|
@@ -196,7 +198,7 @@ export type SFSymbolOptions = {
|
|
|
196
198
|
*
|
|
197
199
|
* @default 'monochrome'
|
|
198
200
|
*/
|
|
199
|
-
mode?: SFSymbolMode;
|
|
201
|
+
mode?: SFSymbolMode | undefined;
|
|
200
202
|
/**
|
|
201
203
|
* The colors for non-monochrome rendering modes.
|
|
202
204
|
* - `hierarchical`: uses `primary` as the base color.
|
|
@@ -205,14 +207,16 @@ export type SFSymbolOptions = {
|
|
|
205
207
|
*
|
|
206
208
|
* Falls back to `color` for `primary` if not specified.
|
|
207
209
|
*/
|
|
208
|
-
colors?:
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
210
|
+
colors?:
|
|
211
|
+
| {
|
|
212
|
+
primary?: ColorValue | undefined;
|
|
213
|
+
secondary?: ColorValue | undefined;
|
|
214
|
+
tertiary?: ColorValue | undefined;
|
|
215
|
+
}
|
|
216
|
+
| undefined;
|
|
213
217
|
/**
|
|
214
218
|
* The animation effect to apply to the symbol.
|
|
215
219
|
* Requires iOS 17+. Ignored on earlier versions.
|
|
216
220
|
*/
|
|
217
|
-
animation?: SFSymbolAnimation;
|
|
221
|
+
animation?: SFSymbolAnimation | undefined;
|
|
218
222
|
};
|
package/src/types.tsx
CHANGED
|
@@ -68,7 +68,7 @@ export type LinkingOptions<ParamList extends {}> = {
|
|
|
68
68
|
*
|
|
69
69
|
* Defaults to `true` when a linking config is specified.
|
|
70
70
|
*/
|
|
71
|
-
enabled?: boolean;
|
|
71
|
+
enabled?: boolean | undefined;
|
|
72
72
|
/**
|
|
73
73
|
* The prefixes to match to determine whether to handle a URL.
|
|
74
74
|
*
|
|
@@ -96,7 +96,7 @@ export type LinkingOptions<ParamList extends {}> = {
|
|
|
96
96
|
* }
|
|
97
97
|
* ```
|
|
98
98
|
*/
|
|
99
|
-
prefixes?: LinkingPrefix[];
|
|
99
|
+
prefixes?: LinkingPrefix[] | undefined;
|
|
100
100
|
/**
|
|
101
101
|
* Optional function which takes an incoming URL returns a boolean
|
|
102
102
|
* indicating whether React Navigation should handle it.
|
|
@@ -114,7 +114,7 @@ export type LinkingOptions<ParamList extends {}> = {
|
|
|
114
114
|
* }
|
|
115
115
|
* ```
|
|
116
116
|
*/
|
|
117
|
-
filter?: (url: string) => boolean;
|
|
117
|
+
filter?: ((url: string) => boolean) | undefined;
|
|
118
118
|
/**
|
|
119
119
|
* Config to fine-tune how to parse the path.
|
|
120
120
|
*
|
|
@@ -128,23 +128,25 @@ export type LinkingOptions<ParamList extends {}> = {
|
|
|
128
128
|
* }
|
|
129
129
|
* ```
|
|
130
130
|
*/
|
|
131
|
-
config?:
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
131
|
+
config?:
|
|
132
|
+
| {
|
|
133
|
+
/**
|
|
134
|
+
* Path string to match against for the whole navigation tree.
|
|
135
|
+
* It's not possible to specify params here since this doesn't belong to a screen.
|
|
136
|
+
* This is useful when the whole app is under a specific path.
|
|
137
|
+
* e.g. all of the screens are under `/admin` in `https://example.com/admin`
|
|
138
|
+
*/
|
|
139
|
+
path?: string | undefined;
|
|
140
|
+
/**
|
|
141
|
+
* Path configuration for child screens.
|
|
142
|
+
*/
|
|
143
|
+
screens: PathConfigMap<ParamList>;
|
|
144
|
+
/**
|
|
145
|
+
* Name of the initial route to use for the root navigator.
|
|
146
|
+
*/
|
|
147
|
+
initialRouteName?: keyof ParamList | undefined;
|
|
148
|
+
}
|
|
149
|
+
| undefined;
|
|
148
150
|
/**
|
|
149
151
|
* Custom function to get the initial URL used for linking.
|
|
150
152
|
* Uses `Linking.getInitialURL()` by default.
|
|
@@ -158,11 +160,9 @@ export type LinkingOptions<ParamList extends {}> = {
|
|
|
158
160
|
* }
|
|
159
161
|
* ```
|
|
160
162
|
*/
|
|
161
|
-
getInitialURL?:
|
|
162
|
-
| string
|
|
163
|
-
|
|
|
164
|
-
| undefined
|
|
165
|
-
| Promise<string | null | undefined>;
|
|
163
|
+
getInitialURL?:
|
|
164
|
+
| (() => string | null | undefined | Promise<string | null | undefined>)
|
|
165
|
+
| undefined;
|
|
166
166
|
/**
|
|
167
167
|
* Custom function to get subscribe to URL updates.
|
|
168
168
|
* Uses `Linking.addEventListener('url', callback)` by default.
|
|
@@ -184,30 +184,32 @@ export type LinkingOptions<ParamList extends {}> = {
|
|
|
184
184
|
* }
|
|
185
185
|
* ```
|
|
186
186
|
*/
|
|
187
|
-
subscribe?:
|
|
188
|
-
listener: (url: string) => void
|
|
189
|
-
|
|
187
|
+
subscribe?:
|
|
188
|
+
| ((listener: (url: string) => void) => undefined | void | (() => void))
|
|
189
|
+
| undefined;
|
|
190
190
|
/**
|
|
191
191
|
* Custom function to parse the URL to a valid navigation state (advanced).
|
|
192
192
|
*/
|
|
193
|
-
getStateFromPath?: typeof getStateFromPathDefault;
|
|
193
|
+
getStateFromPath?: typeof getStateFromPathDefault | undefined;
|
|
194
194
|
/**
|
|
195
195
|
* Custom function to convert the state object to a valid URL (advanced).
|
|
196
196
|
* Only applicable on Web.
|
|
197
197
|
*/
|
|
198
|
-
getPathFromState?: typeof getPathFromStateDefault;
|
|
198
|
+
getPathFromState?: typeof getPathFromStateDefault | undefined;
|
|
199
199
|
/**
|
|
200
200
|
* Custom function to convert the state object to a valid action (advanced).
|
|
201
201
|
*/
|
|
202
|
-
getActionFromState?: typeof getActionFromStateDefault;
|
|
202
|
+
getActionFromState?: typeof getActionFromStateDefault | undefined;
|
|
203
203
|
};
|
|
204
204
|
|
|
205
205
|
export type DocumentTitleOptions = {
|
|
206
|
-
enabled?: boolean;
|
|
207
|
-
formatter?:
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
206
|
+
enabled?: boolean | undefined;
|
|
207
|
+
formatter?:
|
|
208
|
+
| ((
|
|
209
|
+
options: Record<string, any> | undefined,
|
|
210
|
+
route: Route<string> | undefined
|
|
211
|
+
) => string)
|
|
212
|
+
| undefined;
|
|
211
213
|
};
|
|
212
214
|
|
|
213
215
|
export type Persistor = {
|
package/src/useLinkBuilder.tsx
CHANGED
|
@@ -13,7 +13,13 @@ import { getStateFromHref } from './getStateFromHref';
|
|
|
13
13
|
import { LinkingContext } from './LinkingContext';
|
|
14
14
|
|
|
15
15
|
type MinimalState = {
|
|
16
|
-
routes: [
|
|
16
|
+
routes: [
|
|
17
|
+
{
|
|
18
|
+
name: string;
|
|
19
|
+
params?: object | undefined;
|
|
20
|
+
state?: MinimalState | undefined;
|
|
21
|
+
},
|
|
22
|
+
];
|
|
17
23
|
};
|
|
18
24
|
|
|
19
25
|
/**
|
package/src/useLinkProps.tsx
CHANGED
|
@@ -3,11 +3,8 @@ import {
|
|
|
3
3
|
type NavigationAction,
|
|
4
4
|
NavigationContainerRefContext,
|
|
5
5
|
NavigationHelpersContext,
|
|
6
|
-
type NavigatorScreenParams,
|
|
7
|
-
type ParamListBase,
|
|
8
6
|
type RootParamList,
|
|
9
7
|
} from '@react-navigation/core';
|
|
10
|
-
import type { NavigationState, PartialState } from '@react-navigation/routers';
|
|
11
8
|
import * as React from 'react';
|
|
12
9
|
import { type GestureResponderEvent, Platform } from 'react-native';
|
|
13
10
|
|
|
@@ -32,35 +29,6 @@ export type LinkProps<
|
|
|
32
29
|
params?: undefined;
|
|
33
30
|
};
|
|
34
31
|
|
|
35
|
-
const getStateFromParams = (
|
|
36
|
-
params: NavigatorScreenParams<ParamListBase> | undefined
|
|
37
|
-
): PartialState<NavigationState> | NavigationState | undefined => {
|
|
38
|
-
if (params?.state) {
|
|
39
|
-
return params.state;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
if (params?.screen) {
|
|
43
|
-
return {
|
|
44
|
-
routes: [
|
|
45
|
-
{
|
|
46
|
-
name: params.screen,
|
|
47
|
-
params: params.params,
|
|
48
|
-
// @ts-expect-error this is fine 🔥
|
|
49
|
-
state: params.screen
|
|
50
|
-
? getStateFromParams(
|
|
51
|
-
params.params as
|
|
52
|
-
| NavigatorScreenParams<ParamListBase>
|
|
53
|
-
| undefined
|
|
54
|
-
)
|
|
55
|
-
: undefined,
|
|
56
|
-
},
|
|
57
|
-
],
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
return undefined;
|
|
62
|
-
};
|
|
63
|
-
|
|
64
32
|
/**
|
|
65
33
|
* Hook to get props for an anchor tag so it can work with in page navigation.
|
|
66
34
|
*
|
|
@@ -162,17 +130,16 @@ export function useLinkProps<
|
|
|
162
130
|
return {
|
|
163
131
|
href:
|
|
164
132
|
href ??
|
|
165
|
-
(Platform.OS === 'web' && screen
|
|
133
|
+
(Platform.OS === 'web' && typeof screen === 'string'
|
|
166
134
|
? getPathFromStateHelper(
|
|
167
135
|
{
|
|
168
136
|
routes: [
|
|
169
137
|
{
|
|
170
|
-
// @ts-expect-error this is fine 🔥
|
|
171
138
|
name: screen,
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
139
|
+
params:
|
|
140
|
+
typeof params === 'object' && params != null
|
|
141
|
+
? params
|
|
142
|
+
: undefined,
|
|
176
143
|
},
|
|
177
144
|
],
|
|
178
145
|
},
|