@react-navigation/native 8.0.0-alpha.27 → 8.0.0-alpha.29
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/ios/ReactNavigationSFSymbolView.mm +22 -9
- package/ios/ReactNavigationSFSymbolView.swift +351 -65
- package/lib/module/__stubs__/createStackNavigator.js +9 -1
- package/lib/module/__stubs__/createStackNavigator.js.map +1 -1
- package/lib/module/__stubs__/window.js +3 -0
- package/lib/module/__stubs__/window.js.map +1 -1
- package/lib/module/createMemoryHistory.js +7 -3
- package/lib/module/createMemoryHistory.js.map +1 -1
- package/lib/module/createStandardNavigationFactories.js +99 -0
- package/lib/module/createStandardNavigationFactories.js.map +1 -0
- package/lib/module/extractPathFromURL.js +1 -1
- package/lib/module/extractPathFromURL.js.map +1 -1
- package/lib/module/getStateFromHref.js +2 -2
- package/lib/module/getStateFromHref.js.map +1 -1
- package/lib/module/index.js +1 -0
- package/lib/module/index.js.map +1 -1
- package/lib/module/native/SFSymbol.ios.js +35 -14
- package/lib/module/native/SFSymbol.ios.js.map +1 -1
- package/lib/module/native/SFSymbolViewNativeComponent.ts +22 -9
- package/lib/module/useLinkBuilder.js +4 -3
- package/lib/module/useLinkBuilder.js.map +1 -1
- package/lib/module/useLinking.js +11 -2
- package/lib/module/useLinking.js.map +1 -1
- package/lib/module/useLinking.native.js +5 -5
- package/lib/module/useLinking.native.js.map +1 -1
- package/lib/module/useMemoArray.js +25 -0
- package/lib/module/useMemoArray.js.map +1 -0
- package/lib/module/useScrollToTop.js +2 -1
- package/lib/module/useScrollToTop.js.map +1 -1
- package/lib/typescript/src/Link.d.ts +1 -1
- package/lib/typescript/src/Link.d.ts.map +1 -1
- package/lib/typescript/src/LinkingContext.d.ts +1 -1
- package/lib/typescript/src/LinkingContext.d.ts.map +1 -1
- package/lib/typescript/src/LocaleDirContext.d.ts +1 -1
- package/lib/typescript/src/LocaleDirContext.d.ts.map +1 -1
- package/lib/typescript/src/NavigationContainer.d.ts +2 -2
- package/lib/typescript/src/NavigationContainer.d.ts.map +1 -1
- package/lib/typescript/src/__stubs__/createStackNavigator.d.ts +1 -1
- package/lib/typescript/src/__stubs__/createStackNavigator.d.ts.map +1 -1
- package/lib/typescript/src/__stubs__/window.d.ts.map +1 -1
- package/lib/typescript/src/createMemoryHistory.d.ts +1 -1
- package/lib/typescript/src/createMemoryHistory.d.ts.map +1 -1
- package/lib/typescript/src/createStandardNavigationFactories.d.ts +31 -0
- package/lib/typescript/src/createStandardNavigationFactories.d.ts.map +1 -0
- package/lib/typescript/src/createStaticNavigation.d.ts +3 -3
- package/lib/typescript/src/createStaticNavigation.d.ts.map +1 -1
- package/lib/typescript/src/extractPathFromURL.d.ts +1 -1
- package/lib/typescript/src/extractPathFromURL.d.ts.map +1 -1
- package/lib/typescript/src/getStateFromHref.d.ts +3 -3
- package/lib/typescript/src/getStateFromHref.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +15 -14
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/native/CornerInset.d.ts +1 -1
- package/lib/typescript/src/native/CornerInset.d.ts.map +1 -1
- package/lib/typescript/src/native/CornerInset.ios.d.ts +2 -2
- package/lib/typescript/src/native/CornerInset.ios.d.ts.map +1 -1
- package/lib/typescript/src/native/MaterialSymbol.android.d.ts +1 -1
- package/lib/typescript/src/native/MaterialSymbol.android.d.ts.map +1 -1
- package/lib/typescript/src/native/MaterialSymbol.d.ts +1 -1
- package/lib/typescript/src/native/MaterialSymbol.d.ts.map +1 -1
- package/lib/typescript/src/native/SFSymbol.d.ts +1 -1
- package/lib/typescript/src/native/SFSymbol.d.ts.map +1 -1
- package/lib/typescript/src/native/SFSymbol.ios.d.ts +2 -2
- package/lib/typescript/src/native/SFSymbol.ios.d.ts.map +1 -1
- package/lib/typescript/src/native/SFSymbolViewNativeComponent.d.ts +22 -9
- package/lib/typescript/src/native/SFSymbolViewNativeComponent.d.ts.map +1 -1
- package/lib/typescript/src/native/types.d.ts +227 -31
- package/lib/typescript/src/native/types.d.ts.map +1 -1
- package/lib/typescript/src/server/index.d.ts +1 -1
- package/lib/typescript/src/server/index.d.ts.map +1 -1
- package/lib/typescript/src/theming/MaterialTheme.d.ts +1 -1
- package/lib/typescript/src/theming/MaterialTheme.d.ts.map +1 -1
- package/lib/typescript/src/useDocumentTitle.d.ts +1 -1
- package/lib/typescript/src/useDocumentTitle.d.ts.map +1 -1
- package/lib/typescript/src/useLinkBuilder.d.ts.map +1 -1
- package/lib/typescript/src/useLinking.d.ts +6 -6
- package/lib/typescript/src/useLinking.d.ts.map +1 -1
- package/lib/typescript/src/useLinking.native.d.ts +10 -10
- package/lib/typescript/src/useLinking.native.d.ts.map +1 -1
- package/lib/typescript/src/useLocale.d.ts +1 -1
- package/lib/typescript/src/useMemoArray.d.ts +2 -0
- package/lib/typescript/src/useMemoArray.d.ts.map +1 -0
- package/lib/typescript/src/useScrollToTop.d.ts.map +1 -1
- package/package.json +13 -12
- package/src/__stubs__/createStackNavigator.tsx +13 -5
- package/src/__stubs__/window.tsx +5 -0
- package/src/createMemoryHistory.tsx +10 -3
- package/src/createStandardNavigationFactories.tsx +218 -0
- package/src/extractPathFromURL.tsx +1 -1
- package/src/getStateFromHref.tsx +8 -3
- package/src/index.tsx +4 -0
- package/src/native/SFSymbol.ios.tsx +73 -14
- package/src/native/SFSymbolViewNativeComponent.ts +22 -9
- package/src/native/types.tsx +278 -32
- package/src/useLinkBuilder.tsx +4 -2
- package/src/useLinking.native.tsx +17 -10
- package/src/useLinking.tsx +19 -2
- package/src/useMemoArray.tsx +41 -0
- package/src/useScrollToTop.tsx +2 -1
|
@@ -10,7 +10,7 @@ type HistoryRecord = {
|
|
|
10
10
|
path: string;
|
|
11
11
|
};
|
|
12
12
|
|
|
13
|
-
const getPathWithoutHash = (path: string) => path.split('#')[0];
|
|
13
|
+
const getPathWithoutHash = (path: string) => path.split('#')[0] ?? '';
|
|
14
14
|
|
|
15
15
|
export function createMemoryHistory() {
|
|
16
16
|
let index = 0;
|
|
@@ -56,6 +56,10 @@ export function createMemoryHistory() {
|
|
|
56
56
|
for (let i = index - 1; i >= 0; i--) {
|
|
57
57
|
const item = items[i];
|
|
58
58
|
|
|
59
|
+
if (item == null) {
|
|
60
|
+
continue;
|
|
61
|
+
}
|
|
62
|
+
|
|
59
63
|
if (item.path === pathWithoutHash) {
|
|
60
64
|
return i;
|
|
61
65
|
}
|
|
@@ -107,9 +111,12 @@ export function createMemoryHistory() {
|
|
|
107
111
|
items = [{ path: pathWithoutHash, state, id }];
|
|
108
112
|
index = 0;
|
|
109
113
|
} else {
|
|
110
|
-
|
|
114
|
+
const item = items[index];
|
|
115
|
+
|
|
116
|
+
if (item?.path === pathWithoutHash) {
|
|
111
117
|
pathWithHash = pathWithHash + hash;
|
|
112
118
|
}
|
|
119
|
+
|
|
113
120
|
items[index] = { path: pathWithoutHash, state, id };
|
|
114
121
|
}
|
|
115
122
|
|
|
@@ -185,7 +192,7 @@ export function createMemoryHistory() {
|
|
|
185
192
|
const foundIndex = pending.findIndex((it) => it.ref === done);
|
|
186
193
|
|
|
187
194
|
if (foundIndex > -1) {
|
|
188
|
-
pending[foundIndex]
|
|
195
|
+
pending[foundIndex]?.cb();
|
|
189
196
|
pending.splice(foundIndex, 1);
|
|
190
197
|
}
|
|
191
198
|
|
|
@@ -0,0 +1,218 @@
|
|
|
1
|
+
import {
|
|
2
|
+
CommonActions,
|
|
3
|
+
createNavigatorFactory,
|
|
4
|
+
createScreenFactory,
|
|
5
|
+
type DefaultRouterOptions,
|
|
6
|
+
type EventMapBase,
|
|
7
|
+
type NavigationAction,
|
|
8
|
+
type NavigatorTypeBagBase,
|
|
9
|
+
type ParamListBase,
|
|
10
|
+
type RouterFactory,
|
|
11
|
+
useNavigationBuilder,
|
|
12
|
+
} from '@react-navigation/core';
|
|
13
|
+
import * as React from 'react';
|
|
14
|
+
import type {
|
|
15
|
+
createStandardNavigator,
|
|
16
|
+
NavigatorArgs as StandardNavigationArgs,
|
|
17
|
+
} from 'standard-navigation';
|
|
18
|
+
|
|
19
|
+
import { useBuildHref } from './useLinkBuilder';
|
|
20
|
+
import { useMemoArray } from './useMemoArray';
|
|
21
|
+
|
|
22
|
+
type StandardEventMap<EventMap extends EventMapBase> = {
|
|
23
|
+
[EventName in keyof EventMap]: {
|
|
24
|
+
data: EventMap[EventName] extends { data?: infer Data }
|
|
25
|
+
? Data extends object | undefined
|
|
26
|
+
? Data
|
|
27
|
+
: object | undefined
|
|
28
|
+
: undefined;
|
|
29
|
+
canPreventDefault: EventMap[EventName] extends { canPreventDefault: true }
|
|
30
|
+
? true
|
|
31
|
+
: false;
|
|
32
|
+
};
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
export interface StandardNavigationTypeBagBase extends NavigatorTypeBagBase {
|
|
36
|
+
RouterOptions: DefaultRouterOptions;
|
|
37
|
+
Navigator: React.ComponentType<{}>;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
type StandardNavigationTypeBagFor<
|
|
41
|
+
TypeBag extends StandardNavigationTypeBagBase,
|
|
42
|
+
ParamList extends ParamListBase,
|
|
43
|
+
> = TypeBag & { ParamList: ParamList };
|
|
44
|
+
|
|
45
|
+
type StandardNavigationListFor<
|
|
46
|
+
TypeBag extends StandardNavigationTypeBagBase,
|
|
47
|
+
ParamList extends ParamListBase,
|
|
48
|
+
> = StandardNavigationTypeBagFor<TypeBag, ParamList>['NavigationList'];
|
|
49
|
+
|
|
50
|
+
type StandardNavigationMapperProps<
|
|
51
|
+
TypeBag extends StandardNavigationTypeBagBase,
|
|
52
|
+
> = {
|
|
53
|
+
state: StandardNavigationTypeBagFor<TypeBag, ParamListBase>['State'];
|
|
54
|
+
navigation: StandardNavigationListFor<
|
|
55
|
+
TypeBag,
|
|
56
|
+
ParamListBase
|
|
57
|
+
>[keyof StandardNavigationListFor<TypeBag, ParamListBase>];
|
|
58
|
+
};
|
|
59
|
+
|
|
60
|
+
export function createStandardNavigationFactories<
|
|
61
|
+
TypeBag extends StandardNavigationTypeBagBase,
|
|
62
|
+
NavigatorProps extends object = {},
|
|
63
|
+
>(
|
|
64
|
+
navigator: ReturnType<
|
|
65
|
+
typeof createStandardNavigator<
|
|
66
|
+
TypeBag['ScreenOptions'],
|
|
67
|
+
StandardEventMap<TypeBag['EventMap']>,
|
|
68
|
+
NavigatorProps
|
|
69
|
+
>
|
|
70
|
+
>,
|
|
71
|
+
router: RouterFactory<
|
|
72
|
+
StandardNavigationTypeBagFor<TypeBag, ParamListBase>['State'],
|
|
73
|
+
NavigationAction,
|
|
74
|
+
TypeBag['RouterOptions']
|
|
75
|
+
>,
|
|
76
|
+
mapper?: (
|
|
77
|
+
props: StandardNavigationMapperProps<TypeBag>
|
|
78
|
+
) => Partial<NavigatorProps>
|
|
79
|
+
) {
|
|
80
|
+
const { type, version, NavigatorContent } = navigator;
|
|
81
|
+
|
|
82
|
+
if (type !== 'standard') {
|
|
83
|
+
throw new Error(
|
|
84
|
+
`createStandardNavigationFactories only works with standard navigator objects, but got navigator of ${typeof type === 'string' ? `type "${type}".` : 'unknown type.'}`
|
|
85
|
+
);
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
if (version !== 1) {
|
|
89
|
+
throw new Error(
|
|
90
|
+
`createStandardNavigationFactories only works with version 1 of standard navigator objects, but got version ${version}.`
|
|
91
|
+
);
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
type StandardArgs = StandardNavigationArgs<
|
|
95
|
+
TypeBag['ScreenOptions'],
|
|
96
|
+
StandardEventMap<TypeBag['EventMap']>
|
|
97
|
+
>;
|
|
98
|
+
|
|
99
|
+
function StandardNavigationNavigator(props: any) {
|
|
100
|
+
const builder = useNavigationBuilder<
|
|
101
|
+
TypeBag['State'],
|
|
102
|
+
TypeBag['RouterOptions'],
|
|
103
|
+
TypeBag['ActionHelpers'],
|
|
104
|
+
TypeBag['ScreenOptions'],
|
|
105
|
+
TypeBag['EventMap']
|
|
106
|
+
>(router, props);
|
|
107
|
+
|
|
108
|
+
const buildHref = useBuildHref();
|
|
109
|
+
|
|
110
|
+
const routes = useMemoArray(
|
|
111
|
+
builder.state.routes.map((route) => {
|
|
112
|
+
const href = buildHref(route.name, route.params);
|
|
113
|
+
|
|
114
|
+
return [
|
|
115
|
+
{
|
|
116
|
+
key: route.key,
|
|
117
|
+
name: route.name,
|
|
118
|
+
params: route.params,
|
|
119
|
+
href,
|
|
120
|
+
},
|
|
121
|
+
[route.key, route.name, route.params, href],
|
|
122
|
+
];
|
|
123
|
+
})
|
|
124
|
+
);
|
|
125
|
+
|
|
126
|
+
const state = React.useMemo(
|
|
127
|
+
(): StandardArgs['state'] => ({
|
|
128
|
+
index: builder.state.index,
|
|
129
|
+
routes,
|
|
130
|
+
}),
|
|
131
|
+
[builder.state.index, routes]
|
|
132
|
+
);
|
|
133
|
+
|
|
134
|
+
const descriptors: StandardArgs['descriptors'] = {};
|
|
135
|
+
|
|
136
|
+
for (const route of state.routes) {
|
|
137
|
+
const descriptor = builder.descriptors[route.key];
|
|
138
|
+
|
|
139
|
+
if (descriptor == null) {
|
|
140
|
+
throw new Error(
|
|
141
|
+
`No descriptor found for route "${route.name}" (${route.key}).`
|
|
142
|
+
);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
descriptors[route.key] = {
|
|
146
|
+
options: descriptor.options,
|
|
147
|
+
render: descriptor.render,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
const actions = React.useMemo<StandardArgs['actions']>(
|
|
152
|
+
() => ({
|
|
153
|
+
navigate(name, params) {
|
|
154
|
+
builder.navigation.dispatch({
|
|
155
|
+
...CommonActions.navigate(name, params),
|
|
156
|
+
target: builder.state.key,
|
|
157
|
+
});
|
|
158
|
+
},
|
|
159
|
+
back() {
|
|
160
|
+
builder.navigation.goBack();
|
|
161
|
+
},
|
|
162
|
+
}),
|
|
163
|
+
[builder.navigation, builder.state.key]
|
|
164
|
+
);
|
|
165
|
+
|
|
166
|
+
const emitter = React.useMemo<StandardArgs['emitter']>(
|
|
167
|
+
() => ({
|
|
168
|
+
// @ts-expect-error - they are compatible
|
|
169
|
+
emit: builder.navigation.emit,
|
|
170
|
+
}),
|
|
171
|
+
[builder.navigation]
|
|
172
|
+
);
|
|
173
|
+
|
|
174
|
+
const mapped = mapper?.({
|
|
175
|
+
state: builder.state as TypeBag['State'],
|
|
176
|
+
navigation: builder.navigation as never,
|
|
177
|
+
});
|
|
178
|
+
|
|
179
|
+
// Omit props used by useNavigationBuilder and routers internally
|
|
180
|
+
const {
|
|
181
|
+
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
182
|
+
children,
|
|
183
|
+
initialRouteName,
|
|
184
|
+
layout,
|
|
185
|
+
routeNamesChangeBehavior,
|
|
186
|
+
router: routerOverride,
|
|
187
|
+
screenLayout,
|
|
188
|
+
screenListeners,
|
|
189
|
+
screenOptions,
|
|
190
|
+
/* eslint-enable @typescript-eslint/no-unused-vars */
|
|
191
|
+
...rest
|
|
192
|
+
} = props;
|
|
193
|
+
|
|
194
|
+
return (
|
|
195
|
+
<builder.NavigationContent>
|
|
196
|
+
<NavigatorContent
|
|
197
|
+
{...(rest as NavigatorProps)}
|
|
198
|
+
{...mapped}
|
|
199
|
+
state={state}
|
|
200
|
+
descriptors={descriptors}
|
|
201
|
+
actions={actions}
|
|
202
|
+
emitter={emitter}
|
|
203
|
+
/>
|
|
204
|
+
</builder.NavigationContent>
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
const createNavigator = createNavigatorFactory<TypeBag>(
|
|
209
|
+
StandardNavigationNavigator
|
|
210
|
+
);
|
|
211
|
+
|
|
212
|
+
const createScreen = createScreenFactory<TypeBag>();
|
|
213
|
+
|
|
214
|
+
return {
|
|
215
|
+
createNavigator,
|
|
216
|
+
createScreen,
|
|
217
|
+
};
|
|
218
|
+
}
|
|
@@ -25,7 +25,7 @@ export function extractPathFromURL(prefixes: LinkingPrefix[], url: string) {
|
|
|
25
25
|
);
|
|
26
26
|
}
|
|
27
27
|
|
|
28
|
-
const [originAndPath, ...searchParams] = url.split('?');
|
|
28
|
+
const [originAndPath = '', ...searchParams] = url.split('?');
|
|
29
29
|
|
|
30
30
|
if (prefixRegex.test(originAndPath)) {
|
|
31
31
|
const result = originAndPath
|
package/src/getStateFromHref.tsx
CHANGED
|
@@ -1,11 +1,16 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
getStateFromPath,
|
|
3
|
+
type NavigationState,
|
|
4
|
+
type ParamListBase,
|
|
5
|
+
} from '@react-navigation/core';
|
|
2
6
|
|
|
3
7
|
import { extractPathFromURL } from './extractPathFromURL';
|
|
4
8
|
import type { LinkingOptions } from './types';
|
|
5
9
|
|
|
6
10
|
export function getStateFromHref(
|
|
7
11
|
href: string,
|
|
8
|
-
options: LinkingOptions<ParamListBase> | undefined
|
|
12
|
+
options: LinkingOptions<ParamListBase> | undefined,
|
|
13
|
+
previous: NavigationState | undefined
|
|
9
14
|
): ReturnType<typeof getStateFromPath> {
|
|
10
15
|
const {
|
|
11
16
|
prefixes,
|
|
@@ -40,7 +45,7 @@ export function getStateFromHref(
|
|
|
40
45
|
);
|
|
41
46
|
}
|
|
42
47
|
|
|
43
|
-
const state = getStateFromPathHelper(path, config);
|
|
48
|
+
const state = getStateFromPathHelper(path, config, previous);
|
|
44
49
|
|
|
45
50
|
return state;
|
|
46
51
|
}
|
package/src/index.tsx
CHANGED
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export {
|
|
2
|
+
createStandardNavigationFactories,
|
|
3
|
+
type StandardNavigationTypeBagBase,
|
|
4
|
+
} from './createStandardNavigationFactories';
|
|
1
5
|
export { createStaticNavigation } from './createStaticNavigation';
|
|
2
6
|
export { Link } from './Link';
|
|
3
7
|
export { LinkingContext } from './LinkingContext';
|
|
@@ -2,24 +2,68 @@ import type { ViewProps } from 'react-native';
|
|
|
2
2
|
|
|
3
3
|
import { FONT_WEIGHTS } from './constants';
|
|
4
4
|
import SFSymbolViewNativeComponent from './SFSymbolViewNativeComponent';
|
|
5
|
-
import type {
|
|
5
|
+
import type {
|
|
6
|
+
SFSymbolBreatheVariant,
|
|
7
|
+
SFSymbolContentTransitionEffect,
|
|
8
|
+
SFSymbolContentTransitionScope,
|
|
9
|
+
SFSymbolDrawDirection,
|
|
10
|
+
SFSymbolEffectDirection,
|
|
11
|
+
SFSymbolEffectName,
|
|
12
|
+
SFSymbolEffectRepeat,
|
|
13
|
+
SFSymbolEffectScope,
|
|
14
|
+
SFSymbolInactiveLayers,
|
|
15
|
+
SFSymbolOptions,
|
|
16
|
+
SFSymbolReplaceTransitionVariant,
|
|
17
|
+
} from './types';
|
|
6
18
|
|
|
7
19
|
export type SFSymbolProps = SFSymbolOptions & ViewProps;
|
|
8
20
|
|
|
21
|
+
type NativeEffectConfig = {
|
|
22
|
+
type: SFSymbolEffectName;
|
|
23
|
+
speed?: number | undefined;
|
|
24
|
+
repeat?: SFSymbolEffectRepeat | undefined;
|
|
25
|
+
scope?: SFSymbolEffectScope | undefined;
|
|
26
|
+
direction?: SFSymbolEffectDirection | undefined;
|
|
27
|
+
variant?: SFSymbolBreatheVariant | undefined;
|
|
28
|
+
angle?: number | undefined;
|
|
29
|
+
reversing?: boolean | undefined;
|
|
30
|
+
cumulative?: boolean | undefined;
|
|
31
|
+
inactiveLayers?: SFSymbolInactiveLayers | undefined;
|
|
32
|
+
drawDirection?: SFSymbolDrawDirection | undefined;
|
|
33
|
+
};
|
|
34
|
+
|
|
35
|
+
type NativeContentTransitionConfig = {
|
|
36
|
+
type: SFSymbolContentTransitionEffect;
|
|
37
|
+
speed?: number | undefined;
|
|
38
|
+
variant?: SFSymbolReplaceTransitionVariant | undefined;
|
|
39
|
+
scope?: SFSymbolContentTransitionScope | undefined;
|
|
40
|
+
magic?: boolean | undefined;
|
|
41
|
+
};
|
|
42
|
+
|
|
9
43
|
export function SFSymbol({
|
|
10
44
|
name,
|
|
11
45
|
size = 24,
|
|
12
46
|
color,
|
|
13
47
|
weight,
|
|
14
48
|
scale = 'medium',
|
|
15
|
-
|
|
49
|
+
variableValue,
|
|
50
|
+
variableValueMode = 'automatic',
|
|
51
|
+
colorRenderingMode = 'automatic',
|
|
52
|
+
renderingMode = 'monochrome',
|
|
16
53
|
colors,
|
|
17
|
-
|
|
54
|
+
effect,
|
|
55
|
+
contentTransition,
|
|
18
56
|
style,
|
|
19
57
|
...rest
|
|
20
58
|
}: SFSymbolProps): React.ReactElement {
|
|
21
|
-
const
|
|
22
|
-
typeof
|
|
59
|
+
const effectConfig: NativeEffectConfig | undefined =
|
|
60
|
+
typeof effect === 'string' ? { type: effect } : effect;
|
|
61
|
+
const contentTransitionConfig: NativeContentTransitionConfig | undefined =
|
|
62
|
+
typeof contentTransition === 'string'
|
|
63
|
+
? { type: contentTransition }
|
|
64
|
+
: contentTransition;
|
|
65
|
+
|
|
66
|
+
const repeat = effectConfig?.repeat;
|
|
23
67
|
|
|
24
68
|
return (
|
|
25
69
|
<SFSymbolViewNativeComponent
|
|
@@ -28,18 +72,33 @@ export function SFSymbol({
|
|
|
28
72
|
color={color}
|
|
29
73
|
weight={typeof weight === 'string' ? FONT_WEIGHTS[weight] : (weight ?? 0)}
|
|
30
74
|
scale={scale}
|
|
31
|
-
|
|
75
|
+
variableValue={variableValue ?? -1}
|
|
76
|
+
variableValueMode={variableValueMode}
|
|
77
|
+
colorRenderingMode={colorRenderingMode}
|
|
78
|
+
renderingMode={renderingMode}
|
|
32
79
|
colorPrimary={colors?.primary ?? color}
|
|
33
80
|
colorSecondary={colors?.secondary}
|
|
34
81
|
colorTertiary={colors?.tertiary}
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
82
|
+
effect={effectConfig?.type ?? ''}
|
|
83
|
+
effectRepeat={
|
|
84
|
+
typeof repeat === 'string' ? repeat : repeat ? 'periodic' : ''
|
|
85
|
+
}
|
|
86
|
+
effectRepeatCount={typeof repeat === 'object' ? (repeat.count ?? 0) : 0}
|
|
87
|
+
effectRepeatDelay={typeof repeat === 'object' ? (repeat.delay ?? 0) : 0}
|
|
88
|
+
effectSpeed={effectConfig?.speed ?? 1}
|
|
89
|
+
effectScope={effectConfig?.scope ?? ''}
|
|
90
|
+
effectDirection={effectConfig?.direction ?? ''}
|
|
91
|
+
effectVariant={effectConfig?.variant ?? ''}
|
|
92
|
+
effectAngle={effectConfig?.angle ?? -1}
|
|
93
|
+
effectReversing={effectConfig?.reversing ?? false}
|
|
94
|
+
effectCumulative={effectConfig?.cumulative ?? false}
|
|
95
|
+
effectInactiveLayers={effectConfig?.inactiveLayers ?? ''}
|
|
96
|
+
effectDrawDirection={effectConfig?.drawDirection ?? ''}
|
|
97
|
+
contentTransition={contentTransitionConfig?.type ?? ''}
|
|
98
|
+
contentTransitionSpeed={contentTransitionConfig?.speed ?? 1}
|
|
99
|
+
contentTransitionVariant={contentTransitionConfig?.variant ?? ''}
|
|
100
|
+
contentTransitionScope={contentTransitionConfig?.scope ?? ''}
|
|
101
|
+
contentTransitionMagic={contentTransitionConfig?.magic ?? false}
|
|
43
102
|
style={[
|
|
44
103
|
{
|
|
45
104
|
width: size,
|
|
@@ -13,18 +13,31 @@ export interface NativeProps extends ViewProps {
|
|
|
13
13
|
color?: ColorValue;
|
|
14
14
|
weight: CodegenTypes.Int32;
|
|
15
15
|
scale: string;
|
|
16
|
-
|
|
16
|
+
variableValue: CodegenTypes.Float;
|
|
17
|
+
variableValueMode: string;
|
|
18
|
+
colorRenderingMode: string;
|
|
19
|
+
renderingMode: string;
|
|
17
20
|
colorPrimary?: ColorValue;
|
|
18
21
|
colorSecondary?: ColorValue;
|
|
19
22
|
colorTertiary?: ColorValue;
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
23
|
+
effect: string;
|
|
24
|
+
effectRepeat: string;
|
|
25
|
+
effectRepeatCount: CodegenTypes.Int32;
|
|
26
|
+
effectRepeatDelay: CodegenTypes.Float;
|
|
27
|
+
effectSpeed: CodegenTypes.Float;
|
|
28
|
+
effectScope: string;
|
|
29
|
+
effectDirection: string;
|
|
30
|
+
effectVariant: string;
|
|
31
|
+
effectAngle: CodegenTypes.Float;
|
|
32
|
+
effectReversing: boolean;
|
|
33
|
+
effectCumulative: boolean;
|
|
34
|
+
effectInactiveLayers: string;
|
|
35
|
+
effectDrawDirection: string;
|
|
36
|
+
contentTransition: string;
|
|
37
|
+
contentTransitionSpeed: CodegenTypes.Float;
|
|
38
|
+
contentTransitionVariant: string;
|
|
39
|
+
contentTransitionScope: string;
|
|
40
|
+
contentTransitionMagic: boolean;
|
|
28
41
|
}
|
|
29
42
|
|
|
30
43
|
export default codegenNativeComponent<NativeProps>(
|