@office-iss/react-native-win32 0.66.1 → 0.66.5
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 +7 -0
- package/CHANGELOG.json +61 -1
- package/CHANGELOG.md +36 -4
- package/Libraries/Components/Pressable/Pressable.win32.js +384 -0
- package/Libraries/Components/View/ReactNativeViewViewConfig.win32.js +1 -0
- package/Libraries/Components/View/Tests/ViewWin32Test.js +44 -2
- package/Libraries/Components/View/Tests/ViewWin32Test.js.map +1 -1
- package/Libraries/Components/View/View.win32.js +58 -2
- package/Libraries/Components/View/ViewPropTypes.win32.js +546 -0
- package/Libraries/Components/View/ViewWin32.Props.d.ts +1 -0
- package/Libraries/Components/View/ViewWin32.Props.js.map +1 -1
- package/Libraries/Pressability/HoverState.win32.js +60 -0
- package/Libraries/Pressability/Pressability.win32.js +962 -0
- package/Libraries/Text/Text.win32.js +214 -0
- package/Libraries/Text/TextNativeComponent.win32.js +17 -2
- package/Libraries/Types/CoreEventTypes.win32.js +191 -0
- package/overrides.json +43 -1
- package/package.json +3 -3
- package/src/Libraries/Components/View/Tests/ViewWin32Test.tsx +64 -0
- package/src/Libraries/Components/View/ViewWin32.Props.ts +1 -0
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict-local
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import DeprecatedTextPropTypes from '../DeprecatedPropTypes/DeprecatedTextPropTypes';
|
|
12
|
+
import * as PressabilityDebug from '../Pressability/PressabilityDebug';
|
|
13
|
+
import usePressability from '../Pressability/usePressability';
|
|
14
|
+
import StyleSheet from '../StyleSheet/StyleSheet';
|
|
15
|
+
import processColor from '../StyleSheet/processColor';
|
|
16
|
+
import TextAncestor from './TextAncestor';
|
|
17
|
+
import {NativeText, NativeVirtualText} from './TextNativeComponent';
|
|
18
|
+
import {type TextProps} from './TextProps';
|
|
19
|
+
import * as React from 'react';
|
|
20
|
+
import {useContext, useMemo, useState} from 'react';
|
|
21
|
+
import invariant from 'invariant';
|
|
22
|
+
|
|
23
|
+
/**
|
|
24
|
+
* Text is the fundamental component for displaying text.
|
|
25
|
+
*
|
|
26
|
+
* @see https://reactnative.dev/docs/text.html
|
|
27
|
+
*/
|
|
28
|
+
const Text: React.AbstractComponent<
|
|
29
|
+
TextProps,
|
|
30
|
+
React.ElementRef<typeof NativeText | typeof NativeVirtualText>,
|
|
31
|
+
> = React.forwardRef((props: TextProps, forwardedRef) => {
|
|
32
|
+
const {
|
|
33
|
+
accessible,
|
|
34
|
+
allowFontScaling,
|
|
35
|
+
ellipsizeMode,
|
|
36
|
+
onLongPress,
|
|
37
|
+
onPress,
|
|
38
|
+
onPressIn,
|
|
39
|
+
onPressOut,
|
|
40
|
+
onResponderGrant,
|
|
41
|
+
onResponderMove,
|
|
42
|
+
onResponderRelease,
|
|
43
|
+
onResponderTerminate,
|
|
44
|
+
onResponderTerminationRequest,
|
|
45
|
+
onStartShouldSetResponder,
|
|
46
|
+
pressRetentionOffset,
|
|
47
|
+
suppressHighlighting,
|
|
48
|
+
...restProps
|
|
49
|
+
} = props;
|
|
50
|
+
|
|
51
|
+
const [isHighlighted, setHighlighted] = useState(false);
|
|
52
|
+
|
|
53
|
+
const isPressable =
|
|
54
|
+
(onPress != null ||
|
|
55
|
+
onLongPress != null ||
|
|
56
|
+
onStartShouldSetResponder != null) &&
|
|
57
|
+
restProps.disabled !== true;
|
|
58
|
+
|
|
59
|
+
const initialized = useLazyInitialization(isPressable);
|
|
60
|
+
const config = useMemo(
|
|
61
|
+
() =>
|
|
62
|
+
initialized
|
|
63
|
+
? {
|
|
64
|
+
disabled: !isPressable,
|
|
65
|
+
pressRectOffset: pressRetentionOffset,
|
|
66
|
+
onLongPress,
|
|
67
|
+
onPress,
|
|
68
|
+
onPressIn(event) {
|
|
69
|
+
setHighlighted(!suppressHighlighting);
|
|
70
|
+
onPressIn?.(event);
|
|
71
|
+
},
|
|
72
|
+
onPressOut(event) {
|
|
73
|
+
setHighlighted(false);
|
|
74
|
+
onPressOut?.(event);
|
|
75
|
+
},
|
|
76
|
+
onResponderTerminationRequest_DEPRECATED: onResponderTerminationRequest,
|
|
77
|
+
onStartShouldSetResponder_DEPRECATED: onStartShouldSetResponder,
|
|
78
|
+
}
|
|
79
|
+
: null,
|
|
80
|
+
[
|
|
81
|
+
initialized,
|
|
82
|
+
isPressable,
|
|
83
|
+
pressRetentionOffset,
|
|
84
|
+
onLongPress,
|
|
85
|
+
onPress,
|
|
86
|
+
onPressIn,
|
|
87
|
+
onPressOut,
|
|
88
|
+
onResponderTerminationRequest,
|
|
89
|
+
onStartShouldSetResponder,
|
|
90
|
+
suppressHighlighting,
|
|
91
|
+
],
|
|
92
|
+
);
|
|
93
|
+
|
|
94
|
+
const eventHandlers = usePressability(config);
|
|
95
|
+
const eventHandlersForText = useMemo(
|
|
96
|
+
() =>
|
|
97
|
+
eventHandlers == null
|
|
98
|
+
? null
|
|
99
|
+
: {
|
|
100
|
+
onResponderGrant(event) {
|
|
101
|
+
eventHandlers.onResponderGrant(event);
|
|
102
|
+
if (onResponderGrant != null) {
|
|
103
|
+
onResponderGrant(event);
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
onResponderMove(event) {
|
|
107
|
+
eventHandlers.onResponderMove(event);
|
|
108
|
+
if (onResponderMove != null) {
|
|
109
|
+
onResponderMove(event);
|
|
110
|
+
}
|
|
111
|
+
},
|
|
112
|
+
onResponderRelease(event) {
|
|
113
|
+
eventHandlers.onResponderRelease(event);
|
|
114
|
+
if (onResponderRelease != null) {
|
|
115
|
+
onResponderRelease(event);
|
|
116
|
+
}
|
|
117
|
+
},
|
|
118
|
+
onResponderTerminate(event) {
|
|
119
|
+
eventHandlers.onResponderTerminate(event);
|
|
120
|
+
if (onResponderTerminate != null) {
|
|
121
|
+
onResponderTerminate(event);
|
|
122
|
+
}
|
|
123
|
+
},
|
|
124
|
+
onResponderTerminationRequest:
|
|
125
|
+
eventHandlers.onResponderTerminationRequest,
|
|
126
|
+
onStartShouldSetResponder: eventHandlers.onStartShouldSetResponder,
|
|
127
|
+
},
|
|
128
|
+
[
|
|
129
|
+
eventHandlers,
|
|
130
|
+
onResponderGrant,
|
|
131
|
+
onResponderMove,
|
|
132
|
+
onResponderRelease,
|
|
133
|
+
onResponderTerminate,
|
|
134
|
+
],
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
// TODO: Move this processing to the view configuration.
|
|
138
|
+
const selectionColor =
|
|
139
|
+
restProps.selectionColor == null
|
|
140
|
+
? null
|
|
141
|
+
: processColor(restProps.selectionColor);
|
|
142
|
+
|
|
143
|
+
let style = restProps.style;
|
|
144
|
+
if (__DEV__) {
|
|
145
|
+
if (PressabilityDebug.isEnabled() && onPress != null) {
|
|
146
|
+
style = StyleSheet.compose(restProps.style, {
|
|
147
|
+
color: 'magenta',
|
|
148
|
+
});
|
|
149
|
+
}
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
let numberOfLines = restProps.numberOfLines;
|
|
153
|
+
if (numberOfLines != null && !(numberOfLines >= 0)) {
|
|
154
|
+
console.error(
|
|
155
|
+
`'numberOfLines' in <Text> must be a non-negative number, received: ${numberOfLines}. The value will be set to 0.`,
|
|
156
|
+
);
|
|
157
|
+
numberOfLines = 0;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
const hasTextAncestor = useContext(TextAncestor);
|
|
161
|
+
|
|
162
|
+
return hasTextAncestor ? (
|
|
163
|
+
<NativeVirtualText
|
|
164
|
+
{...restProps}
|
|
165
|
+
{...eventHandlersForText}
|
|
166
|
+
isHighlighted={isHighlighted}
|
|
167
|
+
isPressable={isPressable} // This was added upstream in https://github.com/facebook/react-native/commit/f3bf2e4f51897f1bb71e37002c288ebf3b23cf78
|
|
168
|
+
numberOfLines={numberOfLines}
|
|
169
|
+
selectionColor={selectionColor}
|
|
170
|
+
style={style}
|
|
171
|
+
ref={forwardedRef}
|
|
172
|
+
/>
|
|
173
|
+
) : (
|
|
174
|
+
<TextAncestor.Provider value={true}>
|
|
175
|
+
<NativeText
|
|
176
|
+
{...restProps}
|
|
177
|
+
{...eventHandlersForText}
|
|
178
|
+
accessible={accessible !== false}
|
|
179
|
+
allowFontScaling={allowFontScaling !== false}
|
|
180
|
+
ellipsizeMode={ellipsizeMode ?? 'tail'}
|
|
181
|
+
isHighlighted={isHighlighted}
|
|
182
|
+
isPressable={isPressable} // [Win32] - We use this to optimize text hit testing
|
|
183
|
+
numberOfLines={numberOfLines}
|
|
184
|
+
selectionColor={selectionColor}
|
|
185
|
+
style={style}
|
|
186
|
+
ref={forwardedRef}
|
|
187
|
+
/>
|
|
188
|
+
</TextAncestor.Provider>
|
|
189
|
+
);
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
Text.displayName = 'Text';
|
|
193
|
+
|
|
194
|
+
// TODO: Delete this.
|
|
195
|
+
Text.propTypes = DeprecatedTextPropTypes;
|
|
196
|
+
|
|
197
|
+
/**
|
|
198
|
+
* Returns false until the first time `newValue` is true, after which this will
|
|
199
|
+
* always return true. This is necessary to lazily initialize `Pressability` so
|
|
200
|
+
* we do not eagerly create one for every pressable `Text` component.
|
|
201
|
+
*/
|
|
202
|
+
function useLazyInitialization(newValue: boolean): boolean {
|
|
203
|
+
const [oldValue, setValue] = useState(newValue);
|
|
204
|
+
if (!oldValue && newValue) {
|
|
205
|
+
setValue(newValue);
|
|
206
|
+
}
|
|
207
|
+
return oldValue;
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
// $FlowFixMe[incompatible-cast] - No good way to type a React.AbstractComponent with statics.
|
|
211
|
+
module.exports = (Text: typeof Text &
|
|
212
|
+
$ReadOnly<{
|
|
213
|
+
propTypes: typeof DeprecatedTextPropTypes,
|
|
214
|
+
}>);
|
|
@@ -1,3 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
1
11
|
import ReactNativeViewAttributes from '../Components/View/ReactNativeViewAttributes';
|
|
2
12
|
import UIManager from '../ReactNative/UIManager';
|
|
3
13
|
import {type HostComponent} from '../Renderer/shims/ReactNativeTypes';
|
|
@@ -9,6 +19,10 @@ type NativeTextProps = $ReadOnly<{
|
|
|
9
19
|
...TextProps,
|
|
10
20
|
isHighlighted?: ?boolean,
|
|
11
21
|
selectionColor?: ?ProcessedColorValue,
|
|
22
|
+
// This is only needed for platforms that optimize text hit testing, e.g.,
|
|
23
|
+
// react-native-windows. It can be used to only hit test virtual text spans
|
|
24
|
+
// that have pressable events attached to them.
|
|
25
|
+
isPressable?: ?boolean,
|
|
12
26
|
}>;
|
|
13
27
|
|
|
14
28
|
export const NativeText: HostComponent<NativeTextProps> = (createReactNativeComponentClass(
|
|
@@ -18,6 +32,7 @@ export const NativeText: HostComponent<NativeTextProps> = (createReactNativeComp
|
|
|
18
32
|
validAttributes: {
|
|
19
33
|
...ReactNativeViewAttributes.UIView,
|
|
20
34
|
isHighlighted: true,
|
|
35
|
+
isPressable: true,
|
|
21
36
|
numberOfLines: true,
|
|
22
37
|
ellipsizeMode: true,
|
|
23
38
|
allowFontScaling: true,
|
|
@@ -53,14 +68,14 @@ export const NativeText: HostComponent<NativeTextProps> = (createReactNativeComp
|
|
|
53
68
|
): any);
|
|
54
69
|
|
|
55
70
|
export const NativeVirtualText: HostComponent<NativeTextProps> =
|
|
56
|
-
!global.RN$Bridgeless &&
|
|
57
|
-
UIManager.getViewManagerConfig('RCTVirtualText') == null
|
|
71
|
+
!global.RN$Bridgeless && !UIManager.hasViewManagerConfig('RCTVirtualText')
|
|
58
72
|
? NativeText
|
|
59
73
|
: (createReactNativeComponentClass('RCTVirtualText', () => ({
|
|
60
74
|
// $FlowFixMe[incompatible-call]
|
|
61
75
|
validAttributes: {
|
|
62
76
|
...ReactNativeViewAttributes.UIView,
|
|
63
77
|
isHighlighted: true,
|
|
78
|
+
isPressable: true,
|
|
64
79
|
maxFontSizeMultiplier: true,
|
|
65
80
|
},
|
|
66
81
|
uiViewClassName: 'RCTVirtualText',
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Facebook, Inc. and its affiliates.
|
|
3
|
+
*
|
|
4
|
+
* This source code is licensed under the MIT license found in the
|
|
5
|
+
* LICENSE file in the root directory of this source tree.
|
|
6
|
+
*
|
|
7
|
+
* @flow strict
|
|
8
|
+
* @format
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import * as React from 'react';
|
|
12
|
+
import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
|
|
13
|
+
|
|
14
|
+
export type SyntheticEvent<T> = $ReadOnly<{|
|
|
15
|
+
bubbles: ?boolean,
|
|
16
|
+
cancelable: ?boolean,
|
|
17
|
+
currentTarget: number | React.ElementRef<HostComponent<mixed>>,
|
|
18
|
+
defaultPrevented: ?boolean,
|
|
19
|
+
dispatchConfig: $ReadOnly<{|
|
|
20
|
+
registrationName: string,
|
|
21
|
+
|}>,
|
|
22
|
+
eventPhase: ?number,
|
|
23
|
+
preventDefault: () => void,
|
|
24
|
+
isDefaultPrevented: () => boolean,
|
|
25
|
+
stopPropagation: () => void,
|
|
26
|
+
isPropagationStopped: () => boolean,
|
|
27
|
+
isTrusted: ?boolean,
|
|
28
|
+
nativeEvent: T,
|
|
29
|
+
persist: () => void,
|
|
30
|
+
target: ?number | React.ElementRef<HostComponent<mixed>>,
|
|
31
|
+
timeStamp: number,
|
|
32
|
+
type: ?string,
|
|
33
|
+
|}>;
|
|
34
|
+
|
|
35
|
+
export type ResponderSyntheticEvent<T> = $ReadOnly<{|
|
|
36
|
+
...SyntheticEvent<T>,
|
|
37
|
+
touchHistory: $ReadOnly<{|
|
|
38
|
+
indexOfSingleActiveTouch: number,
|
|
39
|
+
mostRecentTimeStamp: number,
|
|
40
|
+
numberActiveTouches: number,
|
|
41
|
+
touchBank: $ReadOnlyArray<
|
|
42
|
+
$ReadOnly<{|
|
|
43
|
+
touchActive: boolean,
|
|
44
|
+
startPageX: number,
|
|
45
|
+
startPageY: number,
|
|
46
|
+
startTimeStamp: number,
|
|
47
|
+
currentPageX: number,
|
|
48
|
+
currentPageY: number,
|
|
49
|
+
currentTimeStamp: number,
|
|
50
|
+
previousPageX: number,
|
|
51
|
+
previousPageY: number,
|
|
52
|
+
previousTimeStamp: number,
|
|
53
|
+
|}>,
|
|
54
|
+
>,
|
|
55
|
+
|}>,
|
|
56
|
+
|}>;
|
|
57
|
+
|
|
58
|
+
export type Layout = $ReadOnly<{|
|
|
59
|
+
x: number,
|
|
60
|
+
y: number,
|
|
61
|
+
width: number,
|
|
62
|
+
height: number,
|
|
63
|
+
|}>;
|
|
64
|
+
|
|
65
|
+
export type TextLayout = $ReadOnly<{|
|
|
66
|
+
...Layout,
|
|
67
|
+
ascender: number,
|
|
68
|
+
capHeight: number,
|
|
69
|
+
descender: number,
|
|
70
|
+
text: string,
|
|
71
|
+
xHeight: number,
|
|
72
|
+
|}>;
|
|
73
|
+
|
|
74
|
+
export type LayoutEvent = SyntheticEvent<
|
|
75
|
+
$ReadOnly<{|
|
|
76
|
+
layout: Layout,
|
|
77
|
+
|}>,
|
|
78
|
+
>;
|
|
79
|
+
|
|
80
|
+
export type TextLayoutEvent = SyntheticEvent<
|
|
81
|
+
$ReadOnly<{|
|
|
82
|
+
lines: Array<TextLayout>,
|
|
83
|
+
|}>,
|
|
84
|
+
>;
|
|
85
|
+
|
|
86
|
+
export type PressEvent = ResponderSyntheticEvent<
|
|
87
|
+
$ReadOnly<{|
|
|
88
|
+
altKey: ?boolean, // TODO(macOS)
|
|
89
|
+
button: ?number, // TODO(macOS)
|
|
90
|
+
changedTouches: $ReadOnlyArray<$PropertyType<PressEvent, 'nativeEvent'>>,
|
|
91
|
+
ctrlKey: ?boolean, // TODO(macOS)
|
|
92
|
+
force?: number,
|
|
93
|
+
identifier: number,
|
|
94
|
+
locationX: number,
|
|
95
|
+
locationY: number,
|
|
96
|
+
metaKey: ?boolean, // TODO(macOS)
|
|
97
|
+
pageX: number,
|
|
98
|
+
pageY: number,
|
|
99
|
+
shiftKey: ?boolean, // TODO(macOS)
|
|
100
|
+
target: ?number,
|
|
101
|
+
timestamp: number,
|
|
102
|
+
touches: $ReadOnlyArray<$PropertyType<PressEvent, 'nativeEvent'>>,
|
|
103
|
+
|}>,
|
|
104
|
+
>;
|
|
105
|
+
|
|
106
|
+
export type ScrollEvent = SyntheticEvent<
|
|
107
|
+
$ReadOnly<{|
|
|
108
|
+
contentInset: $ReadOnly<{|
|
|
109
|
+
bottom: number,
|
|
110
|
+
left: number,
|
|
111
|
+
right: number,
|
|
112
|
+
top: number,
|
|
113
|
+
|}>,
|
|
114
|
+
contentOffset: $ReadOnly<{|
|
|
115
|
+
y: number,
|
|
116
|
+
x: number,
|
|
117
|
+
|}>,
|
|
118
|
+
contentSize: $ReadOnly<{|
|
|
119
|
+
height: number,
|
|
120
|
+
width: number,
|
|
121
|
+
|}>,
|
|
122
|
+
layoutMeasurement: $ReadOnly<{|
|
|
123
|
+
height: number,
|
|
124
|
+
width: number,
|
|
125
|
+
|}>,
|
|
126
|
+
targetContentOffset?: $ReadOnly<{|
|
|
127
|
+
y: number,
|
|
128
|
+
x: number,
|
|
129
|
+
|}>,
|
|
130
|
+
velocity?: $ReadOnly<{|
|
|
131
|
+
y: number,
|
|
132
|
+
x: number,
|
|
133
|
+
|}>,
|
|
134
|
+
zoomScale?: number,
|
|
135
|
+
responderIgnoreScroll?: boolean,
|
|
136
|
+
key?: string, // TODO(macOS)
|
|
137
|
+
|}>,
|
|
138
|
+
>;
|
|
139
|
+
|
|
140
|
+
export type BlurEvent = SyntheticEvent<
|
|
141
|
+
$ReadOnly<{|
|
|
142
|
+
target: number,
|
|
143
|
+
|}>,
|
|
144
|
+
>;
|
|
145
|
+
|
|
146
|
+
export type FocusEvent = SyntheticEvent<
|
|
147
|
+
$ReadOnly<{|
|
|
148
|
+
target: number,
|
|
149
|
+
|}>,
|
|
150
|
+
>;
|
|
151
|
+
|
|
152
|
+
// [Windows Mouse events on Windows don't match up with the version in core
|
|
153
|
+
// introduced for react-native-web. Replace typings with our values to catch
|
|
154
|
+
// anything dependent on react-native-web specific values
|
|
155
|
+
export type MouseEvent = SyntheticEvent<
|
|
156
|
+
$ReadOnly<{|
|
|
157
|
+
target: number,
|
|
158
|
+
identifier: number,
|
|
159
|
+
pageX: number,
|
|
160
|
+
pageY: number,
|
|
161
|
+
locationX: number,
|
|
162
|
+
locationY: number,
|
|
163
|
+
timestamp: number,
|
|
164
|
+
pointerType: string,
|
|
165
|
+
force: number,
|
|
166
|
+
isLeftButton: boolean,
|
|
167
|
+
isRightButton: boolean,
|
|
168
|
+
isMiddleButton: boolean,
|
|
169
|
+
isBarrelButtonPressed: boolean,
|
|
170
|
+
isHorizontalScrollWheel: boolean,
|
|
171
|
+
isEraser: boolean,
|
|
172
|
+
shiftKey: boolean,
|
|
173
|
+
ctrlKey: boolean,
|
|
174
|
+
altKey: boolean,
|
|
175
|
+
|}>,
|
|
176
|
+
>;
|
|
177
|
+
// Windows]
|
|
178
|
+
|
|
179
|
+
// [Windows
|
|
180
|
+
export type KeyEvent = SyntheticEvent<
|
|
181
|
+
$ReadOnly<{|
|
|
182
|
+
altKey: boolean,
|
|
183
|
+
ctrlKey: boolean,
|
|
184
|
+
metaKey: boolean,
|
|
185
|
+
shiftKey: boolean,
|
|
186
|
+
key: string,
|
|
187
|
+
code: string,
|
|
188
|
+
eventPhase: number,
|
|
189
|
+
|}>,
|
|
190
|
+
>;
|
|
191
|
+
// Windows]
|
package/overrides.json
CHANGED
|
@@ -80,6 +80,13 @@
|
|
|
80
80
|
"baseHash": "0b409391c852a1001cee74a84414a13c4fe88f8b",
|
|
81
81
|
"issue": 4378
|
|
82
82
|
},
|
|
83
|
+
{
|
|
84
|
+
"type": "patch",
|
|
85
|
+
"file": "src/Libraries/Components/Pressable/Pressable.win32.js",
|
|
86
|
+
"baseFile": "Libraries/Components/Pressable/Pressable.js",
|
|
87
|
+
"baseHash": "614553aa8396b42e932f8c717ebc8b493d772d93",
|
|
88
|
+
"issue": 6240
|
|
89
|
+
},
|
|
83
90
|
{
|
|
84
91
|
"type": "copy",
|
|
85
92
|
"file": "src/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js",
|
|
@@ -191,6 +198,13 @@
|
|
|
191
198
|
"baseFile": "Libraries/Components/View/View.js",
|
|
192
199
|
"baseHash": "77bfbef8e835e4fee49311779bb039a99ae44372"
|
|
193
200
|
},
|
|
201
|
+
{
|
|
202
|
+
"type": "patch",
|
|
203
|
+
"file": "src/Libraries/Components/View/ViewPropTypes.win32.js",
|
|
204
|
+
"baseFile": "Libraries/Components/View/ViewPropTypes.js",
|
|
205
|
+
"baseHash": "2b12228aa1ab0e12844996a99ff5d38fbff689a1",
|
|
206
|
+
"issue": 6240
|
|
207
|
+
},
|
|
194
208
|
{
|
|
195
209
|
"type": "platform",
|
|
196
210
|
"file": "src/Libraries/Components/View/ViewWin32.Props.ts"
|
|
@@ -370,6 +384,20 @@
|
|
|
370
384
|
"type": "platform",
|
|
371
385
|
"file": "src/Libraries/PersonaCoin/PersonaCoinTypes.ts"
|
|
372
386
|
},
|
|
387
|
+
{
|
|
388
|
+
"type": "patch",
|
|
389
|
+
"file": "src/Libraries/Pressability/HoverState.win32.js",
|
|
390
|
+
"baseFile": "Libraries/Pressability/HoverState.js",
|
|
391
|
+
"baseHash": "2807a1cddb7c5135f63e5dd4d0706ac660f25d76",
|
|
392
|
+
"issue": 6240
|
|
393
|
+
},
|
|
394
|
+
{
|
|
395
|
+
"type": "patch",
|
|
396
|
+
"file": "src/Libraries/Pressability/Pressability.win32.js",
|
|
397
|
+
"baseFile": "Libraries/Pressability/Pressability.js",
|
|
398
|
+
"baseHash": "f0ff8ce99b09be692f6beb9231c7dec3140da02d",
|
|
399
|
+
"issue": 6240
|
|
400
|
+
},
|
|
373
401
|
{
|
|
374
402
|
"type": "platform",
|
|
375
403
|
"file": "src/Libraries/QuirkSettings/CachingNativeQuirkSettings.js"
|
|
@@ -417,12 +445,26 @@
|
|
|
417
445
|
"baseHash": "afe4fc1e9aa91d08a7a1098e3bbd3b17a73b4a65"
|
|
418
446
|
},
|
|
419
447
|
{
|
|
420
|
-
"type": "
|
|
448
|
+
"type": "patch",
|
|
449
|
+
"file": "src/Libraries/Text/Text.win32.js",
|
|
450
|
+
"baseFile": "Libraries/Text/Text.js",
|
|
451
|
+
"baseHash": "8b90eb090dcfed88a40a38bbb51cbbd1e0d9ca9e",
|
|
452
|
+
"issue": 7074
|
|
453
|
+
},
|
|
454
|
+
{
|
|
455
|
+
"type": "patch",
|
|
421
456
|
"file": "src/Libraries/Text/TextNativeComponent.win32.js",
|
|
422
457
|
"baseFile": "Libraries/Text/TextNativeComponent.js",
|
|
423
458
|
"baseHash": "1a196691fb0e9b656c348b7d42427c1c6163c9bb",
|
|
424
459
|
"issue": 7074
|
|
425
460
|
},
|
|
461
|
+
{
|
|
462
|
+
"type": "patch",
|
|
463
|
+
"file": "src/Libraries/Types/CoreEventTypes.win32.js",
|
|
464
|
+
"baseFile": "Libraries/Types/CoreEventTypes.js",
|
|
465
|
+
"baseHash": "22c50d13820ca4db6c6cf5e6563f8437d55c24af",
|
|
466
|
+
"issue": 6240
|
|
467
|
+
},
|
|
426
468
|
{
|
|
427
469
|
"type": "copy",
|
|
428
470
|
"file": "src/Libraries/Utilities/BackHandler.win32.js",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@office-iss/react-native-win32",
|
|
3
|
-
"version": "0.66.
|
|
3
|
+
"version": "0.66.5",
|
|
4
4
|
"description": "Implementation of react native on top of Office's Win32 platform.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./index.win32.js",
|
|
@@ -25,7 +25,7 @@
|
|
|
25
25
|
"@react-native-community/cli": "^6.0.0",
|
|
26
26
|
"@react-native-community/cli-platform-android": "^6.0.0",
|
|
27
27
|
"@react-native-community/cli-platform-ios": "^6.0.0",
|
|
28
|
-
"@react-native-windows/virtualized-list": "0.66.
|
|
28
|
+
"@react-native-windows/virtualized-list": "0.66.1",
|
|
29
29
|
"@react-native/assets": "1.0.0",
|
|
30
30
|
"@react-native/normalize-color": "1.0.0",
|
|
31
31
|
"@react-native/polyfills": "2.0.0",
|
|
@@ -81,7 +81,7 @@
|
|
|
81
81
|
"react-native": "^0.66.0"
|
|
82
82
|
},
|
|
83
83
|
"beachball": {
|
|
84
|
-
"defaultNpmTag": "
|
|
84
|
+
"defaultNpmTag": "v0.66-stable",
|
|
85
85
|
"disallowedChangeTypes": [
|
|
86
86
|
"major",
|
|
87
87
|
"minor",
|
|
@@ -54,6 +54,7 @@ class FocusMoverTestComponent extends React.Component<{}, IFocusableComponentSta
|
|
|
54
54
|
style={this.state.hasFocus ? { backgroundColor: '#aee8fcff' } : { backgroundColor: '#00000000' }}
|
|
55
55
|
onFocus={this._onFocus}
|
|
56
56
|
onBlur={this._onBlur}
|
|
57
|
+
enableFocusRing={false}
|
|
57
58
|
>
|
|
58
59
|
<Text>{this.state.hasFocus ? 'Focus: Yes' : 'Focus: No'}</Text>
|
|
59
60
|
</ViewWin32>
|
|
@@ -118,6 +119,7 @@ class KeyboardTestComponent extends React.Component<{}, IFocusableComponentState
|
|
|
118
119
|
onKeyDown={this._onKeyDown}
|
|
119
120
|
onFocus={this._onFocus}
|
|
120
121
|
onBlur={this._onBlur}
|
|
122
|
+
enableFocusRing={false}
|
|
121
123
|
>
|
|
122
124
|
<ViewWin32 style={styles.keyEnterVisualizer}>
|
|
123
125
|
<Text>OnKeyDown</Text>
|
|
@@ -244,6 +246,61 @@ const CursorExample: React.FunctionComponent = () => {
|
|
|
244
246
|
</ViewWin32>
|
|
245
247
|
);
|
|
246
248
|
}
|
|
249
|
+
class EnableFocusRingExample extends React.Component<{}, IFocusableComponentState> {
|
|
250
|
+
public constructor(props) {
|
|
251
|
+
super(props);
|
|
252
|
+
this.state = {
|
|
253
|
+
hasFocus: false,
|
|
254
|
+
};
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
public render() {
|
|
258
|
+
return (
|
|
259
|
+
<ViewWin32 style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-around', marginVertical: 5 }}>
|
|
260
|
+
<ViewWin32
|
|
261
|
+
style={{
|
|
262
|
+
backgroundColor: 'pink',
|
|
263
|
+
height: 100,
|
|
264
|
+
width: 100,
|
|
265
|
+
}}
|
|
266
|
+
enableFocusRing={true}
|
|
267
|
+
focusable
|
|
268
|
+
>
|
|
269
|
+
<Text>enableFocusRing set to true</Text>
|
|
270
|
+
</ViewWin32>
|
|
271
|
+
<ViewWin32
|
|
272
|
+
style={{
|
|
273
|
+
backgroundColor: 'pink',
|
|
274
|
+
height: 100,
|
|
275
|
+
width: 100,
|
|
276
|
+
}}
|
|
277
|
+
enableFocusRing={false}
|
|
278
|
+
focusable
|
|
279
|
+
onFocus={this._onFocus}
|
|
280
|
+
onBlur={this._onBlur}
|
|
281
|
+
>
|
|
282
|
+
<>
|
|
283
|
+
<Text>enableFocusRing set to false</Text>
|
|
284
|
+
<Text>{this.state.hasFocus ? 'Focus: Yes' : 'Focus: No'}</Text>
|
|
285
|
+
</>
|
|
286
|
+
</ViewWin32>
|
|
287
|
+
</ViewWin32>
|
|
288
|
+
);
|
|
289
|
+
}
|
|
290
|
+
|
|
291
|
+
private readonly _onFocus = () => {
|
|
292
|
+
this.setState({
|
|
293
|
+
hasFocus: true,
|
|
294
|
+
});
|
|
295
|
+
};
|
|
296
|
+
|
|
297
|
+
private readonly _onBlur = () => {
|
|
298
|
+
this.setState({
|
|
299
|
+
hasFocus: false,
|
|
300
|
+
});
|
|
301
|
+
};
|
|
302
|
+
}
|
|
303
|
+
|
|
247
304
|
|
|
248
305
|
export const title = 'ViewWin32';
|
|
249
306
|
export const displayName = 'ViewWin32 Example';
|
|
@@ -290,4 +347,11 @@ export const examples = [
|
|
|
290
347
|
return <CursorExample />;
|
|
291
348
|
},
|
|
292
349
|
},
|
|
350
|
+
{
|
|
351
|
+
title: 'EnableFocusRing example',
|
|
352
|
+
description: 'Displays focus visuals that are driven by native',
|
|
353
|
+
render(): JSX.Element {
|
|
354
|
+
return <EnableFocusRingExample />;
|
|
355
|
+
},
|
|
356
|
+
},
|
|
293
357
|
];
|
|
@@ -217,6 +217,7 @@ export interface IViewWin32Props extends Omit<RN.ViewProps, ViewWin32OmitTypes>,
|
|
|
217
217
|
accessibilitySetSize?: number;
|
|
218
218
|
animationClass?: string;
|
|
219
219
|
focusable?: boolean;
|
|
220
|
+
enableFocusRing?: boolean;
|
|
220
221
|
|
|
221
222
|
/**
|
|
222
223
|
* The onBlur event occurs when an element loses focus. The opposite of onBlur is onFocus. Note that in React
|