@office-iss/react-native-win32 0.71.9 → 0.71.11

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.
Files changed (33) hide show
  1. package/CHANGELOG.json +31 -1
  2. package/CHANGELOG.md +20 -4
  3. package/Libraries/Components/Button/ButtonWin32.js.map +1 -1
  4. package/Libraries/Components/Text/TextWin32.Props.d.ts +1 -1
  5. package/Libraries/Components/Text/TextWin32.Props.js.map +1 -1
  6. package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
  7. package/Libraries/Components/Touchable/TouchableNativeFeedback.d.ts +5 -0
  8. package/Libraries/Components/Touchable/TouchableWin32.Props.d.ts +1 -1
  9. package/Libraries/Components/Touchable/TouchableWin32.Props.js.map +1 -1
  10. package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
  11. package/Libraries/Components/View/ViewAccessibility.d.ts +157 -3
  12. package/Libraries/Components/View/ViewPropTypes.d.ts +146 -6
  13. package/Libraries/Components/View/ViewWin32.d.ts +1 -1
  14. package/Libraries/platform-types.d.ts +4 -4
  15. package/overrides.json +3 -7
  16. package/package.json +2 -2
  17. package/src/Libraries/Components/Button/ButtonWin32.tsx +1 -1
  18. package/src/Libraries/Components/Text/TextWin32.Props.ts +1 -1
  19. package/src/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +1 -1
  20. package/src/Libraries/Components/Touchable/TouchableWin32.Props.tsx +1 -1
  21. package/src/Libraries/Components/Touchable/TouchableWin32.tsx +1 -1
  22. package/src/Libraries/Components/View/ViewWin32.d.ts +1 -1
  23. package/src/Libraries/platform-types.d.ts +4 -4
  24. package/Libraries/Components/View/Tests/ViewWin32Test.d.ts +0 -8
  25. package/Libraries/Components/View/Tests/ViewWin32Test.js +0 -233
  26. package/Libraries/Components/View/Tests/ViewWin32Test.js.map +0 -1
  27. package/src/Libraries/Components/Touchable/TouchableNativeFeedback.win32.d.ts +0 -119
  28. package/src/Libraries/Components/View/Tests/ViewWin32Test.tsx +0 -333
  29. package/src/Libraries/Components/View/ViewAccessibility.win32.d.ts +0 -527
  30. package/src/Libraries/Components/View/ViewPropTypes.win32.d.ts +0 -385
  31. /package/{Libraries/Components/Touchable/TouchableNativeFeedback.win32.d.ts → src/Libraries/Components/Touchable/TouchableNativeFeedback.d.ts} +0 -0
  32. /package/{Libraries/Components/View/ViewAccessibility.win32.d.ts → src/Libraries/Components/View/ViewAccessibility.d.ts} +0 -0
  33. /package/{Libraries/Components/View/ViewPropTypes.win32.d.ts → src/Libraries/Components/View/ViewPropTypes.d.ts} +0 -0
