@office-iss/react-native-win32 0.65.1 → 0.65.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.
@@ -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
@@ -98,6 +98,13 @@
98
98
  "baseHash": "0c6bf0751e053672123cbad30d67851ba0007af6",
99
99
  "issue": 4378
100
100
  },
101
+ {
102
+ "type": "patch",
103
+ "file": "src/Libraries/Components/Pressable/Pressable.win32.js",
104
+ "baseFile": "Libraries/Components/Pressable/Pressable.js",
105
+ "baseHash": "614553aa8396b42e932f8c717ebc8b493d772d93",
106
+ "issue": 6240
107
+ },
101
108
  {
102
109
  "type": "copy",
103
110
  "file": "src/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid.js",
@@ -209,6 +216,13 @@
209
216
  "baseFile": "Libraries/Components/View/View.js",
210
217
  "baseHash": "77bfbef8e835e4fee49311779bb039a99ae44372"
211
218
  },
219
+ {
220
+ "type": "patch",
221
+ "file": "src/Libraries/Components/View/ViewPropTypes.win32.js",
222
+ "baseFile": "Libraries/Components/View/ViewPropTypes.js",
223
+ "baseHash": "2b12228aa1ab0e12844996a99ff5d38fbff689a1",
224
+ "issue": 6240
225
+ },
212
226
  {
213
227
  "type": "platform",
214
228
  "file": "src/Libraries/Components/View/ViewWin32.Props.ts"
@@ -372,6 +386,20 @@
372
386
  "type": "platform",
373
387
  "file": "src/Libraries/PersonaCoin/PersonaCoinTypes.ts"
374
388
  },
389
+ {
390
+ "type": "patch",
391
+ "file": "src/Libraries/Pressability/HoverState.win32.js",
392
+ "baseFile": "Libraries/Pressability/HoverState.js",
393
+ "baseHash": "2807a1cddb7c5135f63e5dd4d0706ac660f25d76",
394
+ "issue": 6240
395
+ },
396
+ {
397
+ "type": "patch",
398
+ "file": "src/Libraries/Pressability/Pressability.win32.js",
399
+ "baseFile": "Libraries/Pressability/Pressability.js",
400
+ "baseHash": "f0ff8ce99b09be692f6beb9231c7dec3140da02d",
401
+ "issue": 6240
402
+ },
375
403
  {
376
404
  "type": "platform",
377
405
  "file": "src/Libraries/QuirkSettings/CachingNativeQuirkSettings.js"
@@ -425,6 +453,13 @@
425
453
  "baseHash": "1a196691fb0e9b656c348b7d42427c1c6163c9bb",
426
454
  "issue": 7074
427
455
  },
456
+ {
457
+ "type": "patch",
458
+ "file": "src/Libraries/Types/CoreEventTypes.win32.js",
459
+ "baseFile": "Libraries/Types/CoreEventTypes.js",
460
+ "baseHash": "22c50d13820ca4db6c6cf5e6563f8437d55c24af",
461
+ "issue": 6240
462
+ },
428
463
  {
429
464
  "type": "copy",
430
465
  "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.65.1",
3
+ "version": "0.65.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",
@@ -79,7 +79,7 @@
79
79
  "react-native": "^0.65.0"
80
80
  },
81
81
  "beachball": {
82
- "defaultNpmTag": "latest",
82
+ "defaultNpmTag": "v0.65-stable",
83
83
  "disallowedChangeTypes": [
84
84
  "major",
85
85
  "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
@@ -31,11 +31,13 @@ export const ViewWin32 = React.forwardRef(
31
31
  * Check for raw text in the DOM.
32
32
  */
33
33
  if (__DEV__) {
34
- React.Children.toArray(props.children).forEach(item => {
35
- if (typeof item === 'string') {
36
- console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`);
37
- }
38
- });
34
+ if (props) {
35
+ React.Children.toArray(props.children).forEach(item => {
36
+ if (typeof item === 'string') {
37
+ console.error(`Unexpected text node: ${item}. A text node cannot be a child of a <View>.`);
38
+ }
39
+ });
40
+ }
39
41
  }
40
42
 
41
43
  /**