@office-iss/react-native-win32 0.71.0 → 0.71.2
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 +1 -0
- package/CHANGELOG.json +12667 -12652
- package/CHANGELOG.md +23 -15
- package/Libraries/Components/Button/ButtonWin32.Props.d.ts +2 -2
- package/Libraries/Components/Button/ButtonWin32.d.ts +1 -1
- package/Libraries/Components/Button/ButtonWin32.js +6 -4
- package/Libraries/Components/Button/ButtonWin32.js.map +1 -1
- package/Libraries/Components/Pressable/Pressable.win32.js +0 -1
- package/Libraries/Components/Text/TextWin32.Props.d.ts +3 -9
- package/Libraries/Components/Text/TextWin32.Props.js.map +1 -1
- package/Libraries/Components/Text/TextWin32.d.ts +1 -1
- package/Libraries/Components/Text/TextWin32.js.map +1 -1
- package/Libraries/Components/TextInput/TextInput.Types.win32.d.ts +9 -9
- package/Libraries/Components/TextInput/TextInput.win32.js +1150 -154
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js +4 -4
- package/Libraries/Components/Touchable/Tests/TouchableWin32Test.js.map +1 -1
- package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.d.ts +119 -16
- package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js +99 -24
- package/Libraries/Components/Touchable/TouchableWin32.Props.d.ts +2 -2
- package/Libraries/Components/Touchable/TouchableWin32.Props.js.map +1 -1
- package/Libraries/Components/Touchable/TouchableWin32.Types.d.ts +9 -9
- package/Libraries/Components/Touchable/TouchableWin32.js +5 -6
- package/Libraries/Components/Touchable/TouchableWin32.js.map +1 -1
- package/Libraries/Components/View/ReactNativeViewAttributes.win32.js +29 -10
- package/Libraries/Components/View/Tests/ViewWin32Test.js +31 -51
- package/Libraries/Components/View/Tests/ViewWin32Test.js.map +1 -1
- package/Libraries/Components/View/ViewAccessibility.win32.d.ts +527 -0
- package/Libraries/Components/View/ViewAccessibility.win32.js +178 -0
- package/Libraries/Components/View/ViewPropTypes.win32.d.ts +372 -0
- package/Libraries/Components/View/ViewPropTypes.win32.js +23 -0
- package/Libraries/Components/View/ViewWin32.d.ts +30 -12
- package/Libraries/Components/View/ViewWin32.js +161 -71
- package/Libraries/Image/Image.win32.js +0 -1
- package/Libraries/Pressability/Pressability.win32.js +2 -2
- package/Libraries/Utilities/AcessibilityMapping.win32.js +156 -0
- package/Libraries/__tests__/ButtonWin32-test.js +1 -1
- package/Libraries/platform-types.d.ts +7 -13
- package/index.win32.js +1 -1
- package/jest.config.js +2 -4
- package/overrides.json +38 -8
- package/package.json +5 -5
- package/src/Libraries/Components/Button/ButtonWin32.tsx +8 -8
- package/src/Libraries/Components/Text/TextWin32.Props.ts +2 -15
- package/src/Libraries/Components/Text/TextWin32.tsx +6 -2
- package/src/Libraries/Components/Touchable/Tests/TouchableWin32Test.tsx +5 -5
- package/src/Libraries/Components/Touchable/TouchableNativeFeedback.win32.d.ts +119 -0
- package/src/Libraries/Components/Touchable/TouchableWin32.Props.tsx +1 -1
- package/src/Libraries/Components/Touchable/TouchableWin32.tsx +6 -7
- package/src/Libraries/Components/View/Tests/ViewWin32Test.tsx +28 -52
- package/src/Libraries/Components/View/ViewAccessibility.win32.d.ts +527 -0
- package/src/Libraries/Components/View/ViewPropTypes.win32.d.ts +372 -0
- package/src/Libraries/Components/View/ViewWin32.d.ts +30 -0
- package/src/Libraries/platform-types.d.ts +7 -13
- package/types/modules/BatchedBridge.d.ts +32 -0
- package/types/modules/Codegen.d.ts +74 -0
- package/types/modules/Devtools.d.ts +31 -0
- package/types/modules/LaunchScreen.d.ts +18 -0
- package/types/modules/globals.d.ts +577 -0
- package/types/private/TimerMixin.d.ts +19 -0
- package/types/private/Utilities.d.ts +10 -0
- package/types/public/DeprecatedPropertiesAlias.d.ts +205 -0
- package/types/public/Insets.d.ts +15 -0
- package/types/public/ReactNativeRenderer.d.ts +149 -0
- package/types/public/ReactNativeTypes.d.ts +143 -0
- package/Libraries/Components/TextInput/TextInput.win32.d.ts +0 -68
- package/Libraries/Components/TextInput/TextInput.win32.js.map +0 -1
- package/Libraries/Components/Touchable/TouchableNativeFeedback.Props.d.ts +0 -7
- package/Libraries/Components/Touchable/TouchableNativeFeedback.Props.js +0 -3
- package/Libraries/Components/Touchable/TouchableNativeFeedback.Props.js.map +0 -1
- package/Libraries/Components/Touchable/TouchableNativeFeedback.win32.js.map +0 -1
- package/Libraries/Components/View/ViewWin32.Props.d.ts +0 -174
- package/Libraries/Components/View/ViewWin32.Props.js +0 -11
- package/Libraries/Components/View/ViewWin32.Props.js.map +0 -1
- package/Libraries/Components/View/ViewWin32.js.map +0 -1
- package/src/Libraries/Components/TextInput/TextInput.win32.tsx +0 -217
- package/src/Libraries/Components/Touchable/TouchableNativeFeedback.Props.ts +0 -9
- package/src/Libraries/Components/Touchable/TouchableNativeFeedback.win32.tsx +0 -27
- package/src/Libraries/Components/View/ViewWin32.Props.ts +0 -281
- package/src/Libraries/Components/View/ViewWin32.tsx +0 -119
|
@@ -1,281 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
import React from 'react'
|
|
3
|
-
import RN = require('react-native');
|
|
4
|
-
|
|
5
|
-
// removes from interface T the members of interface K
|
|
6
|
-
type Omit<T, K> = Pick<T, Exclude<keyof T, keyof K>>;
|
|
7
|
-
|
|
8
|
-
// All of T becomes optional except for Keys
|
|
9
|
-
type PartiallyRequired<T, Keys extends keyof T = keyof T> = Pick<Partial<T>, Exclude<keyof T, Keys>> & Pick<T, Keys>;
|
|
10
|
-
|
|
11
|
-
/**
|
|
12
|
-
* All of TOrigin except Key from TUse
|
|
13
|
-
*/
|
|
14
|
-
export type UseFrom<TOrigin, TUse, Key extends keyof TUse> = Pick<TOrigin, Exclude<keyof TOrigin, Key>> & Pick<TUse, Key>;
|
|
15
|
-
|
|
16
|
-
export enum EventPhase {
|
|
17
|
-
None,
|
|
18
|
-
Capturing,
|
|
19
|
-
AtTarget,
|
|
20
|
-
Bubbling
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
export interface INativeKeyboardEvent {
|
|
24
|
-
altKey: boolean;
|
|
25
|
-
ctrlKey: boolean;
|
|
26
|
-
metaKey: boolean;
|
|
27
|
-
shiftKey: boolean;
|
|
28
|
-
key: string;
|
|
29
|
-
eventPhase: EventPhase;
|
|
30
|
-
}
|
|
31
|
-
export type IKeyboardEvent = RN.NativeSyntheticEvent<INativeKeyboardEvent>;
|
|
32
|
-
export type IHandledKeyboardEvent = PartiallyRequired<INativeKeyboardEvent, 'key'>;
|
|
33
|
-
|
|
34
|
-
export interface IViewWin32 {
|
|
35
|
-
focus: () => void;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export type ARIARole =
|
|
39
|
-
| 'alert'
|
|
40
|
-
| 'alertdialog'
|
|
41
|
-
| 'application'
|
|
42
|
-
| 'button'
|
|
43
|
-
| 'checkbox'
|
|
44
|
-
| 'combobox'
|
|
45
|
-
| 'dialog'
|
|
46
|
-
| 'group'
|
|
47
|
-
| 'link'
|
|
48
|
-
| 'listitem'
|
|
49
|
-
| 'menu'
|
|
50
|
-
| 'menubar'
|
|
51
|
-
| 'menuitem'
|
|
52
|
-
| 'none'
|
|
53
|
-
| 'presentation'
|
|
54
|
-
| 'progressbar'
|
|
55
|
-
| 'radio'
|
|
56
|
-
| 'radiogroup'
|
|
57
|
-
| 'scrollbar'
|
|
58
|
-
| 'search'
|
|
59
|
-
| 'spinbutton'
|
|
60
|
-
| 'switch'
|
|
61
|
-
| 'tab'
|
|
62
|
-
| 'tablist'
|
|
63
|
-
| 'tabpanel'
|
|
64
|
-
| 'textbox'
|
|
65
|
-
| 'timer'
|
|
66
|
-
| 'toolbar'
|
|
67
|
-
| 'tree'
|
|
68
|
-
| 'treeitem';
|
|
69
|
-
|
|
70
|
-
export type AnnotationType =
|
|
71
|
-
| 'AdvanceProofingIssue'
|
|
72
|
-
| 'Author'
|
|
73
|
-
| 'CircularReferenceError'
|
|
74
|
-
| 'Comment'
|
|
75
|
-
| 'ConflictingChange'
|
|
76
|
-
| 'DataValidationError'
|
|
77
|
-
| 'DeletionChange'
|
|
78
|
-
| 'EditingLockedChange'
|
|
79
|
-
| 'Endnote'
|
|
80
|
-
| 'ExternalChange'
|
|
81
|
-
| 'Footer'
|
|
82
|
-
| 'Footnote'
|
|
83
|
-
| 'FormatChange'
|
|
84
|
-
| 'FormulaError'
|
|
85
|
-
| 'GrammarError'
|
|
86
|
-
| 'Header'
|
|
87
|
-
| 'Highlighted'
|
|
88
|
-
| 'InsertionChange'
|
|
89
|
-
| 'Mathematics'
|
|
90
|
-
| 'MoveChange'
|
|
91
|
-
| 'SpellingError'
|
|
92
|
-
| 'TrackChanges'
|
|
93
|
-
| 'Unknown'
|
|
94
|
-
| 'UnsyncedChange';
|
|
95
|
-
|
|
96
|
-
export type AccessibilityAnnotationInfo = Readonly<{
|
|
97
|
-
typeID: AnnotationType;
|
|
98
|
-
typeName?: string;
|
|
99
|
-
author?: string;
|
|
100
|
-
dateTime?: string;
|
|
101
|
-
target?: string;
|
|
102
|
-
}>;
|
|
103
|
-
|
|
104
|
-
export type AccessibilityActionName =
|
|
105
|
-
| RN.AccessibilityActionName
|
|
106
|
-
| 'AddToSelection'
|
|
107
|
-
| 'RemoveFromSelection'
|
|
108
|
-
| 'Select'
|
|
109
|
-
| 'Expand'
|
|
110
|
-
| 'Collapse'
|
|
111
|
-
| 'Toggle';
|
|
112
|
-
|
|
113
|
-
export type Cursor =
|
|
114
|
-
| 'auto'
|
|
115
|
-
| 'default'
|
|
116
|
-
| 'pointer'
|
|
117
|
-
| 'help'
|
|
118
|
-
| 'not-allowed'
|
|
119
|
-
| 'wait'
|
|
120
|
-
| 'move'
|
|
121
|
-
| 'nesw-resize'
|
|
122
|
-
| 'ns-resize'
|
|
123
|
-
| 'nwse-resize'
|
|
124
|
-
| 'we-resize'
|
|
125
|
-
| 'text'
|
|
126
|
-
|
|
127
|
-
export type AccessibilityActionInfo = Readonly<{
|
|
128
|
-
name: AccessibilityActionName;
|
|
129
|
-
label?: string;
|
|
130
|
-
}>;
|
|
131
|
-
|
|
132
|
-
export type AccessibilityState = RN.AccessibilityState & { multiselectable?: boolean, required?: boolean };
|
|
133
|
-
|
|
134
|
-
export type SharedAccessibilityPropsIOSandWin32 = {
|
|
135
|
-
onAccessibilityTap?: () => void;
|
|
136
|
-
};
|
|
137
|
-
|
|
138
|
-
export type OmittedAccessibilityPropsWin32 = {
|
|
139
|
-
accessibilityActions?: ReadonlyArray<RN.AccessibilityActionInfo>;
|
|
140
|
-
accessibilityRole?: RN.AccessibilityRole;
|
|
141
|
-
accessibilityState?: RN.AccessibilityState;
|
|
142
|
-
};
|
|
143
|
-
|
|
144
|
-
export type BasePropsWin32 = {
|
|
145
|
-
/**
|
|
146
|
-
* Tells a person using a screen reader the type of element they are focused on.
|
|
147
|
-
*
|
|
148
|
-
* Overrides the `accessibilityRole` prop on React Native to accept a subset of ARIA roles.
|
|
149
|
-
*
|
|
150
|
-
* Possible values for ARIARole are: alert, alertdialog, application, button, checkbox,
|
|
151
|
-
* comobox, dialog, group, link, menu, menubar, menuitem, none, presentation, progressbar,
|
|
152
|
-
* radio, radiogroup, scrollbar, search, spinbutton, switch, tab, tablist, tabpanel, textbox,
|
|
153
|
-
* timer, toolbar, tree, and treeitem.
|
|
154
|
-
*/
|
|
155
|
-
accessibilityRole?: RN.AccessibilityRole | ARIARole;
|
|
156
|
-
accessibilityState?: AccessibilityState;
|
|
157
|
-
accessibilityActions?: ReadonlyArray<AccessibilityActionInfo>;
|
|
158
|
-
|
|
159
|
-
/**
|
|
160
|
-
* Windows Accessibility extensions for allowing other DOM elements to label or describe a given element.
|
|
161
|
-
*
|
|
162
|
-
* Defined as a reference to another DOM element inheriting from the primary base classes of React-Native elements.
|
|
163
|
-
* The reference will be converted to a native reference (tag) before passing to the native platform.
|
|
164
|
-
*/
|
|
165
|
-
accessibilityDescribedBy?: React.RefObject<any>;
|
|
166
|
-
accessibilityLabeledBy?: React.RefObject<any>;
|
|
167
|
-
|
|
168
|
-
/**
|
|
169
|
-
* Identifies the element whose contents or presence are controlled by another element.
|
|
170
|
-
*
|
|
171
|
-
* This is mainly used for a Textbox with a Dropdown PeoplePicker-type list. This allows an
|
|
172
|
-
* accessibility tool to query those other providers for properties and listen to their events.
|
|
173
|
-
*/
|
|
174
|
-
accessibilityControls?: React.RefObject<any>;
|
|
175
|
-
|
|
176
|
-
/**
|
|
177
|
-
* Identifies the ItemType property, which is a text string describing the type of the automation element.
|
|
178
|
-
* ItemType is used to obtain information about items in a list, tree view, or data grid. For example, an item in a file directory view might be a "Document File" or a "Folder".
|
|
179
|
-
*/
|
|
180
|
-
accessibilityItemType?: string;
|
|
181
|
-
|
|
182
|
-
/**
|
|
183
|
-
* Defines the level of an element in a hierarchical structure or the heading level of a text element.
|
|
184
|
-
* Note: accessibilityRole="header" must be used if using this property to define a heading level.
|
|
185
|
-
*/
|
|
186
|
-
accessibilityLevel?: number;
|
|
187
|
-
};
|
|
188
|
-
|
|
189
|
-
export type ViewWin32OmitTypes = RN.ViewPropsAndroid &
|
|
190
|
-
RN.ViewPropsIOS &
|
|
191
|
-
RN.AccessibilityPropsAndroid &
|
|
192
|
-
Omit<RN.AccessibilityPropsIOS, SharedAccessibilityPropsIOSandWin32> &
|
|
193
|
-
OmittedAccessibilityPropsWin32;
|
|
194
|
-
|
|
195
|
-
/**
|
|
196
|
-
* Properties for ViewWin32 component
|
|
197
|
-
*/
|
|
198
|
-
export interface IViewWin32Props extends Omit<RN.ViewProps, ViewWin32OmitTypes>, BasePropsWin32 {
|
|
199
|
-
type?: React.ElementType;
|
|
200
|
-
children?: React.ReactNode;
|
|
201
|
-
/**
|
|
202
|
-
* An access key to hook up to the UIA_AccessKey_Property.
|
|
203
|
-
* Access keys are used in keyboard navigation to allow quick navigation to UI in an application.
|
|
204
|
-
*/
|
|
205
|
-
accessibilityAccessKey?: string;
|
|
206
|
-
accessibilityActions?: ReadonlyArray<AccessibilityActionInfo>;
|
|
207
|
-
/**
|
|
208
|
-
* Tells a person using a screen reader what kind of annotation they
|
|
209
|
-
* have selected. If available, it will also tell a person the author of the annotation and
|
|
210
|
-
* the date and time the annotation was posted.
|
|
211
|
-
*
|
|
212
|
-
* Note: If typeID is 'Unknown', a typeName must be provided.
|
|
213
|
-
*/
|
|
214
|
-
accessibilityAnnotation?: AccessibilityAnnotationInfo;
|
|
215
|
-
/**
|
|
216
|
-
* accessibilityDescription provides more detailed information specific to the element (i.e. last edit date, full location for a file)
|
|
217
|
-
* while accessibilityHint provides infomation on what will happen when they perform an action.
|
|
218
|
-
*
|
|
219
|
-
*/
|
|
220
|
-
accessibilityDescription?: string;
|
|
221
|
-
accessibilityPositionInSet?: number;
|
|
222
|
-
|
|
223
|
-
accessibilitySetSize?: number;
|
|
224
|
-
animationClass?: string;
|
|
225
|
-
focusable?: boolean;
|
|
226
|
-
enableFocusRing?: boolean;
|
|
227
|
-
/*
|
|
228
|
-
* overrides the default behavior of some components that do not show a tooltip. i.e. components in a menu
|
|
229
|
-
*/
|
|
230
|
-
alwaysShowToolTip?: boolean;
|
|
231
|
-
|
|
232
|
-
/**
|
|
233
|
-
* The onBlur event occurs when an element loses focus. The opposite of onBlur is onFocus. Note that in React
|
|
234
|
-
* Native, unlike in the web, the onBlur event bubbles (similar to onFocusOut in the web).
|
|
235
|
-
*
|
|
236
|
-
* `ev.target === ev.currentTarget` when the focus is being lost from this component.
|
|
237
|
-
* `ev.target !== ev.currentTarget` when the focus is being lost from a descendant.
|
|
238
|
-
*/
|
|
239
|
-
onBlur?: (ev: RN.NativeSyntheticEvent<{}>) => void;
|
|
240
|
-
/**
|
|
241
|
-
* The onBlur event occurs when an element loses focus. The opposite of onBlur is onFocus. Note that in React
|
|
242
|
-
* Native, unlike in the web, the onBlur event bubbles (similar to onFocusOut in the web).
|
|
243
|
-
*
|
|
244
|
-
* `ev.target === ev.currentTarget` when the focus is being lost from this component.
|
|
245
|
-
* `ev.target !== ev.currentTarget` when the focus is being lost from a descendant.
|
|
246
|
-
*/
|
|
247
|
-
onBlurCapture?: (ev: RN.NativeSyntheticEvent<{}>) => void;
|
|
248
|
-
/**
|
|
249
|
-
* The onFocus event occurs when an element gets focus. The opposite of onFocus is onBlur. Note that in React
|
|
250
|
-
* Native, unlike in the web, the onFocus event bubbles (similar to onFocusIn in the web).
|
|
251
|
-
*
|
|
252
|
-
* `ev.target === ev.currentTarget` when the focus is being lost from this component.
|
|
253
|
-
* `ev.target !== ev.currentTarget` when the focus is being lost from a descendant.
|
|
254
|
-
*/
|
|
255
|
-
onFocus?: (ev: RN.NativeSyntheticEvent<{}>) => void;
|
|
256
|
-
/**
|
|
257
|
-
* The onFocus event occurs when an element gets focus. The opposite of onFocus is onBlur. Note that in React
|
|
258
|
-
* Native, unlike in the web, the onFocus event bubbles (similar to onFocusIn in the web).
|
|
259
|
-
*
|
|
260
|
-
* `ev.target === ev.currentTarget` when the focus is being lost from this component.
|
|
261
|
-
* `ev.target !== ev.currentTarget` when the focus is being lost from a descendant.
|
|
262
|
-
*/
|
|
263
|
-
onFocusCapture?: (ev: RN.NativeSyntheticEvent<{}>) => void;
|
|
264
|
-
|
|
265
|
-
onKeyDown?: (args: IKeyboardEvent) => void;
|
|
266
|
-
onKeyDownCapture?: (args: IKeyboardEvent) => void;
|
|
267
|
-
onKeyUp?: (args: IKeyboardEvent) => void;
|
|
268
|
-
onKeyUpCapture?: (args: IKeyboardEvent) => void;
|
|
269
|
-
|
|
270
|
-
onMouseEnter?: () => void;
|
|
271
|
-
onMouseLeave?: () => void;
|
|
272
|
-
|
|
273
|
-
keyDownEvents?: IHandledKeyboardEvent[];
|
|
274
|
-
keyUpEvents?: IHandledKeyboardEvent[];
|
|
275
|
-
|
|
276
|
-
/**
|
|
277
|
-
* Provides a screentip to be used on hover of the view
|
|
278
|
-
*/
|
|
279
|
-
tooltip?: string;
|
|
280
|
-
cursor?: Cursor;
|
|
281
|
-
}
|
|
@@ -1,119 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright: Microsoft 2015
|
|
3
|
-
*
|
|
4
|
-
* RN-specific implementation of the cross-platform View abstraction.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import React from 'react'
|
|
8
|
-
import RN = require('react-native');
|
|
9
|
-
import { View, findNodeHandle, UIManager } from 'react-native';
|
|
10
|
-
import { IViewWin32Props, UseFrom } from './ViewWin32.Props';
|
|
11
|
-
const setAndForwardRef = require('../../Utilities/setAndForwardRef');
|
|
12
|
-
|
|
13
|
-
/**
|
|
14
|
-
* Basic View component with additional Win32 specific functionality
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
type InnerViewWin32Props = UseFrom<IViewWin32Props, RN.ViewProps, 'accessibilityRole'> &
|
|
18
|
-
UseFrom<IViewWin32Props, RN.ViewProps, 'accessibilityState'> &
|
|
19
|
-
UseFrom<IViewWin32Props, RN.ViewProps, 'accessibilityActions'> &
|
|
20
|
-
UseFrom<IViewWin32Props, RN.ViewProps, 'onAccessibilityAction'>;
|
|
21
|
-
|
|
22
|
-
type ViewWin32Type = React.ForwardRefExoticComponent<
|
|
23
|
-
IViewWin32Props & React.RefAttributes<View>
|
|
24
|
-
> &
|
|
25
|
-
View;
|
|
26
|
-
|
|
27
|
-
export const ViewWin32 = React.forwardRef(
|
|
28
|
-
(props: IViewWin32Props, ref: React.Ref<any>) => {
|
|
29
|
-
|
|
30
|
-
/**
|
|
31
|
-
* Check for raw text in the DOM.
|
|
32
|
-
*/
|
|
33
|
-
if (__DEV__) {
|
|
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
|
-
}
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Process accessibility refs into node handles after initial DOM render, before sent across the bridge.
|
|
45
|
-
* useLayoutEffect will invalidate the render to assess the ref-based accessibility properties.
|
|
46
|
-
*/
|
|
47
|
-
|
|
48
|
-
const [labeledByTarget, setLabeledByTarget] = React.useState(null);
|
|
49
|
-
const [describedByTarget, setDescribedByTarget] = React.useState(null);
|
|
50
|
-
const [controlsTarget, setControlsTarget] = React.useState(null);
|
|
51
|
-
const {accessibilityLabeledBy, accessibilityDescribedBy, accessibilityControls, ...rest} = props;
|
|
52
|
-
|
|
53
|
-
React.useLayoutEffect(() => {
|
|
54
|
-
if (accessibilityLabeledBy !== undefined && accessibilityLabeledBy.current !== null)
|
|
55
|
-
{
|
|
56
|
-
setLabeledByTarget(findNodeHandle(accessibilityLabeledBy.current as
|
|
57
|
-
| null
|
|
58
|
-
| number
|
|
59
|
-
| React.Component<any, any, any>
|
|
60
|
-
| React.ComponentClass<any, any>));
|
|
61
|
-
}
|
|
62
|
-
}, [accessibilityLabeledBy]);
|
|
63
|
-
|
|
64
|
-
React.useLayoutEffect(() => {
|
|
65
|
-
if (accessibilityDescribedBy !== undefined && accessibilityDescribedBy.current !== null)
|
|
66
|
-
{
|
|
67
|
-
setDescribedByTarget(findNodeHandle(accessibilityDescribedBy.current as
|
|
68
|
-
| null
|
|
69
|
-
| number
|
|
70
|
-
| React.Component<any, any, any>
|
|
71
|
-
| React.ComponentClass<any, any>));
|
|
72
|
-
}
|
|
73
|
-
}, [accessibilityDescribedBy]);
|
|
74
|
-
|
|
75
|
-
React.useLayoutEffect(() => {
|
|
76
|
-
if(accessibilityControls !== undefined && accessibilityControls.current !== null)
|
|
77
|
-
{
|
|
78
|
-
setControlsTarget(findNodeHandle(accessibilityControls.current as
|
|
79
|
-
| null
|
|
80
|
-
| number
|
|
81
|
-
| React.Component<any, any, any>
|
|
82
|
-
| React.ComponentClass<any, any>));
|
|
83
|
-
}
|
|
84
|
-
}, [accessibilityControls]);
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Set up the forwarding ref to enable adding the focus method.
|
|
88
|
-
*/
|
|
89
|
-
const focusRef = React.useRef<ViewWin32>();
|
|
90
|
-
const setNativeRef = setAndForwardRef({
|
|
91
|
-
getForwardedRef: () => ref,
|
|
92
|
-
setLocalRef: localRef => {
|
|
93
|
-
focusRef.current = localRef;
|
|
94
|
-
|
|
95
|
-
/**
|
|
96
|
-
* Add focus() as a callable function to the forwarded reference.
|
|
97
|
-
*/
|
|
98
|
-
if (localRef)
|
|
99
|
-
{
|
|
100
|
-
localRef.focus = () => {
|
|
101
|
-
UIManager.dispatchViewManagerCommand(
|
|
102
|
-
findNodeHandle(localRef),
|
|
103
|
-
UIManager.getViewManagerConfig('RCTView').Commands.focus,
|
|
104
|
-
null
|
|
105
|
-
);
|
|
106
|
-
};
|
|
107
|
-
}
|
|
108
|
-
},
|
|
109
|
-
});
|
|
110
|
-
|
|
111
|
-
return <View ref={setNativeRef}
|
|
112
|
-
{...(rest as InnerViewWin32Props)}
|
|
113
|
-
{...((controlsTarget !== null) ? {accessibilityControls:controlsTarget} : {})}
|
|
114
|
-
{...((labeledByTarget !== null) ? {accessibilityLabeledBy:labeledByTarget} : {})}
|
|
115
|
-
{...((describedByTarget !== null) ? {accessibilityDescribedBy:describedByTarget} : {})}
|
|
116
|
-
/>;
|
|
117
|
-
});
|
|
118
|
-
|
|
119
|
-
export type ViewWin32 = ViewWin32Type;
|