@@ -1,333 +0,0 @@
1
- 'use strict';
2
- import React from 'react'
3
- import { StyleSheet, Text, TouchableHighlight } from 'react-native';
4
- import { Cursor, IKeyboardEvent, IHandledKeyboardEvent, ViewWin32 } from '@office-iss/react-native-win32';
5
-
6
- const styles = StyleSheet.create({
7
- border: {
8
- borderStyle: 'dotted',
9
- borderColor: 'black',
10
- },
11
- keyComponentRoot: {
12
- borderWidth: 2,
13
- flexDirection: 'row',
14
- marginVertical: 5,
15
- backgroundColor: 'whitesmoke',
16
- justifyContent: 'space-around',
17
- },
18
- keyEnterVisualizer: {
19
- margin: 5,
20
- alignItems: 'center',
21
- minWidth: 100,
22
- minHeight: 30,
23
- },
24
- blackbox: { height: 30, width: 30, borderColor: 'black', borderWidth: 3 },
25
- });
26
-
27
- interface IFocusableComponentState {
28
- hasFocus: boolean;
29
- }
30
-
31
- function FocusMoverTestComponent() {
32
- const [hasFocus, setHasFocus] = React.useState<boolean>(false);
33
-
34
- const labelId = React.useId();
35
-
36
- const ref = React.useRef<ViewWin32>(null);
37
- const onBtnPress = () => {
38
- if (ref.current) {
39
- ref.current.focus();
40
- }
41
- };
42
-
43
- return (
44
- <ViewWin32>
45
- <ViewWin32 nativeID={labelId} accessibilityLabel="separate label for test" accessibilityItemType="Comment" />
46
- <ViewWin32 style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-around', marginVertical: 5 }}>
47
- <TouchableHighlight onPress={onBtnPress}>
48
- <ViewWin32 accessibilityLabelledBy={labelId} style={styles.blackbox} />
49
- </TouchableHighlight>
50
- <ViewWin32
51
- ref={ref}
52
- focusable
53
- style={hasFocus ? { backgroundColor: '#aee8fcff' } : { backgroundColor: '#00000000' }}
54
- onFocus={() => setHasFocus(true)}
55
- onBlur={() => setHasFocus(false)}
56
- enableFocusRing={false}
57
- >
58
- <Text>{hasFocus ? 'Focus: Yes' : 'Focus: No'}</Text>
59
- </ViewWin32>
60
- </ViewWin32>
61
- </ViewWin32>
62
- );
63
- }
64
-
65
- interface IKeyboardableComponentState {
66
- lastKeyDown: string;
67
- lastKeyUp: string;
68
- }
69
-
70
- const handledNativeKeyboardEvents: IHandledKeyboardEvent[] = [
71
- { key: 'ArrowDown' },
72
- { key: 'ArrowUp' },
73
- { key: 'ArrowLeft' },
74
- { key: 'ArrowRight' },
75
- { key: 'Tab' },
76
- ];
77
-
78
- class KeyboardTestComponent extends React.Component<{}, IFocusableComponentState & IKeyboardableComponentState> {
79
- public constructor(props) {
80
- super(props);
81
- this.state = {
82
- hasFocus: false,
83
- lastKeyDown: null,
84
- lastKeyUp: null,
85
- };
86
- }
87
-
88
- public render() {
89
- return (
90
- <ViewWin32 keyDownEvents={handledNativeKeyboardEvents} keyUpEvents={handledNativeKeyboardEvents}>
91
- <ViewWin32
92
- style={this.state.hasFocus ? [styles.keyComponentRoot, styles.border] : styles.keyComponentRoot}
93
- focusable
94
- onKeyUp={this._onKeyUp}
95
- onKeyDown={this._onKeyDown}
96
- onFocus={this._onFocus}
97
- onBlur={this._onBlur}
98
- enableFocusRing={false}
99
- >
100
- <ViewWin32 style={styles.keyEnterVisualizer}>
101
- <Text>OnKeyDown</Text>
102
- <Text>----</Text>
103
- <Text>{this.state.lastKeyDown !== null ? this.state.lastKeyDown : ' '}</Text>
104
- </ViewWin32>
105
- <ViewWin32 style={styles.keyEnterVisualizer}>
106
- <Text>OnKeyUp</Text>
107
- <Text>----</Text>
108
- <Text>{this.state.lastKeyUp !== null ? this.state.lastKeyUp : ' '}</Text>
109
- </ViewWin32>
110
- </ViewWin32>
111
- </ViewWin32>
112
- );
113
- }
114
-
115
- private readonly _onFocus = () => {
116
- this.setState({
117
- hasFocus: true,
118
- });
119
- };
120
-
121
- private readonly _onBlur = () => {
122
- this.setState({
123
- hasFocus: false,
124
- });
125
- };
126
-
127
- private readonly _onKeyUp = (ev: IKeyboardEvent) => {
128
- this.setState({ lastKeyUp: ev.nativeEvent.key, lastKeyDown: null });
129
- };
130
-
131
- private readonly _onKeyDown = (ev: IKeyboardEvent) => {
132
- this.setState({ lastKeyDown: ev.nativeEvent.key, lastKeyUp: null });
133
- };
134
- }
135
-
136
- interface IHoverComponentProps {
137
- color: string;
138
- }
139
- class HoverTestComponent extends React.Component<IHoverComponentProps, IFocusableComponentState> {
140
- public constructor(props) {
141
- super(props);
142
- this.state = {
143
- hasFocus: false,
144
- };
145
- }
146
-
147
- public render() {
148
- return (
149
- <ViewWin32
150
- onMouseEnter={this._onMouseEnter}
151
- onMouseLeave={this._onMouseLeave}
152
- style={this.state.hasFocus ? [styles.blackbox, { backgroundColor: this.props.color }] : styles.blackbox}
153
- />
154
- );
155
- }
156
- private readonly _onMouseLeave = () => {
157
- this.setState({ hasFocus: false });
158
- };
159
- private readonly _onMouseEnter = () => {
160
- this.setState({ hasFocus: true });
161
- };
162
- }
163
-
164
- class HoverExample extends React.Component {
165
- public render() {
166
- return (
167
- <ViewWin32 style={{ flexDirection: 'row', marginHorizontal: 75, justifyContent: 'space-around' }}>
168
- <HoverTestComponent color="red" />
169
- <HoverTestComponent color="orange" />
170
- <HoverTestComponent color="yellow" />
171
- <HoverTestComponent color="green" />
172
- <HoverTestComponent color="blue" />
173
- <HoverTestComponent color="indigo" />
174
- <HoverTestComponent color="violet" />
175
- </ViewWin32>
176
- );
177
- }
178
- }
179
-
180
- const ToolTipExample: React.FunctionComponent<{}> = () => {
181
- return (
182
- <ViewWin32
183
- style={{
184
- backgroundColor: 'red',
185
- height: 100,
186
- width: 100,
187
- }}
188
- tooltip="Example tooltip"
189
- cursor="pointer"
190
- />
191
- );
192
- };
193
-
194
- interface ICursorTestComponentProps {
195
- cursor: Cursor
196
- }
197
-
198
- const CursorTestComponent: React.FunctionComponent<ICursorTestComponentProps> = (props) => {
199
- return (
200
- <ViewWin32 style={{flexDirection: 'column'}}>
201
- <Text>{props.cursor}</Text>
202
- <ViewWin32 cursor={props.cursor} style={styles.blackbox} />
203
- </ViewWin32>
204
- )
205
- }
206
-
207
- const CursorExample: React.FunctionComponent = () => {
208
- return (
209
- <ViewWin32 style={{ flexDirection: 'row', justifyContent: 'space-around' }}>
210
- <CursorTestComponent cursor='auto' />
211
- <CursorTestComponent cursor='default' />
212
- <CursorTestComponent cursor='help' />
213
- <CursorTestComponent cursor='nesw-resize' />
214
- <CursorTestComponent cursor='not-allowed' />
215
- <CursorTestComponent cursor='ns-resize' />
216
- <CursorTestComponent cursor='nwse-resize' />
217
- <CursorTestComponent cursor='pointer' />
218
- <CursorTestComponent cursor='wait' />
219
- <CursorTestComponent cursor='move' />
220
- <CursorTestComponent cursor='text' />
221
- <CursorTestComponent cursor='we-resize' />
222
- </ViewWin32>
223
- );
224
- }
225
- class EnableFocusRingExample extends React.Component<{}, IFocusableComponentState> {
226
- public constructor(props) {
227
- super(props);
228
- this.state = {
229
- hasFocus: false,
230
- };
231
- }
232
-
233
- public render() {
234
- return (
235
- <ViewWin32 style={{ flexDirection: 'row', alignItems: 'center', justifyContent: 'space-around', marginVertical: 5 }}>
236
- <ViewWin32
237
- style={{
238
- backgroundColor: 'pink',
239
- height: 100,
240
- width: 100,
241
- }}
242
- enableFocusRing={true}
243
- focusable
244
- >
245
- <Text>enableFocusRing set to true</Text>
246
- </ViewWin32>
247
- <ViewWin32
248
- style={{
249
- backgroundColor: 'pink',
250
- height: 100,
251
- width: 100,
252
- }}
253
- enableFocusRing={false}
254
- focusable
255
- onFocus={this._onFocus}
256
- onBlur={this._onBlur}
257
- >
258
- <>
259
- <Text>enableFocusRing set to false</Text>
260
- <Text>{this.state.hasFocus ? 'Focus: Yes' : 'Focus: No'}</Text>
261
- </>
262
- </ViewWin32>
263
- </ViewWin32>
264
- );
265
- }
266
-
267
- private readonly _onFocus = () => {
268
- this.setState({
269
- hasFocus: true,
270
- });
271
- };
272
-
273
- private readonly _onBlur = () => {
274
- this.setState({
275
- hasFocus: false,
276
- });
277
- };
278
- }
279
-
280
-
281
- export const title = 'ViewWin32';
282
- export const displayName = 'ViewWin32 Example';
283
- export const description = 'All the stock View props plus Win32 specific ones';
284
- export const examples = [
285
- {
286
- title: 'focus() method example',
287
- description: 'Each of these black boxes moves focus to the ViewWin32 on the right',
288
- render(): JSX.Element {
289
- return (
290
- <ViewWin32>
291
- <FocusMoverTestComponent />
292
- <FocusMoverTestComponent />
293
- <FocusMoverTestComponent />
294
- </ViewWin32>
295
- );
296
- },
297
- },
298
- {
299
- title: 'KeyboardEvents example',
300
- description: 'Native keyboarding has been prevented',
301
- render(): JSX.Element {
302
- return <KeyboardTestComponent />;
303
- },
304
- },
305
- {
306
- title: 'Hover example',
307
- description: 'Hover a rainbow',
308
- render(): JSX.Element {
309
- return <HoverExample />;
310
- },
311
- },
312
- {
313
- title: 'Tooltip example',
314
- description: 'Displays a tooltip on hover',
315
- render(): JSX.Element {
316
- return <ToolTipExample />;
317
- },
318
- },
319
- {
320
- title: 'Cursor example',
321
- description: 'Each of these boxes should display a different cursor',
322
- render(): JSX.Element {
323
- return <CursorExample />;
324
- },
325
- },
326
- {
327
- title: 'EnableFocusRing example',
328
- description: 'Displays focus visuals that are driven by native',
329
- render(): JSX.Element {
330
- return <EnableFocusRingExample />;
331
- },
332
- },
333
- ];