@office-iss/react-native-win32 0.0.0-canary.288 → 0.0.0-canary.289
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/.flowconfig +3 -2
- package/CHANGELOG.json +22 -1
- package/CHANGELOG.md +16 -7
- package/Libraries/Alert/Alert.d.ts +4 -1
- package/Libraries/Alert/Alert.js +3 -0
- package/Libraries/Animated/Easing.js +13 -15
- package/Libraries/Animated/createAnimatedComponent.js +24 -12
- package/Libraries/Animated/nodes/AnimatedNode.js +2 -1
- package/Libraries/Animated/nodes/AnimatedProps.js +18 -1
- package/Libraries/Animated/nodes/AnimatedValue.js +6 -2
- package/Libraries/Blob/URL.js +23 -10
- package/Libraries/Components/TextInput/Tests/TextInputTest.d.ts +2 -1
- package/Libraries/Components/TextInput/Tests/TextInputTest.js.map +1 -1
- package/Libraries/Components/TextInput/TextInput.d.ts +6 -0
- package/Libraries/Components/TextInput/TextInput.flow.js +36 -3
- package/Libraries/Components/TextInput/TextInput.js +101 -110
- package/Libraries/Components/TextInput/TextInput.win32.js +102 -111
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.d.ts +2 -1
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
- package/Libraries/Core/ReactNativeVersion.js +2 -2
- package/Libraries/Image/Tests/ImageWin32Test.d.ts +2 -1
- package/Libraries/Image/Tests/ImageWin32Test.js.map +1 -1
- package/Libraries/Interaction/TaskQueue.js +1 -0
- package/Libraries/Modal/Modal.js +30 -4
- package/Libraries/ReactNative/AppRegistry.flow.js +49 -0
- package/Libraries/ReactNative/AppRegistry.js +2 -322
- package/Libraries/ReactNative/AppRegistry.js.flow +23 -0
- package/Libraries/ReactNative/AppRegistryImpl.js +316 -0
- package/Libraries/ReactNative/ReactFabricPublicInstance/ReactFabricPublicInstance.js +1 -4
- package/Libraries/StyleSheet/PlatformColorValueTypesIOS.js +6 -0
- package/Libraries/StyleSheet/StyleSheet.js +5 -197
- package/Libraries/StyleSheet/StyleSheet.js.flow +166 -0
- package/Libraries/StyleSheet/{StyleSheet.win32.js → StyleSheetExports.js} +2 -151
- package/Libraries/StyleSheet/StyleSheetExports.js.flow +110 -0
- package/Libraries/StyleSheet/StyleSheetTypes.js +42 -18
- package/Libraries/Types/CodegenTypesNamespace.d.ts +45 -0
- package/Libraries/{Modal/ModalInjection.js → Types/CodegenTypesNamespace.js} +4 -5
- package/Libraries/Utilities/codegenNativeCommands.d.ts +18 -0
- package/Libraries/Utilities/codegenNativeComponent.d.ts +26 -0
- package/Libraries/vendor/emitter/EventEmitter.js +6 -2
- package/flow/global.js +1 -0
- package/flow/jest.js +4 -2
- package/index.js +47 -43
- package/index.win32.js +60 -55
- package/overrides.json +8 -16
- package/package.json +14 -14
- package/src/private/animated/NativeAnimatedHelper.js +18 -7
- package/src/private/animated/NativeAnimatedHelper.win32.js +18 -7
- package/src/private/animated/createAnimatedPropsHook.js +34 -15
- package/src/private/featureflags/ReactNativeFeatureFlags.js +14 -31
- package/src/private/featureflags/ReactNativeFeatureFlagsBase.js +9 -1
- package/src/private/featureflags/specs/NativeReactNativeFeatureFlags.js +2 -3
- package/src/private/webapis/dom/nodes/ReadOnlyNode.js +5 -18
- package/src/private/webapis/dom/nodes/internals/NodeInternals.js +6 -0
- package/src/types/third_party/event-target-shim.d.ts +392 -0
- package/src-win/Libraries/Components/TextInput/Tests/TextInputTest.tsx +7 -7
- package/src-win/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +3 -3
- package/src-win/Libraries/Image/Tests/ImageWin32Test.tsx +1 -1
- package/types/index.d.ts +4 -0
package/.flowconfig
CHANGED
|
@@ -28,7 +28,6 @@
|
|
|
28
28
|
<PROJECT_ROOT>/Libraries/Network/RCTNetworking.js
|
|
29
29
|
<PROJECT_ROOT>/Libraries/Pressability/Pressability.js
|
|
30
30
|
<PROJECT_ROOT>/Libraries/Pressability/HoverState.js
|
|
31
|
-
<PROJECT_ROOT>/Libraries/StyleSheet/StyleSheet.js
|
|
32
31
|
<PROJECT_ROOT>/Libraries/StyleSheet/PlatformColorValueTypes.js
|
|
33
32
|
<PROJECT_ROOT>/Libraries/Text/TextProps.js
|
|
34
33
|
<PROJECT_ROOT>/Libraries/Types/CoreEventTypes.js
|
|
@@ -136,6 +135,8 @@ module.name_mapper='^@office-iss/react-native-win32/\(.*\)$' -> '<PROJECT_ROOT>\
|
|
|
136
135
|
module.name_mapper='^@react-native/dev-middleware$' -> '<PROJECT_ROOT>/\1'
|
|
137
136
|
module.name_mapper='^@?[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\|xml\)$' -> '<PROJECT_ROOT>/Libraries/Image/RelativeImageStub'
|
|
138
137
|
|
|
138
|
+
react.runtime=automatic
|
|
139
|
+
|
|
139
140
|
suppress_type=$FlowIssue
|
|
140
141
|
suppress_type=$FlowFixMe
|
|
141
142
|
suppress_type=$FlowFixMeProps
|
|
@@ -167,4 +168,4 @@ untyped-import
|
|
|
167
168
|
untyped-type-import
|
|
168
169
|
|
|
169
170
|
[version]
|
|
170
|
-
^0.
|
|
171
|
+
^0.265.2
|
package/CHANGELOG.json
CHANGED
|
@@ -2,7 +2,28 @@
|
|
|
2
2
|
"name": "@office-iss/react-native-win32",
|
|
3
3
|
"entries": [
|
|
4
4
|
{
|
|
5
|
-
"date": "
|
|
5
|
+
"date": "Thu, 19 Jun 2025 17:15:20 GMT",
|
|
6
|
+
"version": "0.0.0-canary.289",
|
|
7
|
+
"tag": "@office-iss/react-native-win32_v0.0.0-canary.289",
|
|
8
|
+
"comments": {
|
|
9
|
+
"prerelease": [
|
|
10
|
+
{
|
|
11
|
+
"author": "hmalothu@microsoft.com",
|
|
12
|
+
"package": "@office-iss/react-native-win32",
|
|
13
|
+
"commit": "56637fc1b13f290eab37a10c098e7be87adf909e",
|
|
14
|
+
"comment": "Integrate RN Nightly Build 0.80.0-nightly-20250317-fc7385c1e"
|
|
15
|
+
},
|
|
16
|
+
{
|
|
17
|
+
"author": "30809111+acoates-ms@users.noreply.github.com",
|
|
18
|
+
"package": "@office-iss/react-native-win32",
|
|
19
|
+
"commit": "06a52c2ca0ccdf323f2ead1eb8dcdbbd0f6b189d",
|
|
20
|
+
"comment": "Update to @types/react 19"
|
|
21
|
+
}
|
|
22
|
+
]
|
|
23
|
+
}
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
"date": "Fri, 30 May 2025 05:24:59 GMT",
|
|
6
27
|
"version": "0.0.0-canary.288",
|
|
7
28
|
"tag": "@office-iss/react-native-win32_v0.0.0-canary.288",
|
|
8
29
|
"comments": {
|
package/CHANGELOG.md
CHANGED
|
@@ -1,20 +1,29 @@
|
|
|
1
1
|
# Change Log - @office-iss/react-native-win32
|
|
2
2
|
|
|
3
|
-
<!-- This log was last generated on
|
|
3
|
+
<!-- This log was last generated on Thu, 19 Jun 2025 17:15:20 GMT and should not be manually modified. -->
|
|
4
4
|
|
|
5
5
|
<!-- Start content -->
|
|
6
6
|
|
|
7
|
-
## 0.0.0-canary.
|
|
7
|
+
## 0.0.0-canary.289
|
|
8
8
|
|
|
9
|
-
|
|
9
|
+
Thu, 19 Jun 2025 17:15:20 GMT
|
|
10
10
|
|
|
11
11
|
### Changes
|
|
12
12
|
|
|
13
|
-
-
|
|
14
|
-
-
|
|
15
|
-
- Bump @rnw-scripts/just-task to v2.3.53
|
|
16
|
-
- Bump react-native-platform-override to v1.9.55
|
|
13
|
+
- Integrate RN Nightly Build 0.80.0-nightly-20250317-fc7385c1e (hmalothu@microsoft.com)
|
|
14
|
+
- Update to @types/react 19 (30809111+acoates-ms@users.noreply.github.com)
|
|
17
15
|
|
|
16
|
+
## 0.0.0-canary.288
|
|
17
|
+
|
|
18
|
+
Fri, 30 May 2025 05:24:59 GMT
|
|
19
|
+
|
|
20
|
+
### Changes
|
|
21
|
+
|
|
22
|
+
- Bump @rnw-scripts/eslint-config to v1.2.36
|
|
23
|
+
- Bump @rnw-scripts/jest-out-of-tree-snapshot-resolver to v1.1.40
|
|
24
|
+
- Bump @rnw-scripts/just-task to v2.3.53
|
|
25
|
+
- Bump react-native-platform-override to v1.9.55
|
|
26
|
+
|
|
18
27
|
## 0.0.0-canary.287
|
|
19
28
|
|
|
20
29
|
Wed, 28 May 2025 05:24:00 GMT
|
|
@@ -12,7 +12,10 @@
|
|
|
12
12
|
*/
|
|
13
13
|
export interface AlertButton {
|
|
14
14
|
text?: string | undefined;
|
|
15
|
-
onPress?:
|
|
15
|
+
onPress?:
|
|
16
|
+
| ((value?: string) => void)
|
|
17
|
+
| ((value?: {login: string; password: string}) => void)
|
|
18
|
+
| undefined;
|
|
16
19
|
isPreferred?: boolean | undefined;
|
|
17
20
|
style?: 'default' | 'cancel' | 'destructive' | undefined;
|
|
18
21
|
}
|
package/Libraries/Alert/Alert.js
CHANGED
|
@@ -119,12 +119,15 @@ class Alert {
|
|
|
119
119
|
if (action === constants.buttonClicked) {
|
|
120
120
|
if (buttonKey === constants.buttonNeutral) {
|
|
121
121
|
// $FlowFixMe[incompatible-type]
|
|
122
|
+
// $FlowFixMe[incompatible-use]
|
|
122
123
|
buttonNeutral.onPress && buttonNeutral.onPress();
|
|
123
124
|
} else if (buttonKey === constants.buttonNegative) {
|
|
124
125
|
// $FlowFixMe[incompatible-type]
|
|
126
|
+
// $FlowFixMe[incompatible-use]
|
|
125
127
|
buttonNegative.onPress && buttonNegative.onPress();
|
|
126
128
|
} else if (buttonKey === constants.buttonPositive) {
|
|
127
129
|
// $FlowFixMe[incompatible-type]
|
|
130
|
+
// $FlowFixMe[incompatible-use]
|
|
128
131
|
buttonPositive.onPress && buttonPositive.onPress();
|
|
129
132
|
}
|
|
130
133
|
} else if (action === constants.dismissed) {
|
|
@@ -12,6 +12,8 @@
|
|
|
12
12
|
|
|
13
13
|
let ease;
|
|
14
14
|
|
|
15
|
+
export type EasingFunction = (t: number) => number;
|
|
16
|
+
|
|
15
17
|
/**
|
|
16
18
|
* The `Easing` module implements common easing functions. This module is used
|
|
17
19
|
* by [Animate.timing()](docs/animate.html#timing) to convey physically
|
|
@@ -57,7 +59,7 @@ let ease;
|
|
|
57
59
|
* - [`inOut`](docs/easing.html#inout) makes any easing function symmetrical
|
|
58
60
|
* - [`out`](docs/easing.html#out) runs an easing function backwards
|
|
59
61
|
*/
|
|
60
|
-
const
|
|
62
|
+
const EasingStatic = {
|
|
61
63
|
/**
|
|
62
64
|
* A stepping function, returns 1 for any positive value of `n`.
|
|
63
65
|
*/
|
|
@@ -90,7 +92,7 @@ const Easing = {
|
|
|
90
92
|
*/
|
|
91
93
|
ease(t: number): number {
|
|
92
94
|
if (!ease) {
|
|
93
|
-
ease =
|
|
95
|
+
ease = EasingStatic.bezier(0.42, 0, 1, 1);
|
|
94
96
|
}
|
|
95
97
|
return ease(t);
|
|
96
98
|
},
|
|
@@ -121,7 +123,7 @@ const Easing = {
|
|
|
121
123
|
* n = 4: http://easings.net/#easeInQuart
|
|
122
124
|
* n = 5: http://easings.net/#easeInQuint
|
|
123
125
|
*/
|
|
124
|
-
poly(n: number):
|
|
126
|
+
poly(n: number): EasingFunction {
|
|
125
127
|
return (t: number) => Math.pow(t, n);
|
|
126
128
|
},
|
|
127
129
|
|
|
@@ -162,7 +164,7 @@ const Easing = {
|
|
|
162
164
|
*
|
|
163
165
|
* http://easings.net/#easeInElastic
|
|
164
166
|
*/
|
|
165
|
-
elastic(bounciness: number = 1):
|
|
167
|
+
elastic(bounciness: number = 1): EasingFunction {
|
|
166
168
|
const p = bounciness * Math.PI;
|
|
167
169
|
return t => 1 - Math.pow(Math.cos((t * Math.PI) / 2), 3) * Math.cos(t * p);
|
|
168
170
|
},
|
|
@@ -173,7 +175,7 @@ const Easing = {
|
|
|
173
175
|
*
|
|
174
176
|
* https://easings.net/#easeInBack
|
|
175
177
|
*/
|
|
176
|
-
back(s: number = 1.70158):
|
|
178
|
+
back(s: number = 1.70158): EasingFunction {
|
|
177
179
|
return t => t * t * ((s + 1) * t - s);
|
|
178
180
|
},
|
|
179
181
|
|
|
@@ -208,12 +210,7 @@ const Easing = {
|
|
|
208
210
|
* A useful tool to visualize cubic bezier curves can be found at
|
|
209
211
|
* http://cubic-bezier.com/
|
|
210
212
|
*/
|
|
211
|
-
bezier(
|
|
212
|
-
x1: number,
|
|
213
|
-
y1: number,
|
|
214
|
-
x2: number,
|
|
215
|
-
y2: number,
|
|
216
|
-
): (t: number) => number {
|
|
213
|
+
bezier(x1: number, y1: number, x2: number, y2: number): EasingFunction {
|
|
217
214
|
const _bezier = require('./bezier').default;
|
|
218
215
|
return _bezier(x1, y1, x2, y2);
|
|
219
216
|
},
|
|
@@ -221,14 +218,14 @@ const Easing = {
|
|
|
221
218
|
/**
|
|
222
219
|
* Runs an easing function forwards.
|
|
223
220
|
*/
|
|
224
|
-
in(easing:
|
|
221
|
+
in(easing: EasingFunction): EasingFunction {
|
|
225
222
|
return easing;
|
|
226
223
|
},
|
|
227
224
|
|
|
228
225
|
/**
|
|
229
226
|
* Runs an easing function backwards.
|
|
230
227
|
*/
|
|
231
|
-
out(easing:
|
|
228
|
+
out(easing: EasingFunction): EasingFunction {
|
|
232
229
|
return t => 1 - easing(1 - t);
|
|
233
230
|
},
|
|
234
231
|
|
|
@@ -237,7 +234,7 @@ const Easing = {
|
|
|
237
234
|
* forwards for half of the duration, then backwards for the rest of the
|
|
238
235
|
* duration.
|
|
239
236
|
*/
|
|
240
|
-
inOut(easing:
|
|
237
|
+
inOut(easing: EasingFunction): EasingFunction {
|
|
241
238
|
return t => {
|
|
242
239
|
if (t < 0.5) {
|
|
243
240
|
return easing(t * 2) / 2;
|
|
@@ -247,4 +244,5 @@ const Easing = {
|
|
|
247
244
|
},
|
|
248
245
|
};
|
|
249
246
|
|
|
250
|
-
export
|
|
247
|
+
export type Easing = typeof EasingStatic;
|
|
248
|
+
export default EasingStatic;
|
|
@@ -36,7 +36,7 @@ export type StrictAnimatedProps<Props: {...}> = $ReadOnly<{
|
|
|
36
36
|
}>;
|
|
37
37
|
|
|
38
38
|
export type AnimatedComponentType<Props: {...}, +Instance = mixed> = component(
|
|
39
|
-
ref
|
|
39
|
+
ref?: React.RefSetter<Instance>,
|
|
40
40
|
...AnimatedProps<Props>
|
|
41
41
|
);
|
|
42
42
|
|
|
@@ -45,29 +45,41 @@ export type StrictAnimatedComponentType<
|
|
|
45
45
|
+Instance = mixed,
|
|
46
46
|
> = component(ref: React.RefSetter<Instance>, ...StrictAnimatedProps<Props>);
|
|
47
47
|
|
|
48
|
-
export default function createAnimatedComponent<
|
|
49
|
-
|
|
50
|
-
|
|
48
|
+
export default function createAnimatedComponent<
|
|
49
|
+
TInstance: React.ComponentType<any>,
|
|
50
|
+
>(
|
|
51
|
+
Component: TInstance,
|
|
52
|
+
): AnimatedComponentType<
|
|
53
|
+
$ReadOnly<React.ElementProps<TInstance>>,
|
|
54
|
+
React.ElementRef<TInstance>,
|
|
55
|
+
> {
|
|
51
56
|
return unstable_createAnimatedComponentWithAllowlist(Component, null);
|
|
52
57
|
}
|
|
53
58
|
|
|
54
59
|
export function unstable_createAnimatedComponentWithAllowlist<
|
|
55
60
|
TProps: {...},
|
|
56
|
-
TInstance
|
|
61
|
+
TInstance: React.ComponentType<TProps>,
|
|
57
62
|
>(
|
|
58
|
-
Component:
|
|
63
|
+
Component: TInstance,
|
|
59
64
|
allowlist: ?AnimatedPropsAllowlist,
|
|
60
|
-
): StrictAnimatedComponentType<TProps, TInstance
|
|
65
|
+
): StrictAnimatedComponentType<TProps, React.ElementRef<TInstance>> {
|
|
61
66
|
const useAnimatedProps = createAnimatedPropsHook(allowlist);
|
|
62
67
|
|
|
63
|
-
const AnimatedComponent
|
|
68
|
+
const AnimatedComponent: StrictAnimatedComponentType<
|
|
69
|
+
TProps,
|
|
70
|
+
React.ElementRef<TInstance>,
|
|
71
|
+
> = React.forwardRef<
|
|
64
72
|
StrictAnimatedProps<TProps>,
|
|
65
|
-
TInstance
|
|
73
|
+
React.ElementRef<TInstance>,
|
|
66
74
|
>((props, forwardedRef) => {
|
|
67
|
-
const [reducedProps, callbackRef] = useAnimatedProps<
|
|
68
|
-
|
|
75
|
+
const [reducedProps, callbackRef] = useAnimatedProps<
|
|
76
|
+
TProps,
|
|
77
|
+
React.ElementRef<TInstance>,
|
|
78
|
+
>(props);
|
|
79
|
+
const ref = useMergeRefs<React.ElementRef<TInstance>>(
|
|
80
|
+
callbackRef,
|
|
81
|
+
forwardedRef,
|
|
69
82
|
);
|
|
70
|
-
const ref = useMergeRefs<TInstance>(callbackRef, forwardedRef);
|
|
71
83
|
|
|
72
84
|
// Some components require explicit passthrough values for animation
|
|
73
85
|
// to work properly. For example, if an animated component is
|
|
@@ -28,7 +28,7 @@ let _assertNativeAnimatedModule: ?() => void = () => {
|
|
|
28
28
|
};
|
|
29
29
|
|
|
30
30
|
export default class AnimatedNode {
|
|
31
|
-
#listeners: Map<string, ValueListenerCallback
|
|
31
|
+
#listeners: Map<string, ValueListenerCallback>;
|
|
32
32
|
|
|
33
33
|
_platformConfig: ?PlatformConfig = undefined;
|
|
34
34
|
|
|
@@ -38,6 +38,7 @@ export default class AnimatedNode {
|
|
|
38
38
|
...
|
|
39
39
|
}>,
|
|
40
40
|
) {
|
|
41
|
+
this.#listeners = new Map();
|
|
41
42
|
if (__DEV__) {
|
|
42
43
|
this.__debugID = config?.debugID;
|
|
43
44
|
}
|
|
@@ -75,7 +75,7 @@ function createAnimatedProps(
|
|
|
75
75
|
}
|
|
76
76
|
|
|
77
77
|
export default class AnimatedProps extends AnimatedNode {
|
|
78
|
-
#animatedView: any
|
|
78
|
+
#animatedView: any;
|
|
79
79
|
#callback: () => void;
|
|
80
80
|
#nodeKeys: $ReadOnlyArray<string>;
|
|
81
81
|
#nodes: $ReadOnlyArray<AnimatedNode>;
|
|
@@ -89,6 +89,7 @@ export default class AnimatedProps extends AnimatedNode {
|
|
|
89
89
|
) {
|
|
90
90
|
super(config);
|
|
91
91
|
const [nodeKeys, nodes, props] = createAnimatedProps(inputProps, allowlist);
|
|
92
|
+
this.#animatedView = null;
|
|
92
93
|
this.#nodeKeys = nodeKeys;
|
|
93
94
|
this.#nodes = nodes;
|
|
94
95
|
this.#props = props;
|
|
@@ -140,6 +141,22 @@ export default class AnimatedProps extends AnimatedNode {
|
|
|
140
141
|
return props;
|
|
141
142
|
}
|
|
142
143
|
|
|
144
|
+
__getNativeAnimatedEventTuples(): $ReadOnlyArray<[string, AnimatedEvent]> {
|
|
145
|
+
const tuples = [];
|
|
146
|
+
|
|
147
|
+
const keys = Object.keys(this.#props);
|
|
148
|
+
for (let ii = 0, length = keys.length; ii < length; ii++) {
|
|
149
|
+
const key = keys[ii];
|
|
150
|
+
const value = this.#props[key];
|
|
151
|
+
|
|
152
|
+
if (value instanceof AnimatedEvent && value.__isNative) {
|
|
153
|
+
tuples.push([key, value]);
|
|
154
|
+
}
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
return tuples;
|
|
158
|
+
}
|
|
159
|
+
|
|
143
160
|
__getAnimatedValue(): Object {
|
|
144
161
|
const props: {[string]: mixed} = {};
|
|
145
162
|
|
|
@@ -85,8 +85,8 @@ function _executeAsAnimatedBatch(id: string, operation: () => void) {
|
|
|
85
85
|
* See https://reactnative.dev/docs/animatedvalue
|
|
86
86
|
*/
|
|
87
87
|
export default class AnimatedValue extends AnimatedWithChildren {
|
|
88
|
-
#listenerCount: number
|
|
89
|
-
#updateSubscription: ?EventSubscription
|
|
88
|
+
#listenerCount: number;
|
|
89
|
+
#updateSubscription: ?EventSubscription;
|
|
90
90
|
|
|
91
91
|
_value: number;
|
|
92
92
|
_startingValue: number;
|
|
@@ -99,6 +99,10 @@ export default class AnimatedValue extends AnimatedWithChildren {
|
|
|
99
99
|
if (typeof value !== 'number') {
|
|
100
100
|
throw new Error('AnimatedValue: Attempting to set value to undefined');
|
|
101
101
|
}
|
|
102
|
+
|
|
103
|
+
this.#listenerCount = 0;
|
|
104
|
+
this.#updateSubscription = null;
|
|
105
|
+
|
|
102
106
|
this._startingValue = this._value = value;
|
|
103
107
|
this._offset = 0;
|
|
104
108
|
this._animation = null;
|
package/Libraries/Blob/URL.js
CHANGED
|
@@ -107,15 +107,21 @@ export class URL {
|
|
|
107
107
|
}
|
|
108
108
|
|
|
109
109
|
get hash(): string {
|
|
110
|
-
|
|
110
|
+
const hashMatch = this._url.match(/#([^/]*)/);
|
|
111
|
+
return hashMatch ? `#${hashMatch[1]}` : '';
|
|
111
112
|
}
|
|
112
113
|
|
|
113
114
|
get host(): string {
|
|
114
|
-
|
|
115
|
+
const hostMatch = this._url.match(/^https?:\/\/(?:[^@]+@)?([^:/?#]+)/);
|
|
116
|
+
const portMatch = this._url.match(/:(\d+)(?=[/?#]|$)/);
|
|
117
|
+
return hostMatch
|
|
118
|
+
? hostMatch[1] + (portMatch ? `:${portMatch[1]}` : '')
|
|
119
|
+
: '';
|
|
115
120
|
}
|
|
116
121
|
|
|
117
122
|
get hostname(): string {
|
|
118
|
-
|
|
123
|
+
const hostnameMatch = this._url.match(/^https?:\/\/(?:[^@]+@)?([^:/?#]+)/);
|
|
124
|
+
return hostnameMatch ? hostnameMatch[1] : '';
|
|
119
125
|
}
|
|
120
126
|
|
|
121
127
|
get href(): string {
|
|
@@ -123,27 +129,33 @@ export class URL {
|
|
|
123
129
|
}
|
|
124
130
|
|
|
125
131
|
get origin(): string {
|
|
126
|
-
|
|
132
|
+
const matches = this._url.match(/^(https?:\/\/[^/]+)/);
|
|
133
|
+
return matches ? matches[1] : '';
|
|
127
134
|
}
|
|
128
135
|
|
|
129
136
|
get password(): string {
|
|
130
|
-
|
|
137
|
+
const passwordMatch = this._url.match(/https?:\/\/.*:(.*)@/);
|
|
138
|
+
return passwordMatch ? passwordMatch[1] : '';
|
|
131
139
|
}
|
|
132
140
|
|
|
133
141
|
get pathname(): string {
|
|
134
|
-
|
|
142
|
+
const pathMatch = this._url.match(/https?:\/\/[^/]+(\/[^?#]*)?/);
|
|
143
|
+
return pathMatch ? pathMatch[1] || '/' : '/';
|
|
135
144
|
}
|
|
136
145
|
|
|
137
146
|
get port(): string {
|
|
138
|
-
|
|
147
|
+
const portMatch = this._url.match(/:(\d+)(?=[/?#]|$)/);
|
|
148
|
+
return portMatch ? portMatch[1] : '';
|
|
139
149
|
}
|
|
140
150
|
|
|
141
151
|
get protocol(): string {
|
|
142
|
-
|
|
152
|
+
const protocolMatch = this._url.match(/^([a-zA-Z][a-zA-Z\d+\-.]*):/);
|
|
153
|
+
return protocolMatch ? protocolMatch[1] + ':' : '';
|
|
143
154
|
}
|
|
144
155
|
|
|
145
156
|
get search(): string {
|
|
146
|
-
|
|
157
|
+
const searchMatch = this._url.match(/\?([^#]*)/);
|
|
158
|
+
return searchMatch ? `?${searchMatch[1]}` : '';
|
|
147
159
|
}
|
|
148
160
|
|
|
149
161
|
get searchParams(): URLSearchParams {
|
|
@@ -168,6 +180,7 @@ export class URL {
|
|
|
168
180
|
}
|
|
169
181
|
|
|
170
182
|
get username(): string {
|
|
171
|
-
|
|
183
|
+
const usernameMatch = this._url.match(/^https?:\/\/([^:@]+)(?::[^@]*)?@/);
|
|
184
|
+
return usernameMatch ? usernameMatch[1] : '';
|
|
172
185
|
}
|
|
173
186
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
+
import React from 'react';
|
|
1
2
|
export declare const title = "TextInput";
|
|
2
3
|
export declare const displayName = "TextInput";
|
|
3
4
|
export declare const description = "TextInput Examples and Tests";
|
|
4
5
|
export declare const examples: {
|
|
5
6
|
title: string;
|
|
6
7
|
description: string;
|
|
7
|
-
render(): JSX.Element;
|
|
8
|
+
render(): React.JSX.Element;
|
|
8
9
|
}[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"TextInputTest.js","sourceRoot":"","sources":["../../../../src-win/Libraries/Components/TextInput/Tests/TextInputTest.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AACb,kDAAyB;AACz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AG,yBAAU,CAAC,MAAM,CAAC;IAC/B,KAAK,EAAE;QACL,MAAM,EAAE,EAAE;KACX;IACD,IAAI,EAAE;QACJ,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,EAAE;KACX;IACD,KAAK,EAAE;QACL,KAAK,EAAE,OAAO;QACd,MAAM,EAAE,EAAE;KACX;IACD,UAAU,EAAE;QACV,KAAK,EAAE,QAAQ;QACf,QAAQ,EAAE,EAAE;QACZ,SAAS,EAAE,QAAQ;QACnB,UAAU,EAAE,MAAM;QAClB,UAAU,EAAE,iBAAiB;QAC7B,MAAM,EAAE,GAAG;KACZ;CACF,CAAC,CAAC","sourcesContent":["'use strict';\nimport React from 'react'\nimport { StyleSheet, Text, TextInput, View } from 'react-native';\n\n// Disabling no-jsx-lambda so functional components are more convenient to use\n\nconst AutoFocusingTextInputTest: React.FC<{}> = () => {\n return (\n <View>\n <Text>This TextInput auto focuses</Text>\n <TextInput\n autoFocus\n maxLength={140}\n multiline\n style={styles.input}\n />\n </View>\n );\n};\n\nconst PlaceholderTextInputTest: React.FC<{}> = () => {\n return (\n <View>\n <Text>This TextInput demonstrates placeholders</Text>\n <TextInput\n maxLength={140}\n multiline\n placeholder=\"I am a blue placeholder, type in me for something magical\"\n placeholderTextColor=\"blue\"\n style={styles.green}\n />\n </View>\n );\n};\n\nconst ControllingTextInputTest: React.FC<{}> = () => {\n const [value, setValue] = React.useState('');\n\n return (\n <View>\n <Text>This TextInput inserts spaces between characters</Text>\n <TextInput\n multiline\n onChangeText={(text) => setValue(text.endsWith(' ') ? value : (text + ' '))}\n style={styles.blue}\n value={value}\n />\n </View>\n );\n};\n\nconst BlurringAndFocusingTextInputTest: React.FC<{}> = () => {\n const [isFocused, setIsFocused] = React.useState(false);\n return (\n <View>\n <Text>This TextInput is currently focused: + {isFocused ? 'true' : 'false'}</Text>\n <TextInput\n multiline\n onBlur={() => setIsFocused(false)}\n onFocus={() => setIsFocused(true)}\n style={styles.input}\n />\n </View>\n );\n};\n\nconst LayoutListeningTextInputTest: React.FC<{}> = () => {\n const [eventCounter, setEventCounter] = React.useState(0);\n\n return (\n <View>\n <Text>The number of onContentSizeChanges is listed here + {eventCounter}</Text>\n <TextInput\n multiline\n onContentSizeChange={() => setEventCounter(eventCounter + 1)}\n style={styles.input}\n />\n </View>\n );\n};\n\nconst KeyPressListeningTextInputTest: React.FC<{}> = () => {\n const [value, setValue] = React.useState('');\n\n return (\n <View>\n <Text>This TextInput uses onKeyPress to maintain state: it is slow</Text>\n <TextInput\n multiline\n onKeyPress={(e) => setValue(value + e.nativeEvent.key)}\n style={styles.input}\n value={value}\n />\n </View>\n );\n};\n\nconst StyleTextInputTest: React.FC<{}> = () => {\n return (\n <View>\n <Text>This TextInput is styled differently</Text>\n <TextInput\n multiline\n style={styles.superInput}\n />\n </View>\n );\n};\n\nexport const title = 'TextInput';\nexport const displayName = 'TextInput';\nexport const description = 'TextInput Examples and Tests';\nexport const examples = [\n {\n title: 'Autofocus Example',\n description: 'autoFocus in action',\n render()
|
|
1
|
+
{"version":3,"file":"TextInputTest.js","sourceRoot":"","sources":["../../../../src-win/Libraries/Components/TextInput/Tests/TextInputTest.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;;;;;AACb,kDAAyB;AACzB,+CAAiE;AAEjE,8EAA8E;AAE9E,MAAM,yBAAyB,GAAiB,GAAG,EAAE;IACnD,OAAO,CACL,8BAAC,mBAAI;QACH,8BAAC,mBAAI,sCAAmC;QACxC,8BAAC,wBAAS,IACR,SAAS,QACT,SAAS,EAAE,GAAG,EACd,SAAS,QACT,KAAK,EAAE,MAAM,CAAC,KAAK,GACnB,CACG,CACR,CAAC;AACJ,CAAC,CAAC;AAEF,MAAM,wBAAwB,GAAiB,GAAG,EAAE;IAClD,OAAO,CACL,8BAAC,mBAAI;QACH,8BAAC,mBAAI,mDAAgD;QACrD,8BAAC,wBAAS,IACR,SAAS,EAAE,GAAG,EACd,SAAS,QACT,WAAW,EAAC,2DAA2D,EACvE,oBAAo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 'react-native';\n\n// Disabling no-jsx-lambda so functional components are more convenient to use\n\nconst AutoFocusingTextInputTest: React.FC<{}> = () => {\n return (\n <View>\n <Text>This TextInput auto focuses</Text>\n <TextInput\n autoFocus\n maxLength={140}\n multiline\n style={styles.input}\n />\n </View>\n );\n};\n\nconst PlaceholderTextInputTest: React.FC<{}> = () => {\n return (\n <View>\n <Text>This TextInput demonstrates placeholders</Text>\n <TextInput\n maxLength={140}\n multiline\n placeholder=\"I am a blue placeholder, type in me for something magical\"\n placeholderTextColor=\"blue\"\n style={styles.green}\n />\n </View>\n );\n};\n\nconst ControllingTextInputTest: React.FC<{}> = () => {\n const [value, setValue] = React.useState('');\n\n return (\n <View>\n <Text>This TextInput inserts spaces between characters</Text>\n <TextInput\n multiline\n onChangeText={(text) => setValue(text.endsWith(' ') ? value : (text + ' '))}\n style={styles.blue}\n value={value}\n />\n </View>\n );\n};\n\nconst BlurringAndFocusingTextInputTest: React.FC<{}> = () => {\n const [isFocused, setIsFocused] = React.useState(false);\n return (\n <View>\n <Text>This TextInput is currently focused: + {isFocused ? 'true' : 'false'}</Text>\n <TextInput\n multiline\n onBlur={() => setIsFocused(false)}\n onFocus={() => setIsFocused(true)}\n style={styles.input}\n />\n </View>\n );\n};\n\nconst LayoutListeningTextInputTest: React.FC<{}> = () => {\n const [eventCounter, setEventCounter] = React.useState(0);\n\n return (\n <View>\n <Text>The number of onContentSizeChanges is listed here + {eventCounter}</Text>\n <TextInput\n multiline\n onContentSizeChange={() => setEventCounter(eventCounter + 1)}\n style={styles.input}\n />\n </View>\n );\n};\n\nconst KeyPressListeningTextInputTest: React.FC<{}> = () => {\n const [value, setValue] = React.useState('');\n\n return (\n <View>\n <Text>This TextInput uses onKeyPress to maintain state: it is slow</Text>\n <TextInput\n multiline\n onKeyPress={(e) => setValue(value + e.nativeEvent.key)}\n style={styles.input}\n value={value}\n />\n </View>\n );\n};\n\nconst StyleTextInputTest: React.FC<{}> = () => {\n return (\n <View>\n <Text>This TextInput is styled differently</Text>\n <TextInput\n multiline\n style={styles.superInput}\n />\n </View>\n );\n};\n\nexport const title = 'TextInput';\nexport const displayName = 'TextInput';\nexport const description = 'TextInput Examples and Tests';\nexport const examples = [\n {\n title: 'Autofocus Example',\n description: 'autoFocus in action',\n render() {\n return (<AutoFocusingTextInputTest />);\n },\n },\n {\n title: 'Placeholders Example',\n description: 'placeholder in action',\n render() {\n return (<PlaceholderTextInputTest />);\n },\n },\n {\n title: 'Controlled Example',\n description: 'Controlling inputs in action',\n render() {\n return (<ControllingTextInputTest />);\n },\n },\n {\n title: 'Focus and Blur Example',\n description: 'onFocus/onBlur in action',\n render() {\n return (<BlurringAndFocusingTextInputTest />);\n },\n },\n {\n title: 'ContentSizeChange Example',\n description: 'onContentSizeChange in action',\n render() {\n return (<LayoutListeningTextInputTest />);\n },\n },\n {\n title: 'Control via onKeyPress Example',\n description: 'onKeyPress in action',\n render() {\n return (<KeyPressListeningTextInputTest />);\n },\n },\n {\n title: 'Super Styling Example',\n description: 'Styling in action',\n render() {\n return (<StyleTextInputTest />);\n },\n },\n ];\n\nconst styles = StyleSheet.create({\n input: {\n height: 20,\n },\n blue: {\n color: 'blue',\n height: 20,\n },\n green: {\n color: 'green',\n height: 20,\n },\n superInput: {\n color: 'purple',\n fontSize: 24,\n fontStyle: 'italic',\n fontWeight: 'bold',\n fontFamily: 'times-new-roman',\n height: 100,\n },\n});\n"]}
|
|
@@ -930,6 +930,12 @@ export interface TextInputProps
|
|
|
930
930
|
*/
|
|
931
931
|
inputAccessoryViewID?: string | undefined;
|
|
932
932
|
|
|
933
|
+
/**
|
|
934
|
+
* An optional label that overrides the default input accessory view button label.
|
|
935
|
+
* @platform ios
|
|
936
|
+
*/
|
|
937
|
+
inputAccessoryViewButtonLabel?: string | undefined;
|
|
938
|
+
|
|
933
939
|
/**
|
|
934
940
|
* The value to show for the text input. TextInput is a controlled component,
|
|
935
941
|
* which means the native value will be forced to match this value prop if provided.
|
|
@@ -88,12 +88,30 @@ export type TextInputKeyPressEventData = $ReadOnly<{
|
|
|
88
88
|
export type TextInputKeyPressEvent =
|
|
89
89
|
NativeSyntheticEvent<TextInputKeyPressEventData>;
|
|
90
90
|
|
|
91
|
+
/**
|
|
92
|
+
* @see TextInputProps.onEndEditing
|
|
93
|
+
*/
|
|
91
94
|
export type TextInputEndEditingEventData = $ReadOnly<{
|
|
92
95
|
...TargetEvent,
|
|
93
96
|
eventCount: number,
|
|
94
97
|
text: string,
|
|
95
98
|
}>;
|
|
96
99
|
|
|
100
|
+
export type TextInputEndEditingEvent =
|
|
101
|
+
NativeSyntheticEvent<TextInputEndEditingEventData>;
|
|
102
|
+
|
|
103
|
+
/**
|
|
104
|
+
* @see TextInputProps.onSubmitEditing
|
|
105
|
+
*/
|
|
106
|
+
export type TextInputSubmitEditingEventData = $ReadOnly<{
|
|
107
|
+
...TargetEvent,
|
|
108
|
+
eventCount: number,
|
|
109
|
+
text: string,
|
|
110
|
+
}>;
|
|
111
|
+
|
|
112
|
+
export type TextInputSubmitEditingEvent =
|
|
113
|
+
NativeSyntheticEvent<TextInputSubmitEditingEventData>;
|
|
114
|
+
|
|
97
115
|
export type TextInputEditingEvent =
|
|
98
116
|
NativeSyntheticEvent<TextInputEndEditingEventData>;
|
|
99
117
|
|
|
@@ -389,6 +407,21 @@ export type TextInputAndroidProps = $ReadOnly<{
|
|
|
389
407
|
*/
|
|
390
408
|
disableFullscreenUI?: ?boolean,
|
|
391
409
|
|
|
410
|
+
/**
|
|
411
|
+
* Determines whether the individual fields in your app should be included in a
|
|
412
|
+
* view structure for autofill purposes on Android API Level 26+. Defaults to auto.
|
|
413
|
+
* To disable auto complete, use `off`.
|
|
414
|
+
*
|
|
415
|
+
* *Android Only*
|
|
416
|
+
*
|
|
417
|
+
* The following values work on Android only:
|
|
418
|
+
*
|
|
419
|
+
* - `auto` - let Android decide
|
|
420
|
+
* - `no` - not important for autofill
|
|
421
|
+
* - `noExcludeDescendants` - this view and its children aren't important for autofill
|
|
422
|
+
* - `yes` - is important for autofill
|
|
423
|
+
* - `yesExcludeDescendants` - this view is important for autofill but its children aren't
|
|
424
|
+
*/
|
|
392
425
|
importantForAutofill?: ?(
|
|
393
426
|
| 'auto'
|
|
394
427
|
| 'no'
|
|
@@ -783,7 +816,7 @@ export type TextInputProps = $ReadOnly<{
|
|
|
783
816
|
/**
|
|
784
817
|
* Callback that is called when text input ends.
|
|
785
818
|
*/
|
|
786
|
-
onEndEditing?: ?(e:
|
|
819
|
+
onEndEditing?: ?(e: TextInputEndEditingEvent) => mixed,
|
|
787
820
|
|
|
788
821
|
/**
|
|
789
822
|
* Callback that is called when the text input is focused.
|
|
@@ -840,7 +873,7 @@ export type TextInputProps = $ReadOnly<{
|
|
|
840
873
|
* Callback that is called when the text input's submit button is pressed.
|
|
841
874
|
* Invalid if `multiline={true}` is specified.
|
|
842
875
|
*/
|
|
843
|
-
onSubmitEditing?: ?(e:
|
|
876
|
+
onSubmitEditing?: ?(e: TextInputSubmitEditingEvent) => mixed,
|
|
844
877
|
|
|
845
878
|
/**
|
|
846
879
|
* Invoked on content scroll with `{ nativeEvent: { contentOffset: { x, y } } }`.
|
|
@@ -1109,7 +1142,7 @@ export interface TextInputInstance extends HostInstance {
|
|
|
1109
1142
|
*
|
|
1110
1143
|
*/
|
|
1111
1144
|
type InternalTextInput = component(
|
|
1112
|
-
ref
|
|
1145
|
+
ref?: React.RefSetter<TextInputInstance>,
|
|
1113
1146
|
...TextInputProps
|
|
1114
1147
|
);
|
|
1115
1148
|
|