@react-navigation/elements 3.0.0-alpha.2 → 3.0.0-alpha.20
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/HeaderIcon.js +29 -10
- package/lib/module/Header/HeaderIcon.js.map +1 -1
- package/lib/module/Header/HeaderSearchBar.js +28 -21
- 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.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/HeaderIcon.d.ts +8 -4
- package/lib/typescript/src/Header/HeaderIcon.d.ts.map +1 -1
- package/lib/typescript/src/Header/HeaderSearchBar.d.ts +4 -4
- 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 -12
- 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 +14 -13
- 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/HeaderIcon.tsx +49 -9
- package/src/Header/HeaderSearchBar.tsx +31 -22
- 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 +12 -8
- 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
package/src/types.tsx
CHANGED
|
@@ -1,12 +1,16 @@
|
|
|
1
|
+
import type { MaterialSymbolProps } from '@react-navigation/native';
|
|
2
|
+
import * as React from 'react';
|
|
1
3
|
import type {
|
|
2
4
|
Animated,
|
|
3
5
|
ColorValue,
|
|
6
|
+
ImageSourcePropType,
|
|
4
7
|
LayoutChangeEvent,
|
|
5
8
|
StyleProp,
|
|
6
9
|
TextInputProps,
|
|
7
10
|
TextStyle,
|
|
8
11
|
ViewStyle,
|
|
9
12
|
} from 'react-native';
|
|
13
|
+
import type { SFSymbol } from 'sf-symbols-typescript';
|
|
10
14
|
|
|
11
15
|
import type { BlurEffectType } from './getBlurBackgroundColor';
|
|
12
16
|
|
|
@@ -14,6 +18,46 @@ export type HeaderBackButtonDisplayMode = 'default' | 'generic' | 'minimal';
|
|
|
14
18
|
|
|
15
19
|
export type Layout = { width: number; height: number };
|
|
16
20
|
|
|
21
|
+
type IconImage = {
|
|
22
|
+
/**
|
|
23
|
+
* - `image` - Use a local image as the icon.
|
|
24
|
+
*/
|
|
25
|
+
type: 'image';
|
|
26
|
+
/**
|
|
27
|
+
* Image source to use as the icon.
|
|
28
|
+
* - Local image: `require('./path/to/image.png')`
|
|
29
|
+
* - Drawable resource or xcasset: `{ uri: 'image_name' }`
|
|
30
|
+
*/
|
|
31
|
+
source: ImageSourcePropType;
|
|
32
|
+
/**
|
|
33
|
+
* Whether to apply tint color to the image.
|
|
34
|
+
* Disabling will keep the image's original colors.
|
|
35
|
+
*
|
|
36
|
+
* Defaults to `true`.
|
|
37
|
+
*/
|
|
38
|
+
tinted?: boolean;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
type IconSfSymbol = {
|
|
42
|
+
/**
|
|
43
|
+
* - `sfSymbol` - Use an SF Symbol as the icon on iOS.
|
|
44
|
+
*/
|
|
45
|
+
type: 'sfSymbol';
|
|
46
|
+
/**
|
|
47
|
+
* Name of the SF Symbol to use as the icon.
|
|
48
|
+
*/
|
|
49
|
+
name: SFSymbol;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
type IconMaterialSymbol = {
|
|
53
|
+
/**
|
|
54
|
+
* - `materialSymbol` - Use a Material Symbol as the icon on Android.
|
|
55
|
+
*/
|
|
56
|
+
type: 'materialSymbol';
|
|
57
|
+
} & Pick<MaterialSymbolProps, 'name' | 'variant' | 'weight'>;
|
|
58
|
+
|
|
59
|
+
export type Icon = IconSfSymbol | IconMaterialSymbol | IconImage;
|
|
60
|
+
|
|
17
61
|
export type HeaderSearchBarRef = {
|
|
18
62
|
focus: () => void;
|
|
19
63
|
blur: () => void;
|
|
@@ -33,7 +77,7 @@ export type HeaderSearchBarOptions = {
|
|
|
33
77
|
* - `clearText` - removes any text present in the search bar input field
|
|
34
78
|
* - `cancelSearch` - cancel the search and close the search bar
|
|
35
79
|
*/
|
|
36
|
-
ref?: React.Ref<HeaderSearchBarRef
|
|
80
|
+
ref?: React.Ref<HeaderSearchBarRef> | undefined;
|
|
37
81
|
/**
|
|
38
82
|
* The auto-capitalization behavior
|
|
39
83
|
*/
|
|
@@ -42,55 +86,56 @@ export type HeaderSearchBarOptions = {
|
|
|
42
86
|
| 'words'
|
|
43
87
|
| 'sentences'
|
|
44
88
|
| 'characters'
|
|
45
|
-
| 'systemDefault'
|
|
89
|
+
| 'systemDefault'
|
|
90
|
+
| undefined;
|
|
46
91
|
/**
|
|
47
92
|
* Automatically focuses search input on mount
|
|
48
93
|
*/
|
|
49
|
-
autoFocus?: boolean;
|
|
94
|
+
autoFocus?: boolean | undefined;
|
|
50
95
|
/**
|
|
51
96
|
* The text to be used instead of default `Cancel` button text
|
|
52
97
|
*
|
|
53
98
|
* @platform ios
|
|
54
99
|
*/
|
|
55
|
-
cancelButtonText?: string;
|
|
100
|
+
cancelButtonText?: string | undefined;
|
|
56
101
|
/**
|
|
57
102
|
* Sets type of the input. Defaults to `text`.
|
|
58
103
|
*/
|
|
59
|
-
inputType?: 'text' | 'phone' | 'number' | 'email';
|
|
104
|
+
inputType?: 'text' | 'phone' | 'number' | 'email' | undefined;
|
|
60
105
|
/**
|
|
61
106
|
* Determines how the return key should look. Defaults to `search`.
|
|
62
107
|
*/
|
|
63
|
-
enterKeyHint?: TextInputProps['enterKeyHint'];
|
|
108
|
+
enterKeyHint?: TextInputProps['enterKeyHint'] | undefined;
|
|
64
109
|
/**
|
|
65
110
|
* A callback that gets called when search input has lost focus
|
|
66
111
|
*/
|
|
67
|
-
onBlur?: TextInputProps['onBlur'];
|
|
112
|
+
onBlur?: TextInputProps['onBlur'] | undefined;
|
|
68
113
|
/**
|
|
69
114
|
* A callback that gets called when the text changes.
|
|
70
115
|
* It receives the current text value of the search input.
|
|
71
116
|
*/
|
|
72
|
-
onChange?: TextInputProps['onChange'];
|
|
117
|
+
onChange?: TextInputProps['onChange'] | undefined;
|
|
73
118
|
/**
|
|
74
119
|
* Callback that is called when the submit button is pressed.
|
|
75
120
|
* It receives the current text value of the search input.
|
|
76
121
|
*/
|
|
77
|
-
onSubmitEditing?: TextInputProps['onSubmitEditing'];
|
|
122
|
+
onSubmitEditing?: TextInputProps['onSubmitEditing'] | undefined;
|
|
78
123
|
/**
|
|
79
124
|
* A callback that gets called when search input is opened
|
|
80
125
|
*/
|
|
81
|
-
onOpen?: () => void;
|
|
126
|
+
onOpen?: (() => void) | undefined;
|
|
82
127
|
/**
|
|
83
128
|
* A callback that gets called when search input is closed
|
|
84
129
|
*/
|
|
85
|
-
onClose?: () => void;
|
|
130
|
+
onClose?: (() => void) | undefined;
|
|
86
131
|
/**
|
|
87
132
|
* A callback that gets called when search input has received focus
|
|
88
133
|
*/
|
|
89
|
-
onFocus?: TextInputProps['onFocus'];
|
|
134
|
+
onFocus?: TextInputProps['onFocus'] | undefined;
|
|
90
135
|
/**
|
|
91
136
|
* Text displayed when search field is empty
|
|
92
137
|
*/
|
|
93
|
-
placeholder?: string;
|
|
138
|
+
placeholder?: string | undefined;
|
|
94
139
|
};
|
|
95
140
|
|
|
96
141
|
export type HeaderOptions = {
|
|
@@ -101,28 +146,35 @@ export type HeaderOptions = {
|
|
|
101
146
|
* It receives `allowFontScaling`, `tintColor`, `style` and `children` in the options object as an argument.
|
|
102
147
|
* The title string is passed in `children`.
|
|
103
148
|
*/
|
|
104
|
-
headerTitle?:
|
|
149
|
+
headerTitle?:
|
|
150
|
+
| string
|
|
151
|
+
| ((props: HeaderTitleProps) => React.ReactNode)
|
|
152
|
+
| undefined;
|
|
105
153
|
/**
|
|
106
154
|
* How to align the the header title.
|
|
107
155
|
* Defaults to `center` on iOS and `left` on Android.
|
|
108
156
|
*/
|
|
109
|
-
headerTitleAlign?: 'left' | 'center';
|
|
157
|
+
headerTitleAlign?: 'left' | 'center' | undefined;
|
|
110
158
|
/**
|
|
111
159
|
* Style object for the title component.
|
|
112
160
|
*/
|
|
113
|
-
headerTitleStyle?:
|
|
161
|
+
headerTitleStyle?:
|
|
162
|
+
| Animated.WithAnimatedValue<StyleProp<TextStyle>>
|
|
163
|
+
| undefined;
|
|
114
164
|
/**
|
|
115
165
|
* Style object for the container of the `headerTitle` element.
|
|
116
166
|
*/
|
|
117
|
-
headerTitleContainerStyle?:
|
|
167
|
+
headerTitleContainerStyle?:
|
|
168
|
+
| Animated.WithAnimatedValue<StyleProp<ViewStyle>>
|
|
169
|
+
| undefined;
|
|
118
170
|
/**
|
|
119
171
|
* Whether header title font should scale to respect Text Size accessibility settings. Defaults to `false`.
|
|
120
172
|
*/
|
|
121
|
-
headerTitleAllowFontScaling?: boolean;
|
|
173
|
+
headerTitleAllowFontScaling?: boolean | undefined;
|
|
122
174
|
/**
|
|
123
175
|
* Options to render a search bar.
|
|
124
176
|
*/
|
|
125
|
-
headerSearchBarOptions?: HeaderSearchBarOptions;
|
|
177
|
+
headerSearchBarOptions?: HeaderSearchBarOptions | undefined;
|
|
126
178
|
/**
|
|
127
179
|
* How the back button displays icon and title.
|
|
128
180
|
*
|
|
@@ -133,27 +185,31 @@ export type HeaderOptions = {
|
|
|
133
185
|
*
|
|
134
186
|
* Defaults to "default" on iOS, and "minimal" on other platforms.
|
|
135
187
|
*/
|
|
136
|
-
headerBackButtonDisplayMode?: HeaderBackButtonDisplayMode;
|
|
188
|
+
headerBackButtonDisplayMode?: HeaderBackButtonDisplayMode | undefined;
|
|
137
189
|
/**
|
|
138
190
|
* Style object for header back title. Supported properties:
|
|
139
191
|
* - fontFamily
|
|
140
192
|
* - fontSize
|
|
141
193
|
*/
|
|
142
|
-
headerBackTitleStyle?:
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
194
|
+
headerBackTitleStyle?:
|
|
195
|
+
| StyleProp<{
|
|
196
|
+
fontFamily?: string | undefined;
|
|
197
|
+
fontSize?: number | undefined;
|
|
198
|
+
}>
|
|
199
|
+
| undefined;
|
|
146
200
|
/**
|
|
147
201
|
* Function which returns a React Element to display on the left side of the header.
|
|
148
202
|
*/
|
|
149
|
-
headerLeft?:
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
203
|
+
headerLeft?:
|
|
204
|
+
| ((
|
|
205
|
+
props: HeaderBackButtonProps & {
|
|
206
|
+
/**
|
|
207
|
+
* Whether it's possible to navigate back.
|
|
208
|
+
*/
|
|
209
|
+
canGoBack?: boolean | undefined;
|
|
210
|
+
}
|
|
211
|
+
) => React.ReactNode)
|
|
212
|
+
| undefined;
|
|
157
213
|
/**
|
|
158
214
|
* Whether the liquid glass background is visible for the item.
|
|
159
215
|
*
|
|
@@ -162,20 +218,24 @@ export type HeaderOptions = {
|
|
|
162
218
|
*
|
|
163
219
|
* Defaults to `true`.
|
|
164
220
|
*/
|
|
165
|
-
headerLeftBackgroundVisible?: boolean;
|
|
221
|
+
headerLeftBackgroundVisible?: boolean | undefined;
|
|
166
222
|
/**
|
|
167
223
|
* Style object for the container of the `headerLeft` element`.
|
|
168
224
|
*/
|
|
169
|
-
headerLeftContainerStyle?:
|
|
225
|
+
headerLeftContainerStyle?:
|
|
226
|
+
| Animated.WithAnimatedValue<StyleProp<ViewStyle>>
|
|
227
|
+
| undefined;
|
|
170
228
|
/**
|
|
171
229
|
* Function which returns a React Element to display on the right side of the header.
|
|
172
230
|
*/
|
|
173
|
-
headerRight?:
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
231
|
+
headerRight?:
|
|
232
|
+
| ((props: {
|
|
233
|
+
tintColor?: ColorValue | undefined;
|
|
234
|
+
pressColor?: ColorValue | undefined;
|
|
235
|
+
pressOpacity?: number | undefined;
|
|
236
|
+
canGoBack: boolean;
|
|
237
|
+
}) => React.ReactNode)
|
|
238
|
+
| undefined;
|
|
179
239
|
/**
|
|
180
240
|
* Whether the liquid glass background is visible for the item.
|
|
181
241
|
*
|
|
@@ -184,43 +244,47 @@ export type HeaderOptions = {
|
|
|
184
244
|
*
|
|
185
245
|
* Defaults to `true`.
|
|
186
246
|
*/
|
|
187
|
-
headerRightBackgroundVisible?: boolean;
|
|
247
|
+
headerRightBackgroundVisible?: boolean | undefined;
|
|
188
248
|
/**
|
|
189
249
|
* Style object for the container of the `headerRight` element.
|
|
190
250
|
*/
|
|
191
|
-
headerRightContainerStyle?:
|
|
251
|
+
headerRightContainerStyle?:
|
|
252
|
+
| Animated.WithAnimatedValue<StyleProp<ViewStyle>>
|
|
253
|
+
| undefined;
|
|
192
254
|
/**
|
|
193
255
|
* Color for material ripple (Android >= 5.0 only).
|
|
194
256
|
*/
|
|
195
|
-
headerPressColor?: ColorValue;
|
|
257
|
+
headerPressColor?: ColorValue | undefined;
|
|
196
258
|
/**
|
|
197
259
|
* Color for material ripple (Android >= 5.0 only).
|
|
198
260
|
*/
|
|
199
|
-
headerPressOpacity?: number;
|
|
261
|
+
headerPressOpacity?: number | undefined;
|
|
200
262
|
/**
|
|
201
263
|
* Tint color for the header.
|
|
202
264
|
*/
|
|
203
|
-
headerTintColor?: ColorValue;
|
|
265
|
+
headerTintColor?: ColorValue | undefined;
|
|
204
266
|
/**
|
|
205
267
|
* Function which returns a React Element to render as the background of the header.
|
|
206
268
|
* This is useful for using backgrounds such as an image, a gradient, blur effect etc.
|
|
207
269
|
* You can use this with `headerTransparent` to render a blur view, for example, to create a translucent header.
|
|
208
270
|
*/
|
|
209
|
-
headerBackground?:
|
|
210
|
-
|
|
211
|
-
|
|
271
|
+
headerBackground?:
|
|
272
|
+
| ((props: {
|
|
273
|
+
style: Animated.WithAnimatedValue<StyleProp<ViewStyle>>;
|
|
274
|
+
}) => React.ReactNode)
|
|
275
|
+
| undefined;
|
|
212
276
|
/**
|
|
213
277
|
* Style object for the container of the `headerBackground` element.
|
|
214
278
|
*/
|
|
215
|
-
headerBackgroundContainerStyle?:
|
|
216
|
-
StyleProp<ViewStyle
|
|
217
|
-
|
|
279
|
+
headerBackgroundContainerStyle?:
|
|
280
|
+
| Animated.WithAnimatedValue<StyleProp<ViewStyle>>
|
|
281
|
+
| undefined;
|
|
218
282
|
/**
|
|
219
283
|
* Defaults to `false`. If `true`, the header will not have a background unless you explicitly provide it with `headerBackground`.
|
|
220
284
|
* The header will also float over the screen so that it overlaps the content underneath.
|
|
221
285
|
* This is useful if you want to render a semi-transparent header or a blurred background.
|
|
222
286
|
*/
|
|
223
|
-
headerTransparent?: boolean;
|
|
287
|
+
headerTransparent?: boolean | undefined;
|
|
224
288
|
/**
|
|
225
289
|
* Blur effect for the translucent header.
|
|
226
290
|
* The `headerTransparent` option needs to be set to `true` for this to work.
|
|
@@ -229,11 +293,11 @@ export type HeaderOptions = {
|
|
|
229
293
|
*
|
|
230
294
|
* @platform web
|
|
231
295
|
*/
|
|
232
|
-
headerBlurEffect?: BlurEffectType | 'none';
|
|
296
|
+
headerBlurEffect?: BlurEffectType | 'none' | undefined;
|
|
233
297
|
/**
|
|
234
298
|
* Style object for the header. You can specify a custom background color here, for example.
|
|
235
299
|
*/
|
|
236
|
-
headerStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle
|
|
300
|
+
headerStyle?: Animated.WithAnimatedValue<StyleProp<ViewStyle>> | undefined;
|
|
237
301
|
/**
|
|
238
302
|
* Whether to hide the elevation shadow (Android) or the bottom border (iOS) on the header.
|
|
239
303
|
*
|
|
@@ -250,13 +314,13 @@ export type HeaderOptions = {
|
|
|
250
314
|
* If the above styles are specified in `headerStyle` along with `headerShadowVisible: false`,
|
|
251
315
|
* then `headerShadowVisible: false` will take precedence.
|
|
252
316
|
*/
|
|
253
|
-
headerShadowVisible?: boolean;
|
|
317
|
+
headerShadowVisible?: boolean | undefined;
|
|
254
318
|
/**
|
|
255
319
|
* Extra padding to add at the top of header to account for translucent status bar.
|
|
256
320
|
* By default, it uses the top value from the safe area insets of the device.
|
|
257
321
|
* Pass 0 or a custom value to disable the default behaviour, and customize the height.
|
|
258
322
|
*/
|
|
259
|
-
headerStatusBarHeight?: number;
|
|
323
|
+
headerStatusBarHeight?: number | undefined;
|
|
260
324
|
};
|
|
261
325
|
|
|
262
326
|
export type HeaderTitleProps = {
|
|
@@ -267,58 +331,58 @@ export type HeaderTitleProps = {
|
|
|
267
331
|
/**
|
|
268
332
|
* Whether title font should scale to respect Text Size accessibility settings.
|
|
269
333
|
*/
|
|
270
|
-
allowFontScaling?: boolean;
|
|
334
|
+
allowFontScaling?: boolean | undefined;
|
|
271
335
|
/**
|
|
272
336
|
* Tint color for the header.
|
|
273
337
|
*/
|
|
274
|
-
tintColor?: ColorValue;
|
|
338
|
+
tintColor?: ColorValue | undefined;
|
|
275
339
|
/**
|
|
276
340
|
* Callback to trigger when the size of the title element changes.
|
|
277
341
|
*/
|
|
278
|
-
onLayout?: (e: LayoutChangeEvent) => void;
|
|
342
|
+
onLayout?: ((e: LayoutChangeEvent) => void) | undefined;
|
|
279
343
|
/**
|
|
280
344
|
* Style object for the title element.
|
|
281
345
|
*/
|
|
282
|
-
style?: Animated.WithAnimatedValue<StyleProp<TextStyle
|
|
346
|
+
style?: Animated.WithAnimatedValue<StyleProp<TextStyle>> | undefined;
|
|
283
347
|
};
|
|
284
348
|
|
|
285
349
|
export type HeaderButtonProps = {
|
|
286
350
|
/**
|
|
287
351
|
* Callback to call when the button is pressed.
|
|
288
352
|
*/
|
|
289
|
-
onPress?: () => void;
|
|
353
|
+
onPress?: (() => void) | undefined;
|
|
290
354
|
/**
|
|
291
355
|
* The `href` to use for the anchor tag on web
|
|
292
356
|
*/
|
|
293
|
-
href?: string;
|
|
357
|
+
href?: string | undefined;
|
|
294
358
|
/**
|
|
295
359
|
* Whether the button is disabled.
|
|
296
360
|
*/
|
|
297
|
-
disabled?: boolean;
|
|
361
|
+
disabled?: boolean | undefined;
|
|
298
362
|
/**
|
|
299
363
|
* Accessibility label for the button for screen readers.
|
|
300
364
|
*/
|
|
301
|
-
accessibilityLabel?: string;
|
|
365
|
+
accessibilityLabel?: string | undefined;
|
|
302
366
|
/**
|
|
303
367
|
* ID to locate this button in tests.
|
|
304
368
|
*/
|
|
305
|
-
testID?: string;
|
|
369
|
+
testID?: string | undefined;
|
|
306
370
|
/**
|
|
307
371
|
* Tint color for the header button.
|
|
308
372
|
*/
|
|
309
|
-
tintColor?: ColorValue;
|
|
373
|
+
tintColor?: ColorValue | undefined;
|
|
310
374
|
/**
|
|
311
375
|
* Color for material ripple (Android >= 5.0 only).
|
|
312
376
|
*/
|
|
313
|
-
pressColor?: ColorValue;
|
|
377
|
+
pressColor?: ColorValue | undefined;
|
|
314
378
|
/**
|
|
315
379
|
* Opacity when the button is pressed, used when ripple is not supported.
|
|
316
380
|
*/
|
|
317
|
-
pressOpacity?: number;
|
|
381
|
+
pressOpacity?: number | undefined;
|
|
318
382
|
/**
|
|
319
383
|
* Style object for the button.
|
|
320
384
|
*/
|
|
321
|
-
style?: StyleProp<ViewStyle
|
|
385
|
+
style?: StyleProp<ViewStyle> | undefined;
|
|
322
386
|
/**
|
|
323
387
|
* Content to render for the button. Usually the icon.
|
|
324
388
|
*/
|
|
@@ -327,18 +391,31 @@ export type HeaderButtonProps = {
|
|
|
327
391
|
|
|
328
392
|
export type HeaderBackButtonProps = Omit<HeaderButtonProps, 'children'> & {
|
|
329
393
|
/**
|
|
330
|
-
*
|
|
394
|
+
* Icon to display for the back button.
|
|
395
|
+
*
|
|
396
|
+
* Supported types:
|
|
397
|
+
* - image: custom image source
|
|
398
|
+
* - sfSymbol: SF Symbol icon (iOS only)
|
|
399
|
+
* - materialSymbol: material symbol icon (Android only)
|
|
400
|
+
* - React Node: function that returns a React Element
|
|
401
|
+
*
|
|
402
|
+
* Defaults to back icon image for the platform
|
|
403
|
+
* - A chevron on iOS
|
|
404
|
+
* - An arrow on Android
|
|
331
405
|
*/
|
|
332
|
-
|
|
406
|
+
icon?:
|
|
407
|
+
| Icon
|
|
408
|
+
| ((props: { tintColor: ColorValue | undefined }) => React.ReactNode)
|
|
409
|
+
| undefined;
|
|
333
410
|
/**
|
|
334
411
|
* Label text for the button. Usually the title of the previous screen.
|
|
335
412
|
* By default, this is only shown on iOS.
|
|
336
413
|
*/
|
|
337
|
-
label?: string;
|
|
414
|
+
label?: string | undefined;
|
|
338
415
|
/**
|
|
339
416
|
* Label text to show when there isn't enough space for the full label.
|
|
340
417
|
*/
|
|
341
|
-
truncatedLabel?: string;
|
|
418
|
+
truncatedLabel?: string | undefined;
|
|
342
419
|
/**
|
|
343
420
|
* How the back button displays icon and title.
|
|
344
421
|
*
|
|
@@ -349,13 +426,13 @@ export type HeaderBackButtonProps = Omit<HeaderButtonProps, 'children'> & {
|
|
|
349
426
|
*
|
|
350
427
|
* Defaults to "default" on iOS, and "minimal" on other platforms.
|
|
351
428
|
*/
|
|
352
|
-
displayMode?: HeaderBackButtonDisplayMode;
|
|
429
|
+
displayMode?: HeaderBackButtonDisplayMode | undefined;
|
|
353
430
|
/**
|
|
354
431
|
* Style object for the label.
|
|
355
432
|
*/
|
|
356
|
-
labelStyle?: Animated.WithAnimatedValue<StyleProp<TextStyle
|
|
433
|
+
labelStyle?: Animated.WithAnimatedValue<StyleProp<TextStyle>> | undefined;
|
|
357
434
|
/**
|
|
358
435
|
* Whether label font should scale to respect Text Size accessibility settings.
|
|
359
436
|
*/
|
|
360
|
-
allowFontScaling?: boolean;
|
|
437
|
+
allowFontScaling?: boolean | undefined;
|
|
361
438
|
};
|
package/src/useFrameSize.tsx
CHANGED
|
@@ -26,7 +26,7 @@ export function useFrameSize<T>(
|
|
|
26
26
|
selector: (frame: Frame) => T,
|
|
27
27
|
throttle?: boolean
|
|
28
28
|
): T {
|
|
29
|
-
const context = React.
|
|
29
|
+
const context = React.use(FrameContext);
|
|
30
30
|
|
|
31
31
|
if (context == null) {
|
|
32
32
|
throw new Error('useFrameSize must be used within a FrameSizeProvider');
|
package/lib/module/Lazy.js
DELETED
|
@@ -1,42 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
/**
|
|
5
|
-
* Render content lazily based on visibility.
|
|
6
|
-
*
|
|
7
|
-
* When enabled:
|
|
8
|
-
* - If content is visible, it will render immediately
|
|
9
|
-
* - If content is not visible, it won't render until it becomes visible
|
|
10
|
-
*
|
|
11
|
-
* Otherwise:
|
|
12
|
-
* - If content is visible, it will render immediately
|
|
13
|
-
* - If content is not visible, it will defer rendering until idle
|
|
14
|
-
*
|
|
15
|
-
* Once rendered, the content remains rendered.
|
|
16
|
-
*/
|
|
17
|
-
export function Lazy({
|
|
18
|
-
enabled,
|
|
19
|
-
visible,
|
|
20
|
-
children
|
|
21
|
-
}) {
|
|
22
|
-
const [rendered, setRendered] = React.useState(enabled ? visible : false);
|
|
23
|
-
const shouldRenderInIdle = !(enabled || visible || rendered);
|
|
24
|
-
React.useEffect(() => {
|
|
25
|
-
if (shouldRenderInIdle === false) {
|
|
26
|
-
return;
|
|
27
|
-
}
|
|
28
|
-
const id = requestIdleCallback(() => {
|
|
29
|
-
setRendered(true);
|
|
30
|
-
});
|
|
31
|
-
return () => cancelIdleCallback(id);
|
|
32
|
-
}, [shouldRenderInIdle]);
|
|
33
|
-
if (visible && rendered === false) {
|
|
34
|
-
setRendered(true);
|
|
35
|
-
return children;
|
|
36
|
-
}
|
|
37
|
-
if (rendered) {
|
|
38
|
-
return children;
|
|
39
|
-
}
|
|
40
|
-
return null;
|
|
41
|
-
}
|
|
42
|
-
//# sourceMappingURL=Lazy.js.map
|
package/lib/module/Lazy.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"names":["React","Lazy","enabled","visible","children","rendered","setRendered","useState","shouldRenderInIdle","useEffect","id","requestIdleCallback","cancelIdleCallback"],"sourceRoot":"../../src","sources":["Lazy.tsx"],"mappings":";;AAAA,OAAO,KAAKA,KAAK,MAAM,OAAO;AAiB9B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,OAAO,SAASC,IAAIA,CAAC;EAAEC,OAAO;EAAEC,OAAO;EAAEC;AAAgB,CAAC,EAAE;EAC1D,MAAM,CAACC,QAAQ,EAAEC,WAAW,CAAC,GAAGN,KAAK,CAACO,QAAQ,CAACL,OAAO,GAAGC,OAAO,GAAG,KAAK,CAAC;EAEzE,MAAMK,kBAAkB,GAAG,EAAEN,OAAO,IAAIC,OAAO,IAAIE,QAAQ,CAAC;EAE5DL,KAAK,CAACS,SAAS,CAAC,MAAM;IACpB,IAAID,kBAAkB,KAAK,KAAK,EAAE;MAChC;IACF;IAEA,MAAME,EAAE,GAAGC,mBAAmB,CAAC,MAAM;MACnCL,WAAW,CAAC,IAAI,CAAC;IACnB,CAAC,CAAC;IAEF,OAAO,MAAMM,kBAAkB,CAACF,EAAE,CAAC;EACrC,CAAC,EAAE,CAACF,kBAAkB,CAAC,CAAC;EAExB,IAAIL,OAAO,IAAIE,QAAQ,KAAK,KAAK,EAAE;IACjCC,WAAW,CAAC,IAAI,CAAC;IAEjB,OAAOF,QAAQ;EACjB;EAEA,IAAIC,QAAQ,EAAE;IACZ,OAAOD,QAAQ;EACjB;EAEA,OAAO,IAAI;AACb","ignoreList":[]}
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
type Props = {
|
|
3
|
-
/**
|
|
4
|
-
* Whether lazy rendering is enabled.
|
|
5
|
-
*/
|
|
6
|
-
enabled: boolean;
|
|
7
|
-
/**
|
|
8
|
-
* Whether the component is visible.
|
|
9
|
-
*/
|
|
10
|
-
visible: boolean;
|
|
11
|
-
/**
|
|
12
|
-
* Content to render.
|
|
13
|
-
*/
|
|
14
|
-
children: React.ReactElement;
|
|
15
|
-
};
|
|
16
|
-
/**
|
|
17
|
-
* Render content lazily based on visibility.
|
|
18
|
-
*
|
|
19
|
-
* When enabled:
|
|
20
|
-
* - If content is visible, it will render immediately
|
|
21
|
-
* - If content is not visible, it won't render until it becomes visible
|
|
22
|
-
*
|
|
23
|
-
* Otherwise:
|
|
24
|
-
* - If content is visible, it will render immediately
|
|
25
|
-
* - If content is not visible, it will defer rendering until idle
|
|
26
|
-
*
|
|
27
|
-
* Once rendered, the content remains rendered.
|
|
28
|
-
*/
|
|
29
|
-
export declare function Lazy({ enabled, visible, children }: Props): React.ReactElement<unknown, string | React.JSXElementConstructor<any>> | null;
|
|
30
|
-
export {};
|
|
31
|
-
//# sourceMappingURL=Lazy.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Lazy.d.ts","sourceRoot":"","sources":["../../../src/Lazy.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,KAAK,KAAK,GAAG;IACX;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,OAAO,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,YAAY,CAAC;CAC9B,CAAC;AAEF;;;;;;;;;;;;GAYG;AACH,wBAAgB,IAAI,CAAC,EAAE,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,EAAE,KAAK,iFA4BzD"}
|