@react-navigation/elements 3.0.0-alpha.2 → 3.0.0-alpha.21
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/lib/module/ActivityView.js +90 -0
- package/lib/module/ActivityView.js.map +1 -0
- package/lib/module/ActivityView.native.js +67 -0
- package/lib/module/ActivityView.native.js.map +1 -0
- package/lib/module/Badge.js +5 -4
- package/lib/module/Badge.js.map +1 -1
- package/lib/module/Button.js +7 -2
- package/lib/module/Button.js.map +1 -1
- package/lib/module/Color.js +95 -0
- package/lib/module/Color.js.map +1 -1
- package/lib/module/Container.js +11 -1
- package/lib/module/Container.js.map +1 -1
- package/lib/module/Header/Header.js +26 -11
- package/lib/module/Header/Header.js.map +1 -1
- package/lib/module/Header/HeaderBackButton.js +27 -13
- package/lib/module/Header/HeaderBackButton.js.map +1 -1
- package/lib/module/Header/HeaderButton.js +4 -5
- package/lib/module/Header/HeaderButton.js.map +1 -1
- package/lib/module/Header/HeaderIcon.js +29 -10
- package/lib/module/Header/HeaderIcon.js.map +1 -1
- package/lib/module/Header/HeaderSearchBar.js +31 -24
- package/lib/module/Header/HeaderSearchBar.js.map +1 -1
- package/lib/module/Header/getHeaderTitle.js.map +1 -1
- package/lib/module/Header/useHeaderHeight.js +1 -1
- package/lib/module/Header/useHeaderHeight.js.map +1 -1
- package/lib/module/Label/getLabel.js.map +1 -1
- package/lib/module/PlatformColor.js +1 -0
- package/lib/module/PlatformColor.js.map +1 -1
- package/lib/module/PlatformColor.native.js +1 -1
- package/lib/module/PlatformColor.native.js.map +1 -1
- package/lib/module/PlatformPressable.js +3 -4
- package/lib/module/PlatformPressable.js.map +1 -1
- package/lib/module/SafeAreaProviderCompat.js +1 -1
- package/lib/module/SafeAreaProviderCompat.js.map +1 -1
- package/lib/module/Screen.js +13 -9
- package/lib/module/Screen.js.map +1 -1
- package/lib/module/index.js +1 -7
- package/lib/module/index.js.map +1 -1
- package/lib/module/internal.js +1 -1
- package/lib/module/internal.js.map +1 -1
- package/lib/module/useFrameSize.js +1 -1
- package/lib/module/useFrameSize.js.map +1 -1
- package/lib/typescript/src/ActivityView.d.ts +31 -0
- package/lib/typescript/src/ActivityView.d.ts.map +1 -0
- package/lib/typescript/src/ActivityView.native.d.ts +3 -0
- package/lib/typescript/src/ActivityView.native.d.ts.map +1 -0
- package/lib/typescript/src/Badge.d.ts +3 -3
- package/lib/typescript/src/Badge.d.ts.map +1 -1
- package/lib/typescript/src/Button.d.ts +3 -3
- package/lib/typescript/src/Button.d.ts.map +1 -1
- package/lib/typescript/src/Color.d.ts +4 -3
- package/lib/typescript/src/Color.d.ts.map +1 -1
- package/lib/typescript/src/Container.d.ts +7 -4
- package/lib/typescript/src/Container.d.ts.map +1 -1
- package/lib/typescript/src/Header/Header.d.ts +2 -2
- package/lib/typescript/src/Header/Header.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderBackButton.d.ts +1 -1
- package/lib/typescript/src/Header/HeaderBackButton.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderBackground.d.ts +3 -3
- package/lib/typescript/src/Header/HeaderBackground.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderButton.d.ts +6 -1
- package/lib/typescript/src/Header/HeaderButton.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderIcon.d.ts +8 -4
- package/lib/typescript/src/Header/HeaderIcon.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderSearchBar.d.ts +9 -6
- package/lib/typescript/src/Header/HeaderSearchBar.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderTitle.d.ts +3 -3
- package/lib/typescript/src/Header/HeaderTitle.d.ts.map +1 -1
- package/lib/typescript/src/Header/getHeaderTitle.d.ts +1 -1
- package/lib/typescript/src/Header/getHeaderTitle.d.ts.map +1 -1
- package/lib/typescript/src/Label/getLabel.d.ts +2 -2
- package/lib/typescript/src/Label/getLabel.d.ts.map +1 -1
- package/lib/typescript/src/PlatformColor.d.ts +1 -0
- package/lib/typescript/src/PlatformColor.d.ts.map +1 -1
- package/lib/typescript/src/PlatformColor.native.d.ts +1 -1
- package/lib/typescript/src/PlatformColor.native.d.ts.map +1 -1
- package/lib/typescript/src/PlatformPressable.d.ts +12 -15
- package/lib/typescript/src/PlatformPressable.d.ts.map +1 -1
- package/lib/typescript/src/Screen.d.ts +6 -6
- package/lib/typescript/src/Screen.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +1 -2
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/internal.d.ts +1 -1
- package/lib/typescript/src/internal.d.ts.map +1 -1
- package/lib/typescript/src/types.d.ts +119 -69
- package/lib/typescript/src/types.d.ts.map +1 -1
- package/package.json +21 -20
- package/src/ActivityView.native.tsx +90 -0
- package/src/ActivityView.tsx +129 -0
- package/src/Badge.tsx +9 -7
- package/src/Button.tsx +15 -7
- package/src/Color.tsx +133 -3
- package/src/Container.tsx +20 -4
- package/src/Header/Header.tsx +43 -20
- package/src/Header/HeaderBackButton.tsx +31 -17
- package/src/Header/HeaderBackground.tsx +3 -3
- package/src/Header/HeaderButton.tsx +16 -18
- package/src/Header/HeaderIcon.tsx +49 -9
- package/src/Header/HeaderSearchBar.tsx +50 -44
- package/src/Header/HeaderTitle.tsx +3 -3
- package/src/Header/getHeaderTitle.tsx +4 -1
- package/src/Header/useHeaderHeight.tsx +1 -1
- package/src/Label/getLabel.tsx +1 -1
- package/src/PlatformColor.native.tsx +1 -1
- package/src/PlatformColor.tsx +4 -0
- package/src/PlatformPressable.tsx +27 -28
- package/src/SafeAreaProviderCompat.tsx +1 -1
- package/src/Screen.tsx +19 -19
- package/src/index.tsx +1 -16
- package/src/internal.tsx +1 -1
- package/src/types.tsx +153 -76
- package/src/useFrameSize.tsx +1 -1
- package/lib/module/Lazy.js +0 -42
- package/lib/module/Lazy.js.map +0 -1
- package/lib/module/assets/back-icon.ios.svg +0 -4
- package/lib/module/assets/back-icon@1x.android.png +0 -0
- package/lib/module/assets/back-icon@1x.ios.png +0 -0
- package/lib/module/assets/back-icon@2x.android.png +0 -0
- package/lib/module/assets/back-icon@2x.ios.png +0 -0
- package/lib/module/assets/back-icon@3x.android.png +0 -0
- package/lib/module/assets/back-icon@3x.ios.png +0 -0
- package/lib/module/assets/back-icon@4x.android.png +0 -0
- package/lib/module/assets/back-icon@4x.ios.png +0 -0
- package/lib/module/assets/clear-icon@1x.png +0 -0
- package/lib/module/assets/clear-icon@2x.png +0 -0
- package/lib/module/assets/clear-icon@3x.png +0 -0
- package/lib/module/assets/clear-icon@4x.png +0 -0
- package/lib/module/assets/close-icon@1x.png +0 -0
- package/lib/module/assets/close-icon@2x.png +0 -0
- package/lib/module/assets/close-icon@3x.png +0 -0
- package/lib/module/assets/close-icon@4x.png +0 -0
- package/lib/module/assets/search-icon-legacy@1x.ios.png +0 -0
- package/lib/module/assets/search-icon-legacy@2x.ios.png +0 -0
- package/lib/module/assets/search-icon-legacy@3x.ios.png +0 -0
- package/lib/module/assets/search-icon-legacy@4x.ios.png +0 -0
- package/lib/module/assets/search-icon.ios.svg +0 -4
- package/lib/module/assets/search-icon@1x.android.png +0 -0
- package/lib/module/assets/search-icon@1x.ios.png +0 -0
- package/lib/module/assets/search-icon@2x.android.png +0 -0
- package/lib/module/assets/search-icon@2x.ios.png +0 -0
- package/lib/module/assets/search-icon@3x.android.png +0 -0
- package/lib/module/assets/search-icon@3x.ios.png +0 -0
- package/lib/module/assets/search-icon@4x.android.png +0 -0
- package/lib/module/assets/search-icon@4x.ios.png +0 -0
- package/lib/typescript/src/Lazy.d.ts +0 -31
- package/lib/typescript/src/Lazy.d.ts.map +0 -1
- package/src/Lazy.tsx +0 -59
- package/src/assets/back-icon.ios.svg +0 -4
- package/src/assets/back-icon@1x.android.png +0 -0
- package/src/assets/back-icon@1x.ios.png +0 -0
- package/src/assets/back-icon@2x.android.png +0 -0
- package/src/assets/back-icon@2x.ios.png +0 -0
- package/src/assets/back-icon@3x.android.png +0 -0
- package/src/assets/back-icon@3x.ios.png +0 -0
- package/src/assets/back-icon@4x.android.png +0 -0
- package/src/assets/back-icon@4x.ios.png +0 -0
- package/src/assets/clear-icon@1x.png +0 -0
- package/src/assets/clear-icon@2x.png +0 -0
- package/src/assets/clear-icon@3x.png +0 -0
- package/src/assets/clear-icon@4x.png +0 -0
- package/src/assets/close-icon@1x.png +0 -0
- package/src/assets/close-icon@2x.png +0 -0
- package/src/assets/close-icon@3x.png +0 -0
- package/src/assets/close-icon@4x.png +0 -0
- package/src/assets/search-icon-legacy@1x.ios.png +0 -0
- package/src/assets/search-icon-legacy@2x.ios.png +0 -0
- package/src/assets/search-icon-legacy@3x.ios.png +0 -0
- package/src/assets/search-icon-legacy@4x.ios.png +0 -0
- package/src/assets/search-icon.ios.svg +0 -4
- package/src/assets/search-icon@1x.android.png +0 -0
- package/src/assets/search-icon@1x.ios.png +0 -0
- package/src/assets/search-icon@2x.android.png +0 -0
- package/src/assets/search-icon@2x.ios.png +0 -0
- package/src/assets/search-icon@3x.android.png +0 -0
- package/src/assets/search-icon@3x.ios.png +0 -0
- package/src/assets/search-icon@4x.android.png +0 -0
- package/src/assets/search-icon@4x.ios.png +0 -0
|
@@ -1,24 +1,64 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import { MaterialSymbol, SFSymbol, useLocale } from '@react-navigation/native';
|
|
2
|
+
import {
|
|
3
|
+
type ColorValue,
|
|
4
|
+
Image,
|
|
5
|
+
type ImageProps,
|
|
6
|
+
Platform,
|
|
7
|
+
StyleSheet,
|
|
8
|
+
} from 'react-native';
|
|
3
9
|
|
|
4
|
-
|
|
5
|
-
|
|
10
|
+
import type { Icon } from '../types';
|
|
11
|
+
|
|
12
|
+
type Props = Omit<ImageProps, 'source'> & {
|
|
13
|
+
icon: Icon;
|
|
14
|
+
color: ColorValue;
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export function HeaderIcon({ icon, color, style, ...rest }: Props) {
|
|
6
18
|
const { direction } = useLocale();
|
|
7
19
|
|
|
20
|
+
const iconStyle = [styles.icon, direction === 'rtl' && styles.flip, style];
|
|
21
|
+
|
|
22
|
+
if (icon.type === 'sfSymbol') {
|
|
23
|
+
return (
|
|
24
|
+
<SFSymbol
|
|
25
|
+
name={icon.name}
|
|
26
|
+
color={color}
|
|
27
|
+
size={ICON_SIZE}
|
|
28
|
+
style={iconStyle}
|
|
29
|
+
{...rest}
|
|
30
|
+
/>
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
if (icon.type === 'materialSymbol') {
|
|
35
|
+
return (
|
|
36
|
+
<MaterialSymbol
|
|
37
|
+
name={icon.name}
|
|
38
|
+
variant={icon.variant}
|
|
39
|
+
weight={icon.weight}
|
|
40
|
+
color={color}
|
|
41
|
+
size={ICON_SIZE}
|
|
42
|
+
style={iconStyle}
|
|
43
|
+
{...rest}
|
|
44
|
+
/>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
|
|
8
48
|
return (
|
|
9
49
|
<Image
|
|
10
|
-
source={source}
|
|
50
|
+
source={icon.source}
|
|
11
51
|
resizeMode="contain"
|
|
12
52
|
fadeDuration={0}
|
|
13
|
-
tintColor={
|
|
14
|
-
style={
|
|
53
|
+
tintColor={color}
|
|
54
|
+
style={iconStyle}
|
|
15
55
|
{...rest}
|
|
16
56
|
/>
|
|
17
57
|
);
|
|
18
58
|
}
|
|
19
59
|
|
|
20
|
-
|
|
21
|
-
|
|
60
|
+
const ICON_SIZE = Platform.OS === 'ios' ? 21 : 24;
|
|
61
|
+
const ICON_MARGIN = Platform.OS === 'ios' ? 8 : 3;
|
|
22
62
|
|
|
23
63
|
const styles = StyleSheet.create({
|
|
24
64
|
icon: {
|
|
@@ -1,10 +1,9 @@
|
|
|
1
|
-
import { useNavigation, useTheme } from '@react-navigation/native';
|
|
1
|
+
import { SFSymbol, useNavigation, useTheme } from '@react-navigation/native';
|
|
2
2
|
import * as React from 'react';
|
|
3
3
|
import {
|
|
4
4
|
Animated,
|
|
5
5
|
BackHandler,
|
|
6
6
|
type ColorValue,
|
|
7
|
-
Image,
|
|
8
7
|
type NativeEventSubscription,
|
|
9
8
|
Platform,
|
|
10
9
|
type StyleProp,
|
|
@@ -14,10 +13,7 @@ import {
|
|
|
14
13
|
type ViewStyle,
|
|
15
14
|
} from 'react-native';
|
|
16
15
|
|
|
17
|
-
import clearIcon from '../assets/clear-icon.png';
|
|
18
16
|
import closeIcon from '../assets/close-icon.png';
|
|
19
|
-
import searchIcon from '../assets/search-icon.png';
|
|
20
|
-
import searchIconLegacy from '../assets/search-icon-legacy.png';
|
|
21
17
|
import { Color } from '../Color';
|
|
22
18
|
import {
|
|
23
19
|
AnimatedLiquidGlassContainerView,
|
|
@@ -34,11 +30,12 @@ import { HeaderIcon } from './HeaderIcon';
|
|
|
34
30
|
type Props = Omit<HeaderSearchBarOptions, 'ref'> & {
|
|
35
31
|
visible: boolean;
|
|
36
32
|
onClose: () => void;
|
|
37
|
-
tintColor?: ColorValue;
|
|
38
|
-
pressColor?: ColorValue;
|
|
39
|
-
pressOpacity?: number;
|
|
33
|
+
tintColor?: ColorValue | undefined;
|
|
34
|
+
pressColor?: ColorValue | undefined;
|
|
35
|
+
pressOpacity?: number | undefined;
|
|
40
36
|
statusBarHeight: number;
|
|
41
|
-
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle
|
|
37
|
+
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>> | undefined;
|
|
38
|
+
ref?: React.Ref<HeaderSearchBarRef>;
|
|
42
39
|
};
|
|
43
40
|
|
|
44
41
|
const INPUT_TYPE_TO_MODE = {
|
|
@@ -50,26 +47,24 @@ const INPUT_TYPE_TO_MODE = {
|
|
|
50
47
|
|
|
51
48
|
const useNativeDriver = Platform.OS !== 'web';
|
|
52
49
|
|
|
53
|
-
function
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
ref: React.ForwardedRef<HeaderSearchBarRef>
|
|
72
|
-
) {
|
|
50
|
+
export function HeaderSearchBar({
|
|
51
|
+
visible,
|
|
52
|
+
inputType,
|
|
53
|
+
autoFocus = true,
|
|
54
|
+
autoCapitalize,
|
|
55
|
+
placeholder = 'Search',
|
|
56
|
+
enterKeyHint = 'search',
|
|
57
|
+
cancelButtonText = 'Cancel',
|
|
58
|
+
onChange,
|
|
59
|
+
onClose,
|
|
60
|
+
tintColor,
|
|
61
|
+
pressColor,
|
|
62
|
+
pressOpacity,
|
|
63
|
+
statusBarHeight,
|
|
64
|
+
style,
|
|
65
|
+
ref,
|
|
66
|
+
...rest
|
|
67
|
+
}: Props) {
|
|
73
68
|
const navigation = useNavigation();
|
|
74
69
|
const { dark, colors, fonts } = useTheme();
|
|
75
70
|
const [value, setValue] = React.useState('');
|
|
@@ -210,9 +205,10 @@ function HeaderSearchBarInternal(
|
|
|
210
205
|
) : null}
|
|
211
206
|
<HeaderButtonBackground style={styles.searchbarContainer}>
|
|
212
207
|
{Platform.OS === 'ios' ? (
|
|
213
|
-
<
|
|
214
|
-
|
|
215
|
-
|
|
208
|
+
<SFSymbol
|
|
209
|
+
name="magnifyingglass"
|
|
210
|
+
size={SEARCH_ICON_SIZE}
|
|
211
|
+
color={textColor}
|
|
216
212
|
style={[
|
|
217
213
|
styles.inputSearchIconIos,
|
|
218
214
|
!isLiquidGlassSupported && styles.inputSearchIconIosLegacy,
|
|
@@ -263,10 +259,10 @@ function HeaderSearchBarInternal(
|
|
|
263
259
|
!isLiquidGlassSupported && styles.clearButtonIosLegacy,
|
|
264
260
|
]}
|
|
265
261
|
>
|
|
266
|
-
<
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
262
|
+
<SFSymbol
|
|
263
|
+
name="xmark.circle.fill"
|
|
264
|
+
size={CLEAR_ICON_SIZE}
|
|
265
|
+
color={textColor}
|
|
270
266
|
style={styles.clearIconIos}
|
|
271
267
|
/>
|
|
272
268
|
</PlatformPressable>
|
|
@@ -278,7 +274,19 @@ function HeaderSearchBarInternal(
|
|
|
278
274
|
onPress={onClear}
|
|
279
275
|
style={[styles.closeButton, { opacity: clearVisibleAnim }]}
|
|
280
276
|
>
|
|
281
|
-
<HeaderIcon
|
|
277
|
+
<HeaderIcon
|
|
278
|
+
icon={Platform.select({
|
|
279
|
+
android: {
|
|
280
|
+
type: 'materialSymbol',
|
|
281
|
+
name: 'close',
|
|
282
|
+
},
|
|
283
|
+
default: {
|
|
284
|
+
type: 'image',
|
|
285
|
+
source: closeIcon,
|
|
286
|
+
},
|
|
287
|
+
})}
|
|
288
|
+
color={textColor}
|
|
289
|
+
/>
|
|
282
290
|
</HeaderButton>
|
|
283
291
|
) : null}
|
|
284
292
|
{Platform.OS === 'ios' ? (
|
|
@@ -288,7 +296,7 @@ function HeaderSearchBarInternal(
|
|
|
288
296
|
accessibilityLabel={cancelButtonText}
|
|
289
297
|
onPress={cancelSearch}
|
|
290
298
|
>
|
|
291
|
-
<
|
|
299
|
+
<SFSymbol name="xmark" color={textColor} />
|
|
292
300
|
</HeaderButton>
|
|
293
301
|
</HeaderButtonBackground>
|
|
294
302
|
) : (
|
|
@@ -332,14 +340,14 @@ const styles = StyleSheet.create({
|
|
|
332
340
|
},
|
|
333
341
|
inputSearchIconIos: {
|
|
334
342
|
position: 'absolute',
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
343
|
+
top: '50%',
|
|
344
|
+
left: BUTTON_SPACING + SEARCHBAR_ICON_SPACING / 2,
|
|
345
|
+
marginTop: -SEARCH_ICON_SIZE / 2,
|
|
338
346
|
height: SEARCH_ICON_SIZE,
|
|
339
347
|
width: SEARCH_ICON_SIZE,
|
|
340
348
|
},
|
|
341
349
|
inputSearchIconIosLegacy: {
|
|
342
|
-
top:
|
|
350
|
+
top: SEARCHBAR_ICON_SPACING,
|
|
343
351
|
},
|
|
344
352
|
backButton: {
|
|
345
353
|
alignSelf: 'center',
|
|
@@ -417,5 +425,3 @@ const styles = StyleSheet.create({
|
|
|
417
425
|
}),
|
|
418
426
|
},
|
|
419
427
|
});
|
|
420
|
-
|
|
421
|
-
export const HeaderSearchBar = React.forwardRef(HeaderSearchBarInternal);
|
|
@@ -10,9 +10,9 @@ import {
|
|
|
10
10
|
} from 'react-native';
|
|
11
11
|
|
|
12
12
|
type Props = Omit<TextProps, 'style'> & {
|
|
13
|
-
tintColor?: ColorValue;
|
|
14
|
-
children?: string;
|
|
15
|
-
style?: Animated.WithAnimatedValue<StyleProp<TextStyle
|
|
13
|
+
tintColor?: ColorValue | undefined;
|
|
14
|
+
children?: string | undefined;
|
|
15
|
+
style?: Animated.WithAnimatedValue<StyleProp<TextStyle>> | undefined;
|
|
16
16
|
};
|
|
17
17
|
|
|
18
18
|
export function HeaderTitle({ tintColor, style, ...rest }: Props) {
|
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
import type { HeaderOptions } from '../types';
|
|
2
2
|
|
|
3
3
|
export function getHeaderTitle(
|
|
4
|
-
options: {
|
|
4
|
+
options: {
|
|
5
|
+
title?: string | undefined;
|
|
6
|
+
headerTitle?: HeaderOptions['headerTitle'];
|
|
7
|
+
},
|
|
5
8
|
fallback: string
|
|
6
9
|
): string {
|
|
7
10
|
return typeof options.headerTitle === 'string'
|
|
@@ -3,7 +3,7 @@ import * as React from 'react';
|
|
|
3
3
|
import { HeaderHeightContext } from './HeaderHeightContext';
|
|
4
4
|
|
|
5
5
|
export function useHeaderHeight() {
|
|
6
|
-
const height = React.
|
|
6
|
+
const height = React.use(HeaderHeightContext);
|
|
7
7
|
|
|
8
8
|
if (height === undefined) {
|
|
9
9
|
throw new Error(
|
package/src/Label/getLabel.tsx
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export { PlatformColor } from 'react-native';
|
|
1
|
+
export { DynamicColorIOS, PlatformColor } from 'react-native';
|
package/src/PlatformColor.tsx
CHANGED
|
@@ -19,15 +19,20 @@ type HoverEffectProps = {
|
|
|
19
19
|
};
|
|
20
20
|
|
|
21
21
|
export type Props = Omit<PressableProps, 'style' | 'onPress'> & {
|
|
22
|
-
href?: string;
|
|
23
|
-
pressColor?: ColorValue;
|
|
24
|
-
pressOpacity?: number;
|
|
25
|
-
hoverEffect?: HoverEffectProps;
|
|
26
|
-
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle
|
|
27
|
-
onPress?:
|
|
28
|
-
|
|
29
|
-
|
|
22
|
+
href?: string | undefined;
|
|
23
|
+
pressColor?: ColorValue | undefined;
|
|
24
|
+
pressOpacity?: number | undefined;
|
|
25
|
+
hoverEffect?: HoverEffectProps | undefined;
|
|
26
|
+
style?: Animated.WithAnimatedValue<StyleProp<ViewStyle>> | undefined;
|
|
27
|
+
onPress?:
|
|
28
|
+
| ((
|
|
29
|
+
e:
|
|
30
|
+
| React.MouseEvent<HTMLAnchorElement, MouseEvent>
|
|
31
|
+
| GestureResponderEvent
|
|
32
|
+
) => void)
|
|
33
|
+
| undefined;
|
|
30
34
|
children: React.ReactNode;
|
|
35
|
+
ref?: React.Ref<React.ComponentRef<typeof AnimatedPressable>>;
|
|
31
36
|
};
|
|
32
37
|
|
|
33
38
|
const AnimatedPressable = Animated.createAnimatedComponent(Pressable);
|
|
@@ -41,22 +46,20 @@ const useNativeDriver = Platform.OS !== 'web';
|
|
|
41
46
|
/**
|
|
42
47
|
* PlatformPressable provides an abstraction on top of Pressable to handle platform differences.
|
|
43
48
|
*/
|
|
44
|
-
function
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
ref: React.Ref<React.ComponentRef<typeof AnimatedPressable>>
|
|
59
|
-
) {
|
|
49
|
+
export function PlatformPressable({
|
|
50
|
+
disabled,
|
|
51
|
+
onPress,
|
|
52
|
+
onPressIn,
|
|
53
|
+
onPressOut,
|
|
54
|
+
android_ripple,
|
|
55
|
+
pressColor,
|
|
56
|
+
pressOpacity = 0.3,
|
|
57
|
+
hoverEffect,
|
|
58
|
+
style,
|
|
59
|
+
children,
|
|
60
|
+
ref,
|
|
61
|
+
...rest
|
|
62
|
+
}: Props) {
|
|
60
63
|
const { dark } = useTheme();
|
|
61
64
|
const [opacity] = React.useState(() => new Animated.Value(1));
|
|
62
65
|
|
|
@@ -156,10 +159,6 @@ function PlatformPressableInternal(
|
|
|
156
159
|
);
|
|
157
160
|
}
|
|
158
161
|
|
|
159
|
-
export const PlatformPressable = React.forwardRef(PlatformPressableInternal);
|
|
160
|
-
|
|
161
|
-
PlatformPressable.displayName = 'PlatformPressable';
|
|
162
|
-
|
|
163
162
|
const css = String.raw;
|
|
164
163
|
|
|
165
164
|
const CLASS_NAME = `__react-navigation_elements_Pressable_hover`;
|
|
@@ -34,7 +34,7 @@ const initialMetrics =
|
|
|
34
34
|
: initialWindowMetrics;
|
|
35
35
|
|
|
36
36
|
export function SafeAreaProviderCompat({ children, style }: Props) {
|
|
37
|
-
const insets = React.
|
|
37
|
+
const insets = React.use(SafeAreaInsetsContext);
|
|
38
38
|
|
|
39
39
|
return (
|
|
40
40
|
<FrameSizeProvider
|
package/src/Screen.tsx
CHANGED
|
@@ -6,15 +6,10 @@ import {
|
|
|
6
6
|
useTheme,
|
|
7
7
|
} from '@react-navigation/native';
|
|
8
8
|
import * as React from 'react';
|
|
9
|
-
import {
|
|
10
|
-
Animated,
|
|
11
|
-
type StyleProp,
|
|
12
|
-
StyleSheet,
|
|
13
|
-
View,
|
|
14
|
-
type ViewStyle,
|
|
15
|
-
} from 'react-native';
|
|
9
|
+
import { StyleSheet, View } from 'react-native';
|
|
16
10
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
17
11
|
|
|
12
|
+
import { Container } from './Container';
|
|
18
13
|
import { getDefaultHeaderHeight } from './Header/getDefaultHeaderHeight';
|
|
19
14
|
import { HeaderHeightContext } from './Header/HeaderHeightContext';
|
|
20
15
|
import { HeaderShownContext } from './Header/HeaderShownContext';
|
|
@@ -22,14 +17,14 @@ import { useFrameSize } from './useFrameSize';
|
|
|
22
17
|
|
|
23
18
|
type Props = {
|
|
24
19
|
focused: boolean;
|
|
25
|
-
modal?: boolean;
|
|
20
|
+
modal?: boolean | undefined;
|
|
26
21
|
navigation: NavigationProp<ParamListBase>;
|
|
27
22
|
route: RouteProp<ParamListBase>;
|
|
28
23
|
header: React.ReactNode;
|
|
29
|
-
headerShown?: boolean;
|
|
30
|
-
headerStatusBarHeight?: number;
|
|
31
|
-
headerTransparent?: boolean;
|
|
32
|
-
style?:
|
|
24
|
+
headerShown?: boolean | undefined;
|
|
25
|
+
headerStatusBarHeight?: number | undefined;
|
|
26
|
+
headerTransparent?: boolean | undefined;
|
|
27
|
+
style?: React.ComponentProps<typeof Container>['style'] | undefined;
|
|
33
28
|
children: React.ReactNode;
|
|
34
29
|
};
|
|
35
30
|
|
|
@@ -37,8 +32,8 @@ export function Screen(props: Props) {
|
|
|
37
32
|
const insets = useSafeAreaInsets();
|
|
38
33
|
const { colors } = useTheme();
|
|
39
34
|
|
|
40
|
-
const isParentHeaderShown = React.
|
|
41
|
-
const parentHeaderHeight = React.
|
|
35
|
+
const isParentHeaderShown = React.use(HeaderShownContext);
|
|
36
|
+
const parentHeaderHeight = React.use(HeaderHeightContext);
|
|
42
37
|
|
|
43
38
|
const {
|
|
44
39
|
focused,
|
|
@@ -72,12 +67,17 @@ export function Screen(props: Props) {
|
|
|
72
67
|
}, [route.name]);
|
|
73
68
|
|
|
74
69
|
return (
|
|
75
|
-
<
|
|
76
|
-
|
|
77
|
-
style={
|
|
70
|
+
<Container
|
|
71
|
+
inert={!focused}
|
|
72
|
+
style={{
|
|
73
|
+
...styles.container,
|
|
74
|
+
backgroundColor: colors.background,
|
|
75
|
+
...style,
|
|
76
|
+
}}
|
|
78
77
|
// On Fabric we need to disable collapsing for the background to ensure
|
|
79
78
|
// that we won't render unnecessary views due to the view flattening.
|
|
80
|
-
collapsable
|
|
79
|
+
// Container sets `collapsable` to `false` internally
|
|
80
|
+
// This comment is left to make sure refactors don't remove it by mistake
|
|
81
81
|
>
|
|
82
82
|
{headerShown ? (
|
|
83
83
|
<NavigationProvider navigation={navigation} route={route}>
|
|
@@ -105,7 +105,7 @@ export function Screen(props: Props) {
|
|
|
105
105
|
</HeaderHeightContext.Provider>
|
|
106
106
|
</HeaderShownContext.Provider>
|
|
107
107
|
</View>
|
|
108
|
-
</
|
|
108
|
+
</Container>
|
|
109
109
|
);
|
|
110
110
|
}
|
|
111
111
|
|
package/src/index.tsx
CHANGED
|
@@ -1,9 +1,3 @@
|
|
|
1
|
-
import backIcon from './assets/back-icon.png';
|
|
2
|
-
import clearIcon from './assets/clear-icon.png';
|
|
3
|
-
import closeIcon from './assets/close-icon.png';
|
|
4
|
-
import searchIcon from './assets/search-icon.png';
|
|
5
|
-
import searchIconLegacy from './assets/search-icon-legacy.png';
|
|
6
|
-
|
|
7
1
|
export { Badge } from './Badge';
|
|
8
2
|
export { Button } from './Button';
|
|
9
3
|
export { getDefaultSidebarWidth } from './getDefaultSidebarWidth';
|
|
@@ -22,14 +16,5 @@ export { getLabel } from './Label/getLabel';
|
|
|
22
16
|
export { Label } from './Label/Label';
|
|
23
17
|
export { PlatformPressable } from './PlatformPressable';
|
|
24
18
|
export { Text } from './Text';
|
|
25
|
-
export { useFrameSize } from './useFrameSize';
|
|
26
|
-
|
|
27
|
-
export const Assets = [
|
|
28
|
-
backIcon,
|
|
29
|
-
searchIcon,
|
|
30
|
-
searchIconLegacy,
|
|
31
|
-
closeIcon,
|
|
32
|
-
clearIcon,
|
|
33
|
-
];
|
|
34
|
-
|
|
35
19
|
export * from './types';
|
|
20
|
+
export { useFrameSize } from './useFrameSize';
|
package/src/internal.tsx
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
+
export { ActivityView } from './ActivityView';
|
|
1
2
|
export { Color } from './Color';
|
|
2
3
|
export { Container, type Props as ContainerProps } from './Container';
|
|
3
|
-
export { Lazy } from './Lazy';
|
|
4
4
|
export { isLiquidGlassSupported } from './LiquidGlassView';
|
|
5
5
|
export { MissingIcon } from './MissingIcon';
|
|
6
6
|
export { SafeAreaProviderCompat } from './SafeAreaProviderCompat';
|