@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
|
@@ -0,0 +1,205 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and 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
|
+
* @format
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import {
|
|
11
|
+
TextProps,
|
|
12
|
+
TextPropsIOS,
|
|
13
|
+
TextPropsAndroid,
|
|
14
|
+
AccessibilityProps,
|
|
15
|
+
AccessibilityPropsIOS,
|
|
16
|
+
AccessibilityPropsAndroid,
|
|
17
|
+
TextInputProps,
|
|
18
|
+
TextInputIOSProps,
|
|
19
|
+
TextInputAndroidProps,
|
|
20
|
+
ViewProps,
|
|
21
|
+
ViewPropsIOS,
|
|
22
|
+
ViewPropsAndroid,
|
|
23
|
+
ScrollViewProps,
|
|
24
|
+
ScrollViewPropsIOS,
|
|
25
|
+
ScrollViewPropsAndroid,
|
|
26
|
+
InputAccessoryViewProps,
|
|
27
|
+
ActivityIndicatorProps,
|
|
28
|
+
ActivityIndicatorIOSProps,
|
|
29
|
+
DatePickerIOSProps,
|
|
30
|
+
DrawerLayoutAndroidProps,
|
|
31
|
+
ProgressBarAndroidProps,
|
|
32
|
+
ProgressViewIOSProps,
|
|
33
|
+
RefreshControlProps,
|
|
34
|
+
RefreshControlPropsIOS,
|
|
35
|
+
RefreshControlPropsAndroid,
|
|
36
|
+
SliderProps,
|
|
37
|
+
SliderPropsIOS,
|
|
38
|
+
SliderPropsAndroid,
|
|
39
|
+
ImageSourcePropType,
|
|
40
|
+
ImageProps,
|
|
41
|
+
ImagePropsIOS,
|
|
42
|
+
ImagePropsAndroid,
|
|
43
|
+
ImageBackgroundProps,
|
|
44
|
+
FlatListProps,
|
|
45
|
+
VirtualizedListProps,
|
|
46
|
+
SectionListProps,
|
|
47
|
+
ModalProps,
|
|
48
|
+
TouchableWithoutFeedbackProps,
|
|
49
|
+
TouchableHighlightProps,
|
|
50
|
+
TouchableOpacityProps,
|
|
51
|
+
TouchableNativeFeedbackProps,
|
|
52
|
+
ButtonProps,
|
|
53
|
+
StatusBarProps,
|
|
54
|
+
StatusBarPropsIOS,
|
|
55
|
+
StatusBarPropsAndroid,
|
|
56
|
+
SwitchProps,
|
|
57
|
+
SwitchPropsIOS,
|
|
58
|
+
} from 'react-native';
|
|
59
|
+
|
|
60
|
+
/*
|
|
61
|
+
* Previously, props interfaces where named *Properties
|
|
62
|
+
* They have been renamed to *Props to match React Native documentation
|
|
63
|
+
* The following lines ensure compatibility with *Properties and should be removed in the future
|
|
64
|
+
*/
|
|
65
|
+
|
|
66
|
+
/** @deprecated Use TextProps */
|
|
67
|
+
export type TextProperties = TextProps;
|
|
68
|
+
|
|
69
|
+
/** @deprecated Use TextPropsIOS */
|
|
70
|
+
export type TextPropertiesIOS = TextPropsIOS;
|
|
71
|
+
|
|
72
|
+
/** @deprecated Use TextPropsAndroid */
|
|
73
|
+
export type TextPropertiesAndroid = TextPropsAndroid;
|
|
74
|
+
|
|
75
|
+
/** @deprecated Use AccessibilityProps */
|
|
76
|
+
export type AccessibilityProperties = AccessibilityProps;
|
|
77
|
+
|
|
78
|
+
/** @deprecated Use AccessibilityPropsIOS */
|
|
79
|
+
export type AccessibilityPropertiesIOS = AccessibilityPropsIOS;
|
|
80
|
+
|
|
81
|
+
/** @deprecated Use AccessibilityPropsAndroid */
|
|
82
|
+
export type AccessibilityPropertiesAndroid = AccessibilityPropsAndroid;
|
|
83
|
+
|
|
84
|
+
/** @deprecated Use TextInputProps */
|
|
85
|
+
export type TextInputProperties = TextInputProps;
|
|
86
|
+
|
|
87
|
+
/** @deprecated Use TextInputIOSProps */
|
|
88
|
+
export type TextInputIOSProperties = TextInputIOSProps;
|
|
89
|
+
|
|
90
|
+
/** @deprecated Use TextInputAndroidProps */
|
|
91
|
+
export type TextInputAndroidProperties = TextInputAndroidProps;
|
|
92
|
+
|
|
93
|
+
/** @deprecated Use ViewProps */
|
|
94
|
+
export type ViewProperties = ViewProps;
|
|
95
|
+
|
|
96
|
+
/** @deprecated Use ViewPropsIOS */
|
|
97
|
+
export type ViewPropertiesIOS = ViewPropsIOS;
|
|
98
|
+
|
|
99
|
+
/** @deprecated Use ViewPropsAndroid */
|
|
100
|
+
export type ViewPropertiesAndroid = ViewPropsAndroid;
|
|
101
|
+
|
|
102
|
+
/** @deprecated Use ScrollViewProps */
|
|
103
|
+
export type ScrollViewProperties = ScrollViewProps;
|
|
104
|
+
|
|
105
|
+
/** @deprecated Use ScrollViewPropsIOS */
|
|
106
|
+
export type ScrollViewPropertiesIOS = ScrollViewPropsIOS;
|
|
107
|
+
|
|
108
|
+
/** @deprecated Use ScrollViewPropsAndroid */
|
|
109
|
+
export type ScrollViewPropertiesAndroid = ScrollViewPropsAndroid;
|
|
110
|
+
|
|
111
|
+
/** @deprecated Use InputAccessoryViewProps */
|
|
112
|
+
export type InputAccessoryViewProperties = InputAccessoryViewProps;
|
|
113
|
+
|
|
114
|
+
/** @deprecated Use ActivityIndicatorProps */
|
|
115
|
+
export type ActivityIndicatorProperties = ActivityIndicatorProps;
|
|
116
|
+
|
|
117
|
+
/** @deprecated Use ActivityIndicatorIOSProps */
|
|
118
|
+
export type ActivityIndicatorIOSProperties = ActivityIndicatorIOSProps;
|
|
119
|
+
|
|
120
|
+
/** @deprecated Use DatePickerIOSProps */
|
|
121
|
+
export type DatePickerIOSProperties = DatePickerIOSProps;
|
|
122
|
+
|
|
123
|
+
/** @deprecated Use DrawerLayoutAndroidProps */
|
|
124
|
+
export type DrawerLayoutAndroidProperties = DrawerLayoutAndroidProps;
|
|
125
|
+
|
|
126
|
+
/** @deprecated Use ProgressBarAndroidProps */
|
|
127
|
+
export type ProgressBarAndroidProperties = ProgressBarAndroidProps;
|
|
128
|
+
|
|
129
|
+
/** @deprecated Use ProgressViewIOSProps */
|
|
130
|
+
export type ProgressViewIOSProperties = ProgressViewIOSProps;
|
|
131
|
+
|
|
132
|
+
/** @deprecated Use RefreshControlProps */
|
|
133
|
+
export type RefreshControlProperties = RefreshControlProps;
|
|
134
|
+
|
|
135
|
+
/** @deprecated Use RefreshControlPropsIOS */
|
|
136
|
+
export type RefreshControlPropertiesIOS = RefreshControlPropsIOS;
|
|
137
|
+
|
|
138
|
+
/** @deprecated Use RefreshControlPropsAndroid */
|
|
139
|
+
export type RefreshControlPropertiesAndroid = RefreshControlPropsAndroid;
|
|
140
|
+
|
|
141
|
+
/** @deprecated Use SliderProps */
|
|
142
|
+
export type SliderProperties = SliderProps;
|
|
143
|
+
|
|
144
|
+
/** @deprecated Use SliderPropsIOS */
|
|
145
|
+
export type SliderPropertiesIOS = SliderPropsIOS;
|
|
146
|
+
|
|
147
|
+
/** @deprecated Use SliderPropsAndroid */
|
|
148
|
+
export type SliderPropertiesAndroid = SliderPropsAndroid;
|
|
149
|
+
|
|
150
|
+
/** @deprecated Use ImageSourcePropType */
|
|
151
|
+
export type ImagePropertiesSourceOptions = ImageSourcePropType;
|
|
152
|
+
|
|
153
|
+
/** @deprecated Use ImageProps */
|
|
154
|
+
export type ImageProperties = ImageProps;
|
|
155
|
+
|
|
156
|
+
/** @deprecated Use ImagePropsIOS */
|
|
157
|
+
export type ImagePropertiesIOS = ImagePropsIOS;
|
|
158
|
+
|
|
159
|
+
/** @deprecated Use ImagePropsAndroid */
|
|
160
|
+
export type ImagePropertiesAndroid = ImagePropsAndroid;
|
|
161
|
+
|
|
162
|
+
/** @deprecated Use ImageBackgroundProps */
|
|
163
|
+
export type ImageBackgroundProperties = ImageBackgroundProps;
|
|
164
|
+
|
|
165
|
+
/** @deprecated Use FlatListProps */
|
|
166
|
+
export type FlatListProperties<ItemT> = FlatListProps<ItemT>;
|
|
167
|
+
|
|
168
|
+
/** @deprecated Use VirtualizedListProps */
|
|
169
|
+
export type VirtualizedListProperties<ItemT> = VirtualizedListProps<ItemT>;
|
|
170
|
+
|
|
171
|
+
/** @deprecated Use SectionListProps */
|
|
172
|
+
export type SectionListProperties<ItemT> = SectionListProps<ItemT>;
|
|
173
|
+
|
|
174
|
+
/** @deprecated Use ModalProps */
|
|
175
|
+
export type ModalProperties = ModalProps;
|
|
176
|
+
|
|
177
|
+
/** @deprecated Use TouchableWithoutFeedbackProps */
|
|
178
|
+
export type TouchableWithoutFeedbackProperties = TouchableWithoutFeedbackProps;
|
|
179
|
+
|
|
180
|
+
/** @deprecated Use TouchableHighlightProps */
|
|
181
|
+
export type TouchableHighlightProperties = TouchableHighlightProps;
|
|
182
|
+
|
|
183
|
+
/** @deprecated Use TouchableOpacityProps */
|
|
184
|
+
export type TouchableOpacityProperties = TouchableOpacityProps;
|
|
185
|
+
|
|
186
|
+
/** @deprecated Use TouchableNativeFeedbackProps */
|
|
187
|
+
export type TouchableNativeFeedbackProperties = TouchableNativeFeedbackProps;
|
|
188
|
+
|
|
189
|
+
/** @deprecated Use ButtonProps */
|
|
190
|
+
export type ButtonProperties = ButtonProps;
|
|
191
|
+
|
|
192
|
+
/** @deprecated Use StatusBarProps */
|
|
193
|
+
export type StatusBarProperties = StatusBarProps;
|
|
194
|
+
|
|
195
|
+
/** @deprecated Use StatusBarPropsIOS */
|
|
196
|
+
export type StatusBarPropertiesIOS = StatusBarPropsIOS;
|
|
197
|
+
|
|
198
|
+
/** @deprecated Use StatusBarPropsAndroid */
|
|
199
|
+
export type StatusBarPropertiesAndroid = StatusBarPropsAndroid;
|
|
200
|
+
|
|
201
|
+
/** @deprecated Use SwitchProps */
|
|
202
|
+
export type SwitchProperties = SwitchProps;
|
|
203
|
+
|
|
204
|
+
/** @deprecated Use SwitchPropsIOS */
|
|
205
|
+
export type SwitchPropertiesIOS = SwitchPropsIOS;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and 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
|
+
* @format
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
export interface Insets {
|
|
11
|
+
top?: number | undefined;
|
|
12
|
+
left?: number | undefined;
|
|
13
|
+
bottom?: number | undefined;
|
|
14
|
+
right?: number | undefined;
|
|
15
|
+
}
|
|
@@ -0,0 +1,149 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and 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
|
+
* @format
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import {GestureResponderEvent} from '../../Libraries/Types/CoreEventTypes';
|
|
11
|
+
|
|
12
|
+
/**
|
|
13
|
+
* Gesture recognition on mobile devices is much more complicated than web.
|
|
14
|
+
* A touch can go through several phases as the app determines what the user's intention is.
|
|
15
|
+
* For example, the app needs to determine if the touch is scrolling, sliding on a widget, or tapping.
|
|
16
|
+
* This can even change during the duration of a touch. There can also be multiple simultaneous touches.
|
|
17
|
+
*
|
|
18
|
+
* The touch responder system is needed to allow components to negotiate these touch interactions
|
|
19
|
+
* without any additional knowledge about their parent or child components.
|
|
20
|
+
* This system is implemented in ResponderEventPlugin.js, which contains further details and documentation.
|
|
21
|
+
*
|
|
22
|
+
* Best Practices
|
|
23
|
+
* Users can feel huge differences in the usability of web apps vs. native, and this is one of the big causes.
|
|
24
|
+
* Every action should have the following attributes:
|
|
25
|
+
* Feedback/highlighting- show the user what is handling their touch, and what will happen when they release the gesture
|
|
26
|
+
* Cancel-ability- when making an action, the user should be able to abort it mid-touch by dragging their finger away
|
|
27
|
+
*
|
|
28
|
+
* These features make users more comfortable while using an app,
|
|
29
|
+
* because it allows people to experiment and interact without fear of making mistakes.
|
|
30
|
+
*
|
|
31
|
+
* TouchableHighlight and Touchable*
|
|
32
|
+
* The responder system can be complicated to use.
|
|
33
|
+
* So we have provided an abstract Touchable implementation for things that should be "tappable".
|
|
34
|
+
* This uses the responder system and allows you to easily configure tap interactions declaratively.
|
|
35
|
+
* Use TouchableHighlight anywhere where you would use a button or link on web.
|
|
36
|
+
*/
|
|
37
|
+
export interface GestureResponderHandlers {
|
|
38
|
+
/**
|
|
39
|
+
* A view can become the touch responder by implementing the correct negotiation methods.
|
|
40
|
+
* There are two methods to ask the view if it wants to become responder:
|
|
41
|
+
*/
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* Does this view want to become responder on the start of a touch?
|
|
45
|
+
*/
|
|
46
|
+
onStartShouldSetResponder?:
|
|
47
|
+
| ((event: GestureResponderEvent) => boolean)
|
|
48
|
+
| undefined;
|
|
49
|
+
|
|
50
|
+
/**
|
|
51
|
+
* Called for every touch move on the View when it is not the responder: does this view want to "claim" touch responsiveness?
|
|
52
|
+
*/
|
|
53
|
+
onMoveShouldSetResponder?:
|
|
54
|
+
| ((event: GestureResponderEvent) => boolean)
|
|
55
|
+
| undefined;
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* If the View returns true and attempts to become the responder, one of the following will happen:
|
|
59
|
+
*/
|
|
60
|
+
|
|
61
|
+
onResponderEnd?: ((event: GestureResponderEvent) => void) | undefined;
|
|
62
|
+
|
|
63
|
+
/**
|
|
64
|
+
* The View is now responding for touch events.
|
|
65
|
+
* This is the time to highlight and show the user what is happening
|
|
66
|
+
*/
|
|
67
|
+
onResponderGrant?: ((event: GestureResponderEvent) => void) | undefined;
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* Something else is the responder right now and will not release it
|
|
71
|
+
*/
|
|
72
|
+
onResponderReject?: ((event: GestureResponderEvent) => void) | undefined;
|
|
73
|
+
|
|
74
|
+
/**
|
|
75
|
+
* If the view is responding, the following handlers can be called:
|
|
76
|
+
*/
|
|
77
|
+
|
|
78
|
+
/**
|
|
79
|
+
* The user is moving their finger
|
|
80
|
+
*/
|
|
81
|
+
onResponderMove?: ((event: GestureResponderEvent) => void) | undefined;
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Fired at the end of the touch, ie "touchUp"
|
|
85
|
+
*/
|
|
86
|
+
onResponderRelease?: ((event: GestureResponderEvent) => void) | undefined;
|
|
87
|
+
|
|
88
|
+
onResponderStart?: ((event: GestureResponderEvent) => void) | undefined;
|
|
89
|
+
|
|
90
|
+
/**
|
|
91
|
+
* Something else wants to become responder.
|
|
92
|
+
* Should this view release the responder? Returning true allows release
|
|
93
|
+
*/
|
|
94
|
+
onResponderTerminationRequest?:
|
|
95
|
+
| ((event: GestureResponderEvent) => boolean)
|
|
96
|
+
| undefined;
|
|
97
|
+
|
|
98
|
+
/**
|
|
99
|
+
* The responder has been taken from the View.
|
|
100
|
+
* Might be taken by other views after a call to onResponderTerminationRequest,
|
|
101
|
+
* or might be taken by the OS without asking (happens with control center/ notification center on iOS)
|
|
102
|
+
*/
|
|
103
|
+
onResponderTerminate?: ((event: GestureResponderEvent) => void) | undefined;
|
|
104
|
+
|
|
105
|
+
/**
|
|
106
|
+
* onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern,
|
|
107
|
+
* where the deepest node is called first.
|
|
108
|
+
* That means that the deepest component will become responder when multiple Views return true for *ShouldSetResponder handlers.
|
|
109
|
+
* This is desirable in most cases, because it makes sure all controls and buttons are usable.
|
|
110
|
+
*
|
|
111
|
+
* However, sometimes a parent will want to make sure that it becomes responder.
|
|
112
|
+
* This can be handled by using the capture phase.
|
|
113
|
+
* Before the responder system bubbles up from the deepest component,
|
|
114
|
+
* it will do a capture phase, firing on*ShouldSetResponderCapture.
|
|
115
|
+
* So if a parent View wants to prevent the child from becoming responder on a touch start,
|
|
116
|
+
* it should have a onStartShouldSetResponderCapture handler which returns true.
|
|
117
|
+
*/
|
|
118
|
+
onStartShouldSetResponderCapture?:
|
|
119
|
+
| ((event: GestureResponderEvent) => boolean)
|
|
120
|
+
| undefined;
|
|
121
|
+
|
|
122
|
+
/**
|
|
123
|
+
* onStartShouldSetResponder and onMoveShouldSetResponder are called with a bubbling pattern,
|
|
124
|
+
* where the deepest node is called first.
|
|
125
|
+
* That means that the deepest component will become responder when multiple Views return true for *ShouldSetResponder handlers.
|
|
126
|
+
* This is desirable in most cases, because it makes sure all controls and buttons are usable.
|
|
127
|
+
*
|
|
128
|
+
* However, sometimes a parent will want to make sure that it becomes responder.
|
|
129
|
+
* This can be handled by using the capture phase.
|
|
130
|
+
* Before the responder system bubbles up from the deepest component,
|
|
131
|
+
* it will do a capture phase, firing on*ShouldSetResponderCapture.
|
|
132
|
+
* So if a parent View wants to prevent the child from becoming responder on a touch start,
|
|
133
|
+
* it should have a onStartShouldSetResponderCapture handler which returns true.
|
|
134
|
+
*/
|
|
135
|
+
onMoveShouldSetResponderCapture?:
|
|
136
|
+
| ((event: GestureResponderEvent) => boolean)
|
|
137
|
+
| undefined;
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
/**
|
|
141
|
+
* React Native also implements unstable_batchedUpdates
|
|
142
|
+
*/
|
|
143
|
+
export function unstable_batchedUpdates<A, B>(
|
|
144
|
+
callback: (a: A, b: B) => any,
|
|
145
|
+
a: A,
|
|
146
|
+
b: B,
|
|
147
|
+
): void;
|
|
148
|
+
export function unstable_batchedUpdates<A>(callback: (a: A) => any, a: A): void;
|
|
149
|
+
export function unstable_batchedUpdates(callback: () => any): void;
|
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) Meta Platforms, Inc. and 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
|
+
* @format
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
import type * as React from 'react';
|
|
11
|
+
|
|
12
|
+
export type MeasureOnSuccessCallback = (
|
|
13
|
+
x: number,
|
|
14
|
+
y: number,
|
|
15
|
+
width: number,
|
|
16
|
+
height: number,
|
|
17
|
+
pageX: number,
|
|
18
|
+
pageY: number,
|
|
19
|
+
) => void;
|
|
20
|
+
|
|
21
|
+
export type MeasureInWindowOnSuccessCallback = (
|
|
22
|
+
x: number,
|
|
23
|
+
y: number,
|
|
24
|
+
width: number,
|
|
25
|
+
height: number,
|
|
26
|
+
) => void;
|
|
27
|
+
|
|
28
|
+
export type MeasureLayoutOnSuccessCallback = (
|
|
29
|
+
left: number,
|
|
30
|
+
top: number,
|
|
31
|
+
width: number,
|
|
32
|
+
height: number,
|
|
33
|
+
) => void;
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* NativeMethods provides methods to access the underlying native component directly.
|
|
37
|
+
* This can be useful in cases when you want to focus a view or measure its on-screen dimensions,
|
|
38
|
+
* for example.
|
|
39
|
+
* The methods described here are available on most of the default components provided by React Native.
|
|
40
|
+
* Note, however, that they are not available on composite components that aren't directly backed by a
|
|
41
|
+
* native view. This will generally include most components that you define in your own app.
|
|
42
|
+
* For more information, see [Direct Manipulation](https://reactnative.dev/docs/direct-manipulation).
|
|
43
|
+
* @see https://github.com/facebook/react-native/blob/master/Libraries/Renderer/shims/ReactNativeTypes.js#L87
|
|
44
|
+
*/
|
|
45
|
+
export interface NativeMethods {
|
|
46
|
+
/**
|
|
47
|
+
* Determines the location on screen, width, and height of the given view and
|
|
48
|
+
* returns the values via an async callback. If successful, the callback will
|
|
49
|
+
* be called with the following arguments:
|
|
50
|
+
*
|
|
51
|
+
* - x
|
|
52
|
+
* - y
|
|
53
|
+
* - width
|
|
54
|
+
* - height
|
|
55
|
+
* - pageX
|
|
56
|
+
* - pageY
|
|
57
|
+
*
|
|
58
|
+
* Note that these measurements are not available until after the rendering
|
|
59
|
+
* has been completed in native. If you need the measurements as soon as
|
|
60
|
+
* possible, consider using the [`onLayout`
|
|
61
|
+
* prop](docs/view.html#onlayout) instead.
|
|
62
|
+
*/
|
|
63
|
+
measure(callback: MeasureOnSuccessCallback): void;
|
|
64
|
+
|
|
65
|
+
/**
|
|
66
|
+
* Determines the location of the given view in the window and returns the
|
|
67
|
+
* values via an async callback. If the React root view is embedded in
|
|
68
|
+
* another native view, this will give you the absolute coordinates. If
|
|
69
|
+
* successful, the callback will be called with the following
|
|
70
|
+
* arguments:
|
|
71
|
+
*
|
|
72
|
+
* - x
|
|
73
|
+
* - y
|
|
74
|
+
* - width
|
|
75
|
+
* - height
|
|
76
|
+
*
|
|
77
|
+
* Note that these measurements are not available until after the rendering
|
|
78
|
+
* has been completed in native.
|
|
79
|
+
*/
|
|
80
|
+
measureInWindow(callback: MeasureInWindowOnSuccessCallback): void;
|
|
81
|
+
|
|
82
|
+
/**
|
|
83
|
+
* Like [`measure()`](#measure), but measures the view relative an ancestor,
|
|
84
|
+
* specified as `relativeToNativeComponentRef`. This means that the returned x, y
|
|
85
|
+
* are relative to the origin x, y of the ancestor view.
|
|
86
|
+
* _Can also be called with a relativeNativeNodeHandle but is deprecated._
|
|
87
|
+
*/
|
|
88
|
+
measureLayout(
|
|
89
|
+
relativeToNativeComponentRef:
|
|
90
|
+
| React.ElementRef<HostComponent<unknown>>
|
|
91
|
+
| number,
|
|
92
|
+
onSuccess: MeasureLayoutOnSuccessCallback,
|
|
93
|
+
onFail?: () => void,
|
|
94
|
+
): void;
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* This function sends props straight to native. They will not participate in
|
|
98
|
+
* future diff process - this means that if you do not include them in the
|
|
99
|
+
* next render, they will remain active (see [Direct
|
|
100
|
+
* Manipulation](https://reactnative.dev/docs/direct-manipulation)).
|
|
101
|
+
*/
|
|
102
|
+
setNativeProps(nativeProps: object): void;
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* Requests focus for the given input or view. The exact behavior triggered
|
|
106
|
+
* will depend on the platform and type of view.
|
|
107
|
+
*/
|
|
108
|
+
focus(): void;
|
|
109
|
+
|
|
110
|
+
/**
|
|
111
|
+
* Removes focus from an input or view. This is the opposite of `focus()`.
|
|
112
|
+
*/
|
|
113
|
+
blur(): void;
|
|
114
|
+
|
|
115
|
+
refs: {
|
|
116
|
+
[key: string]: React.Component<any, any>;
|
|
117
|
+
};
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
/**
|
|
121
|
+
* @deprecated Use NativeMethods instead.
|
|
122
|
+
*/
|
|
123
|
+
export type NativeMethodsMixin = NativeMethods;
|
|
124
|
+
/**
|
|
125
|
+
* @deprecated Use NativeMethods instead.
|
|
126
|
+
*/
|
|
127
|
+
export type NativeMethodsMixinType = NativeMethods;
|
|
128
|
+
|
|
129
|
+
/**
|
|
130
|
+
* Represents a native component, such as those returned from `requireNativeComponent`.
|
|
131
|
+
*
|
|
132
|
+
* @see https://github.com/facebook/react-native/blob/v0.62.0-rc.5/Libraries/Renderer/shims/ReactNativeTypes.js
|
|
133
|
+
*
|
|
134
|
+
* @todo This should eventually be defined as an AbstractComponent, but that
|
|
135
|
+
* should first be introduced in the React typings.
|
|
136
|
+
*/
|
|
137
|
+
export interface HostComponent<P>
|
|
138
|
+
extends Pick<
|
|
139
|
+
React.ComponentClass<P>,
|
|
140
|
+
Exclude<keyof React.ComponentClass<P>, 'new'>
|
|
141
|
+
> {
|
|
142
|
+
new (props: P, context?: any): React.Component<P> & Readonly<NativeMethods>;
|
|
143
|
+
}
|
|
@@ -1,68 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* This is a forked and slightly modified version of React Native's TextInput.
|
|
3
|
-
* The fork is necessary as platform checks in the base implementation made the
|
|
4
|
-
* control unusable on win32. In addition to cleaning up some of the code, this
|
|
5
|
-
* fork also uses Typescript rather than Flow for type safety.
|
|
6
|
-
*
|
|
7
|
-
* More general documentation on this control can be found at
|
|
8
|
-
* https://facebook.github.io/react-native/docs/textinput.html
|
|
9
|
-
*
|
|
10
|
-
* The original implementation can be found at
|
|
11
|
-
* https://github.com/facebook/react-native/blob/1013a010492a7bef5ff58073a088ac924a986e9e/Libraries/Components/TextInput/TextInput.js
|
|
12
|
-
*
|
|
13
|
-
* This control does not support the full React Native TextInput interface yet.
|
|
14
|
-
* Most of the work necessary to make that happen needs to happen on the native side.
|
|
15
|
-
* Future work on the JS side may include:
|
|
16
|
-
* 1. Expanded typings for some of the events
|
|
17
|
-
* 2. Additional work to manage selection
|
|
18
|
-
* 3. Any base/default styling work
|
|
19
|
-
*/
|
|
20
|
-
import { TextInputProps } from 'react-native';
|
|
21
|
-
import React from 'react';
|
|
22
|
-
declare class TextInput extends React.Component<TextInputProps, {}> {
|
|
23
|
-
private _rafID;
|
|
24
|
-
private readonly _inputRef;
|
|
25
|
-
private _lastNativeText;
|
|
26
|
-
private _eventCount;
|
|
27
|
-
constructor(props: any);
|
|
28
|
-
/**
|
|
29
|
-
* On mount TextInput needs to register itself with TextInputState
|
|
30
|
-
* and conditionally request an animation frame for focus.
|
|
31
|
-
*/
|
|
32
|
-
componentDidMount(): void;
|
|
33
|
-
/**
|
|
34
|
-
* This is an unfortunate consequence of having controlled TextInputs.
|
|
35
|
-
* Tree diffing reconciliation will not always send down text values
|
|
36
|
-
* This sets text explicitly.
|
|
37
|
-
*/
|
|
38
|
-
componentDidUpdate(): void;
|
|
39
|
-
/**
|
|
40
|
-
* Pre-unmoun the TextInput should blur, unregister and clean up
|
|
41
|
-
* the animation frame for focus (edge cases)
|
|
42
|
-
*/
|
|
43
|
-
componentWillUnmount(): void;
|
|
44
|
-
render(): JSX.Element;
|
|
45
|
-
/**
|
|
46
|
-
* Returns true if the TextInput is focused
|
|
47
|
-
*/
|
|
48
|
-
isFocused(): boolean;
|
|
49
|
-
/**
|
|
50
|
-
* Focuses the TextInput
|
|
51
|
-
*/
|
|
52
|
-
focus: () => void;
|
|
53
|
-
/**
|
|
54
|
-
* Blurs the TextInput
|
|
55
|
-
*/
|
|
56
|
-
blur: () => void;
|
|
57
|
-
/**
|
|
58
|
-
* Use clear for programmatic clearing of the text
|
|
59
|
-
*/
|
|
60
|
-
clear: () => void;
|
|
61
|
-
private readonly setEventCount;
|
|
62
|
-
private readonly setNativeText;
|
|
63
|
-
private readonly _getText;
|
|
64
|
-
private readonly _onChange;
|
|
65
|
-
private readonly _onFocus;
|
|
66
|
-
private readonly _onBlur;
|
|
67
|
-
}
|
|
68
|
-
export = TextInput;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TextInput.win32.js","sourceRoot":"","sources":["../../../src/Libraries/Components/TextInput/TextInput.win32.tsx"],"names":[],"mappings":"AAAA;;GAEG;AACH,YAAY,CAAC;;;;AAEb;;;;;;;;;;;;;;;;;;GAkBG;AAGH,+CAMsB;AAMtB,kDAAyB;AAEzB,MAAM,YAAY,GAAG,OAAO,CAAC,yBAAyB,CAAC,CAAC;AACxD,MAAM,cAAc,GAAG,OAAO,CAAC,kBAAkB,CAAC,CAAC;AAMnD,8DAA8D;AAC9D,MAAM,YAAY,GAAG,IAAA,qCAAsB,EAAoB,cAAc,CAAC,CAAC;AAE/E,8FAA8F;AAC9F,gFAAgF;AAChF,MAAM,oBAAoB,GAAQ,wBAAS,CAAC,oBAAoB,CAAC,cAAc,CAAC,CAAC;AAEjF,MAAM,S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QAAQ,EACvB,MAAM,EAAG,IAAI,CAAC,OAAO,EACrB,QAAQ,EAAG,IAAI,CAAC,SAAS,GACzB,CACoB,CACzB,CAAC;IACJ,CAAC;IAED;;OAEG;IACI,SAAS;QACd,OAAO,cAAc,CAAC,qBAAqB,EAAE,KAAK,IAAI,CAAC;IACzD,CAAC;CAkEF;AAED,iBAAS,SAAS,CAAC","sourcesContent":["/**\n * @providesModule TextInput\n */\n'use strict';\n\n/**\n * This is a forked and slightly modified version of React Native's TextInput.\n * The fork is necessary as platform checks in the base implementation made the\n * control unusable on win32. In addition to cleaning up some of the code, this\n * fork also uses Typescript rather than Flow for type safety.\n *\n * More general documentation on this control can be found at\n * https://facebook.github.io/react-native/docs/textinput.html\n *\n * The original implementation can be found at\n * https://github.com/facebook/react-native/blob/1013a010492a7bef5ff58073a088ac924a986e9e/Libraries/Components/TextInput/TextInput.js\n *\n * This control does not support the full React Native TextInput interface yet.\n * Most of the work necessary to make that happen needs to happen on the native side.\n * Future work on the JS side may include:\n * 1. Expanded typings for some of the events\n * 2. Additional work to manage selection\n * 3. Any base/default styling work\n */\n\n\nimport {\n findNodeHandle,\n requireNativeComponent,\n TextInputProps,\n NativeMethods,\n UIManager\n} from 'react-native';\nimport {\n IBlurEvent,\n IChangeEvent,\n IFocusEvent,\n} from './TextInput.Types.win32';\nimport React from 'react'\n\nconst TextAncestor = require('../../Text/TextAncestor');\nconst TextInputState = require('./TextInputState');\n\ntype RCTTextInputProps = TextInputProps & {\n text: string;\n};\n\n// RCTTextInput is the native component that win32 understands\nconst RCTTextInput = requireNativeComponent<RCTTextInputProps>('RCTTextInput');\n\n// Adding typings on ViewManagers is problematic as available functionality is not known until\n// registration at runtime and would require native and js to always be in sync.\nconst TextInputViewManager: any = UIManager.getViewManagerConfig('RCTTextInput');\n\nclass TextInput extends React.Component<TextInputProps, {}> {\n // TODO: Once the native side begins supporting programmatic selection\n // this will become important for selection management\n // private _lastNativeTextSelection: any;\n\n private _rafID: number;\n\n private readonly _inputRef: React.RefObject<React.Component<RCTTextInputProps> & Readonly<NativeMethods>>;\n private _lastNativeText: string;\n private _eventCount = 0;\n\n constructor(props) {\n super(props);\n this._inputRef = React.createRef();\n }\n\n /**\n * On mount TextInput needs to register itself with TextInputState\n * and conditionally request an animation frame for focus.\n */\n public componentDidMount() {\n this._lastNativeText = this.props.value;\n\n TextInputState.registerInput(this);\n\n if (this.props.autoFocus) {\n this._rafID = requestAnimationFrame(this.focus);\n }\n }\n\n /**\n * This is an unfortunate consequence of having controlled TextInputs.\n * Tree diffing reconciliation will not always send down text values\n * This sets text explicitly.\n */\n public componentDidUpdate() {\n if ((this._lastNativeText !== this._getText())) {\n this._getText() && this.setNativeText(this._getText());\n }\n\n return;\n }\n\n /**\n * Pre-unmoun the TextInput should blur, unregister and clean up\n * the animation frame for focus (edge cases)\n */\n public componentWillUnmount() {\n // blur\n if (this.isFocused()) {\n this.blur();\n }\n\n // unregister\n TextInputState.unregisterInput(this);\n\n // cancel animationFrame\n if (this._rafID !== null) {\n cancelAnimationFrame(this._rafID);\n }\n if (this._rafID) {\n return;\n }\n return;\n }\n\n public render() {\n const props: TextInputProps = { ...this.props };\n\n // By default fontScaling is turned on.\n // win32 ignores this prop for the time being\n props.allowFontScaling = (this.props.allowFontScaling === null\n || this.props.allowFontScaling === undefined)\n ? true : this.props.allowFontScaling;\n\n return (\n <TextAncestor.Provider value={ true }>\n <RCTTextInput\n { ...props }\n ref={ this._inputRef }\n text={ this._getText() }\n onFocus={ this._onFocus }\n onBlur={ this._onBlur }\n onChange={ this._onChange }\n />\n </TextAncestor.Provider>\n );\n }\n\n /**\n * Returns true if the TextInput is focused\n */\n public isFocused(): boolean {\n return TextInputState.currentlyFocusedInput() === this;\n }\n\n /**\n * Focuses the TextInput\n */\n public focus = (): void => {\n TextInputState.setFocusedTextInput(this);\n UIManager.\n dispatchViewManagerCommand(findNodeHandle(this), TextInputViewManager.Commands.focus, null);\n }\n\n /**\n * Blurs the TextInput\n */\n public blur = (): void => {\n TextInputState.blurTextInput(this);\n UIManager.\n dispatchViewManagerCommand(findNodeHandle(this), TextInputViewManager.Commands.blur, null);\n }\n\n /**\n * Use clear for programmatic clearing of the text\n */\n public clear = (): void => {\n this.setNativeText('');\n }\n\n private readonly setEventCount = (): void => {\n UIManager.\n dispatchViewManagerCommand(findNodeHandle(this), TextInputViewManager.Commands.setEventCount,\n [ this._eventCount ]);\n }\n\n private readonly setNativeText = (val: string): void => {\n if (this._lastNativeText !== val) {\n UIManager.\n dispatchViewManagerCommand(findNodeHandle(this), TextInputViewManager.Commands.setNativeText,\n [ val ]);\n }\n }\n\n private readonly _getText = (): string | null => {\n return this.props.value || (this.props.defaultValue || null);\n }\n\n private readonly _onChange = (e: IChangeEvent): void => {\n const text = e.nativeEvent.text;\n this._eventCount = e.nativeEvent.eventCount;\n this.setEventCount();\n\n this.props.onChange && this.props.onChange(e);\n this.props.onChangeText && this.props.onChangeText(text);\n this._lastNativeText = text;\n\n this.forceUpdate();\n return;\n }\n\n private readonly _onFocus = (e: IFocusEvent): void => {\n this.focus();\n this.props.onFocus && this.props.onFocus(e);\n }\n\n private readonly _onBlur = (e: IBlurEvent): void => {\n this.props.onBlur && this.props.onBlur(e);\n }\n}\n\nexport = TextInput;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TouchableNativeFeedback.Props.js","sourceRoot":"","sources":["../../../src/Libraries/Components/Touchable/TouchableNativeFeedback.Props.ts"],"names":[],"mappings":"","sourcesContent":["import { IViewWin32Props } from '../View/ViewWin32.Props';\n\nexport interface ITouchableNativeFeedbackProps extends IViewWin32Props {\n // ViewProperties {\n onPress: (event: Record<string, any>) => void;\n disabled?: boolean;\n accessibilityLabel: string;\n tooltip?: string;\n}\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"TouchableNativeFeedback.win32.js","sourceRoot":"","sources":["../../../src/Libraries/Components/Touchable/TouchableNativeFeedback.win32.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,YAAY,CAAC;;;;AAEb,kDAAyB;AACzB,+CAAsD;AAItD,MAAM,uBAAwB,SAAQ,eAAK,CAAC,SAA4C;IAC/E,MAAM;QACX,OAAO,8BAAC,0BAA0B,OAAK,IAAI,CAAC,KAAK,IAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAA8B,CAAC;IACxG,CAAC;CACF;AAED,MAAM,0BAA0B,GAAG,IAAA,qCAAsB,EAAC,4BAA4B,CAAC,CAAC;AAExF,iBAAS,uBAAuB,CAAC","sourcesContent":["/**\n * Copyright (c) 2015-present, Facebook, Inc.\n * All rights reserved.\n *\n * This source code is licensed under the BSD-style license found in the\n * LICENSE file in the root directory of this source tree. An additional grant\n * of patent rights can be found in the PATENTS file in the same directory.\n *\n * @providesModule TouchableNativeFeedback\n */\n\n'use strict';\n\nimport React from 'react'\nimport { requireNativeComponent } from 'react-native';\n\nimport { ITouchableNativeFeedbackProps } from './TouchableNativeFeedback.Props';\n\nclass TouchableNativeFeedback extends React.Component<ITouchableNativeFeedbackProps, {}> {\n public render() {\n return <RCTTouchableNativeFeedback {...this.props}>{this.props.children}</RCTTouchableNativeFeedback>;\n }\n}\n\nconst RCTTouchableNativeFeedback = requireNativeComponent('RCTTouchableNativeFeedback');\n\nexport = TouchableNativeFeedback;\n"]}
|