@react-native-oh/react-native-harmony 0.72.86 → 0.77.18
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/LICENSE +21 -0
- package/LICENSE-Meta +21 -0
- package/Libraries/Alert/delegates/AlertDelegate.harmony.ts +84 -0
- package/Libraries/Alert/{AlertManager.ts → delegates/AlertManager.harmony.ts} +10 -4
- package/Libraries/Animated/shouldUseTurboAnimatedModule.harmony.ts +10 -0
- package/Libraries/Components/AccessibilityInfo/delegates/AccessibilityInfoDelegate.harmony.ts +44 -0
- package/Libraries/Components/AccessibilityInfo/{NativeAccessibilityInfoHarmony.ts → delegates/NativeAccessibilityInfoHarmony.harmony.ts} +9 -2
- package/Libraries/Components/Keyboard/delegates/KeyboardAvoidingViewDelegate.harmony.ts +42 -0
- package/Libraries/Components/RefreshControl/delegates/RefreshControlDelegate.harmony.tsx +29 -0
- package/Libraries/Components/SafeAreaView/SafeAreaView.harmony.tsx +93 -31
- package/Libraries/Components/ScrollView/delegates/ScrollViewDelegate.harmony.tsx +41 -0
- package/Libraries/Components/ScrollView/delegates/ScrollViewNativeComponentDelegate.harmony.ts +89 -0
- package/Libraries/Components/ScrollView/processDecelerationRate.harmony.ts +19 -0
- package/Libraries/Components/StatusBar/delegates/NativeStatusBarManagerHarmony.harmony.ts +53 -0
- package/Libraries/Components/StatusBar/delegates/StatusBarDelegate.harmony.ts +83 -0
- package/Libraries/Components/TextInput/delegates/TextInputDelegate.harmony.tsx +98 -0
- package/Libraries/Components/TextInput/delegates/TextInputStateDelegate.harmony.tsx +20 -0
- package/Libraries/Components/Touchable/delegates/TouchableHighlightDelegate.harmony.ts +14 -0
- package/Libraries/Components/Touchable/delegates/TouchableNativeFeedbackDelegate.harmony.ts +14 -0
- package/Libraries/Components/Touchable/delegates/TouchableWithoutFeedbackDelegate.harmony.ts +14 -0
- package/Libraries/Components/delegates/ButtonDelegate.harmony.ts +41 -0
- package/Libraries/Core/setUpPlatform.harmony.js +30 -0
- package/Libraries/Image/AssetSourceResolver.harmony.ts +1 -5
- package/Libraries/Image/Image.harmony.ts +17 -0
- package/Libraries/NativeComponent/BaseViewConfig.harmony.js +12 -326
- package/Libraries/NativeComponent/delegates/ViewConfigIgnoreDelegate.harmony.ts +13 -0
- package/Libraries/ReactNative/delegates/BridgelessUIManagerDelegate.harmony.ts +14 -0
- package/Libraries/ReactNative/delegates/I18nManagerDelegate.harmony.ts +22 -0
- package/Libraries/Settings/Settings.harmony.ts +20 -0
- package/Libraries/Share/delegates/ShareDelegate.harmony.ts +42 -0
- package/Libraries/StyleSheet/NativePlatformColor.harmony.ts +15 -0
- package/Libraries/StyleSheet/PlatformColorValueTypes.harmony.ts +8 -1
- package/Libraries/Utilities/BackHandler.harmony.ts +10 -0
- package/Libraries/Utilities/NativePlatformConstantsHarmony.harmony.ts +17 -0
- package/Libraries/Utilities/Platform.harmony.ts +38 -13
- package/Libraries/Vibration/delegates/VibrationDelegate.harmony.ts +14 -0
- package/NOTICE.md +846 -0
- package/README.md +2 -2
- package/index.js +53 -63
- package/jest.config.js +0 -7
- package/metro.config.d.ts +17 -0
- package/metro.config.js +398 -115
- package/package.json +58 -37
- package/react-native.config.js +57 -9
- package/react_native_openharmony.har +0 -0
- package/tsconfig.json +10 -4
- package/types/index.harmony.d.ts +99 -0
- package/Libraries/Alert/Alert.harmony.js +0 -77
- package/Libraries/Animated/NativeAnimatedHelper.harmony.js +0 -601
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.harmony.js +0 -441
- package/Libraries/Components/Button/Button.harmony.js +0 -451
- package/Libraries/Components/Image/Image.flow.harmony.js +0 -53
- package/Libraries/Components/Image/Image.harmony.js +0 -317
- package/Libraries/Components/Image/NativeImageLoaderHarmony.js +0 -38
- package/Libraries/Components/Keyboard/KeyboardAvoidingView.harmony.js +0 -256
- package/Libraries/Components/RefreshControl/RefreshControl.harmony.js +0 -210
- package/Libraries/Components/ScrollView/ScrollView.harmony.js +0 -1951
- package/Libraries/Components/ScrollView/processDecelerationRate.harmony.js +0 -24
- package/Libraries/Components/StatusBar/NativeStatusBarManagerHarmony.js +0 -71
- package/Libraries/Components/StatusBar/StatusBar.harmony.js +0 -447
- package/Libraries/Components/TextInput/TextInput.harmony.js +0 -1716
- package/Libraries/Components/TextInput/TextInputState.harmony.js +0 -220
- package/Libraries/Components/Touchable/TouchableHighlight.harmony.js +0 -396
- package/Libraries/Components/Touchable/TouchableNativeFeedback.harmony.js +0 -364
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.harmony.js +0 -227
- package/Libraries/Components/View/View.harmony.js +0 -149
- package/Libraries/Core/setUpReactDevTools.harmony.js +0 -93
- package/Libraries/ReactNative/I18nManager.harmony.js +0 -78
- package/Libraries/ReactNative/UIManager.harmony.js +0 -210
- package/Libraries/Settings/Settings.harmony.js +0 -15
- package/Libraries/Share/Share.harmony.js +0 -174
- package/Libraries/StyleSheet/NativePlatformColor.ts +0 -8
- package/Libraries/Utilities/BackHandler.harmony.js +0 -109
- package/Libraries/Utilities/NativePlatformConstants.harmony.ts +0 -8
- package/Libraries/Utilities/Platform.d.ts +0 -117
- package/Libraries/Utilities/createPerformanceLogger.harmony.js +0 -328
- package/Libraries/Vibration/Vibration.harmony.js +0 -88
- package/harmony/.keep +0 -0
- package/harmony/rnoh-hvigor-plugin-0.2.0.tgz +0 -0
- package/react_native_openharmony_release.har +0 -0
- package/types/index.d.ts +0 -108
|
@@ -1,328 +0,0 @@
|
|
|
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
|
-
* @flow strict
|
|
8
|
-
* @format
|
|
9
|
-
*/
|
|
10
|
-
|
|
11
|
-
const Systrace = require('react-native/Libraries/Performance/Systrace'); // RNOH: patch
|
|
12
|
-
const infoLog = require('react-native/Libraries/Utilities/infoLog'); // RNOH: patch
|
|
13
|
-
|
|
14
|
-
export type Timespan = {
|
|
15
|
-
startTime: number,
|
|
16
|
-
endTime?: number,
|
|
17
|
-
totalTime?: number,
|
|
18
|
-
startExtras?: Extras,
|
|
19
|
-
endExtras?: Extras,
|
|
20
|
-
};
|
|
21
|
-
|
|
22
|
-
// Extra values should be serializable primitives
|
|
23
|
-
export type ExtraValue = number | string | boolean;
|
|
24
|
-
|
|
25
|
-
export type Extras = {[key: string]: ExtraValue};
|
|
26
|
-
|
|
27
|
-
export interface IPerformanceLogger {
|
|
28
|
-
addTimespan(
|
|
29
|
-
key: string,
|
|
30
|
-
startTime: number,
|
|
31
|
-
endTime: number,
|
|
32
|
-
startExtras?: Extras,
|
|
33
|
-
endExtras?: Extras,
|
|
34
|
-
): void;
|
|
35
|
-
append(logger: IPerformanceLogger): void;
|
|
36
|
-
clear(): void;
|
|
37
|
-
clearCompleted(): void;
|
|
38
|
-
close(): void;
|
|
39
|
-
currentTimestamp(): number;
|
|
40
|
-
getExtras(): $ReadOnly<{[key: string]: ?ExtraValue, ...}>;
|
|
41
|
-
getPoints(): $ReadOnly<{[key: string]: ?number, ...}>;
|
|
42
|
-
getPointExtras(): $ReadOnly<{[key: string]: ?Extras, ...}>;
|
|
43
|
-
getTimespans(): $ReadOnly<{[key: string]: ?Timespan, ...}>;
|
|
44
|
-
hasTimespan(key: string): boolean;
|
|
45
|
-
isClosed(): boolean;
|
|
46
|
-
logEverything(): void;
|
|
47
|
-
markPoint(key: string, timestamp?: number, extras?: Extras): void;
|
|
48
|
-
removeExtra(key: string): ?ExtraValue;
|
|
49
|
-
setExtra(key: string, value: ExtraValue): void;
|
|
50
|
-
startTimespan(key: string, timestamp?: number, extras?: Extras): void;
|
|
51
|
-
stopTimespan(key: string, timestamp?: number, extras?: Extras): void;
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
const _cookies: {[key: string]: number, ...} = {};
|
|
55
|
-
|
|
56
|
-
const PRINT_TO_CONSOLE: false = false; // Type as false to prevent accidentally committing `true`;
|
|
57
|
-
|
|
58
|
-
export const getCurrentTimestamp: () => number =
|
|
59
|
-
global.nativeQPLTimestamp ?? global.performance ? global.performance.now.bind(global.performance) : Date.now; // RNOH: patch
|
|
60
|
-
|
|
61
|
-
class PerformanceLogger implements IPerformanceLogger {
|
|
62
|
-
_timespans: {[key: string]: ?Timespan} = {};
|
|
63
|
-
_extras: {[key: string]: ?ExtraValue} = {};
|
|
64
|
-
_points: {[key: string]: ?number} = {};
|
|
65
|
-
_pointExtras: {[key: string]: ?Extras, ...} = {};
|
|
66
|
-
_closed: boolean = false;
|
|
67
|
-
|
|
68
|
-
addTimespan(
|
|
69
|
-
key: string,
|
|
70
|
-
startTime: number,
|
|
71
|
-
endTime: number,
|
|
72
|
-
startExtras?: Extras,
|
|
73
|
-
endExtras?: Extras,
|
|
74
|
-
) {
|
|
75
|
-
if (this._closed) {
|
|
76
|
-
if (PRINT_TO_CONSOLE && __DEV__) {
|
|
77
|
-
infoLog('PerformanceLogger: addTimespan - has closed ignoring: ', key);
|
|
78
|
-
}
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
if (this._timespans[key]) {
|
|
82
|
-
if (PRINT_TO_CONSOLE && __DEV__) {
|
|
83
|
-
infoLog(
|
|
84
|
-
'PerformanceLogger: Attempting to add a timespan that already exists ',
|
|
85
|
-
key,
|
|
86
|
-
);
|
|
87
|
-
}
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
|
|
91
|
-
this._timespans[key] = {
|
|
92
|
-
startTime,
|
|
93
|
-
endTime,
|
|
94
|
-
totalTime: endTime - (startTime || 0),
|
|
95
|
-
startExtras,
|
|
96
|
-
endExtras,
|
|
97
|
-
};
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
append(performanceLogger: IPerformanceLogger) {
|
|
101
|
-
this._timespans = {
|
|
102
|
-
...performanceLogger.getTimespans(),
|
|
103
|
-
...this._timespans,
|
|
104
|
-
};
|
|
105
|
-
this._extras = {...performanceLogger.getExtras(), ...this._extras};
|
|
106
|
-
this._points = {...performanceLogger.getPoints(), ...this._points};
|
|
107
|
-
this._pointExtras = {
|
|
108
|
-
...performanceLogger.getPointExtras(),
|
|
109
|
-
...this._pointExtras,
|
|
110
|
-
};
|
|
111
|
-
}
|
|
112
|
-
|
|
113
|
-
clear() {
|
|
114
|
-
this._timespans = {};
|
|
115
|
-
this._extras = {};
|
|
116
|
-
this._points = {};
|
|
117
|
-
if (PRINT_TO_CONSOLE) {
|
|
118
|
-
infoLog('PerformanceLogger.js', 'clear');
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
clearCompleted() {
|
|
123
|
-
for (const key in this._timespans) {
|
|
124
|
-
if (this._timespans[key]?.totalTime != null) {
|
|
125
|
-
delete this._timespans[key];
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
this._extras = {};
|
|
129
|
-
this._points = {};
|
|
130
|
-
if (PRINT_TO_CONSOLE) {
|
|
131
|
-
infoLog('PerformanceLogger.js', 'clearCompleted');
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
close() {
|
|
136
|
-
this._closed = true;
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
currentTimestamp(): number {
|
|
140
|
-
return getCurrentTimestamp();
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
getExtras(): {[key: string]: ?ExtraValue} {
|
|
144
|
-
return this._extras;
|
|
145
|
-
}
|
|
146
|
-
|
|
147
|
-
getPoints(): {[key: string]: ?number} {
|
|
148
|
-
return this._points;
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
getPointExtras(): {[key: string]: ?Extras} {
|
|
152
|
-
return this._pointExtras;
|
|
153
|
-
}
|
|
154
|
-
|
|
155
|
-
getTimespans(): {[key: string]: ?Timespan} {
|
|
156
|
-
return this._timespans;
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
hasTimespan(key: string): boolean {
|
|
160
|
-
return !!this._timespans[key];
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
isClosed(): boolean {
|
|
164
|
-
return this._closed;
|
|
165
|
-
}
|
|
166
|
-
|
|
167
|
-
logEverything() {
|
|
168
|
-
if (PRINT_TO_CONSOLE) {
|
|
169
|
-
// log timespans
|
|
170
|
-
for (const key in this._timespans) {
|
|
171
|
-
if (this._timespans[key]?.totalTime != null) {
|
|
172
|
-
infoLog(key + ': ' + this._timespans[key].totalTime + 'ms');
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
|
|
176
|
-
// log extras
|
|
177
|
-
infoLog(this._extras);
|
|
178
|
-
|
|
179
|
-
// log points
|
|
180
|
-
for (const key in this._points) {
|
|
181
|
-
if (this._points[key] != null) {
|
|
182
|
-
infoLog(key + ': ' + this._points[key] + 'ms');
|
|
183
|
-
}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
markPoint(
|
|
189
|
-
key: string,
|
|
190
|
-
timestamp?: number = getCurrentTimestamp(),
|
|
191
|
-
extras?: Extras,
|
|
192
|
-
) {
|
|
193
|
-
if (this._closed) {
|
|
194
|
-
if (PRINT_TO_CONSOLE && __DEV__) {
|
|
195
|
-
infoLog('PerformanceLogger: markPoint - has closed ignoring: ', key);
|
|
196
|
-
}
|
|
197
|
-
return;
|
|
198
|
-
}
|
|
199
|
-
if (this._points[key] != null) {
|
|
200
|
-
if (PRINT_TO_CONSOLE && __DEV__) {
|
|
201
|
-
infoLog(
|
|
202
|
-
'PerformanceLogger: Attempting to mark a point that has been already logged ',
|
|
203
|
-
key,
|
|
204
|
-
);
|
|
205
|
-
}
|
|
206
|
-
return;
|
|
207
|
-
}
|
|
208
|
-
this._points[key] = timestamp;
|
|
209
|
-
if (extras) {
|
|
210
|
-
this._pointExtras[key] = extras;
|
|
211
|
-
}
|
|
212
|
-
}
|
|
213
|
-
|
|
214
|
-
removeExtra(key: string): ?ExtraValue {
|
|
215
|
-
const value = this._extras[key];
|
|
216
|
-
delete this._extras[key];
|
|
217
|
-
return value;
|
|
218
|
-
}
|
|
219
|
-
|
|
220
|
-
setExtra(key: string, value: ExtraValue) {
|
|
221
|
-
if (this._closed) {
|
|
222
|
-
if (PRINT_TO_CONSOLE && __DEV__) {
|
|
223
|
-
infoLog('PerformanceLogger: setExtra - has closed ignoring: ', key);
|
|
224
|
-
}
|
|
225
|
-
return;
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
if (this._extras.hasOwnProperty(key)) {
|
|
229
|
-
if (PRINT_TO_CONSOLE && __DEV__) {
|
|
230
|
-
infoLog(
|
|
231
|
-
'PerformanceLogger: Attempting to set an extra that already exists ',
|
|
232
|
-
{key, currentValue: this._extras[key], attemptedValue: value},
|
|
233
|
-
);
|
|
234
|
-
}
|
|
235
|
-
return;
|
|
236
|
-
}
|
|
237
|
-
this._extras[key] = value;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
startTimespan(
|
|
241
|
-
key: string,
|
|
242
|
-
timestamp?: number = getCurrentTimestamp(),
|
|
243
|
-
extras?: Extras,
|
|
244
|
-
) {
|
|
245
|
-
if (this._closed) {
|
|
246
|
-
if (PRINT_TO_CONSOLE && __DEV__) {
|
|
247
|
-
infoLog(
|
|
248
|
-
'PerformanceLogger: startTimespan - has closed ignoring: ',
|
|
249
|
-
key,
|
|
250
|
-
);
|
|
251
|
-
}
|
|
252
|
-
return;
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
if (this._timespans[key]) {
|
|
256
|
-
if (PRINT_TO_CONSOLE && __DEV__) {
|
|
257
|
-
infoLog(
|
|
258
|
-
'PerformanceLogger: Attempting to start a timespan that already exists ',
|
|
259
|
-
key,
|
|
260
|
-
);
|
|
261
|
-
}
|
|
262
|
-
return;
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
this._timespans[key] = {
|
|
266
|
-
startTime: timestamp,
|
|
267
|
-
startExtras: extras,
|
|
268
|
-
};
|
|
269
|
-
_cookies[key] = Systrace.beginAsyncEvent(key);
|
|
270
|
-
if (PRINT_TO_CONSOLE) {
|
|
271
|
-
infoLog('PerformanceLogger.js', 'start: ' + key);
|
|
272
|
-
}
|
|
273
|
-
}
|
|
274
|
-
|
|
275
|
-
stopTimespan(
|
|
276
|
-
key: string,
|
|
277
|
-
timestamp?: number = getCurrentTimestamp(),
|
|
278
|
-
extras?: Extras,
|
|
279
|
-
) {
|
|
280
|
-
if (this._closed) {
|
|
281
|
-
if (PRINT_TO_CONSOLE && __DEV__) {
|
|
282
|
-
infoLog('PerformanceLogger: stopTimespan - has closed ignoring: ', key);
|
|
283
|
-
}
|
|
284
|
-
return;
|
|
285
|
-
}
|
|
286
|
-
|
|
287
|
-
const timespan = this._timespans[key];
|
|
288
|
-
if (!timespan || timespan.startTime == null) {
|
|
289
|
-
if (PRINT_TO_CONSOLE && __DEV__) {
|
|
290
|
-
infoLog(
|
|
291
|
-
'PerformanceLogger: Attempting to end a timespan that has not started ',
|
|
292
|
-
key,
|
|
293
|
-
);
|
|
294
|
-
}
|
|
295
|
-
return;
|
|
296
|
-
}
|
|
297
|
-
if (timespan.endTime != null) {
|
|
298
|
-
if (PRINT_TO_CONSOLE && __DEV__) {
|
|
299
|
-
infoLog(
|
|
300
|
-
'PerformanceLogger: Attempting to end a timespan that has already ended ',
|
|
301
|
-
key,
|
|
302
|
-
);
|
|
303
|
-
}
|
|
304
|
-
return;
|
|
305
|
-
}
|
|
306
|
-
|
|
307
|
-
timespan.endExtras = extras;
|
|
308
|
-
timespan.endTime = timestamp;
|
|
309
|
-
timespan.totalTime = timespan.endTime - (timespan.startTime || 0);
|
|
310
|
-
if (PRINT_TO_CONSOLE) {
|
|
311
|
-
infoLog('PerformanceLogger.js', 'end: ' + key);
|
|
312
|
-
}
|
|
313
|
-
|
|
314
|
-
if (_cookies[key] != null) {
|
|
315
|
-
Systrace.endAsyncEvent(key, _cookies[key]);
|
|
316
|
-
delete _cookies[key];
|
|
317
|
-
}
|
|
318
|
-
}
|
|
319
|
-
}
|
|
320
|
-
|
|
321
|
-
/**
|
|
322
|
-
* This function creates performance loggers that can be used to collect and log
|
|
323
|
-
* various performance data such as timespans, points and extras.
|
|
324
|
-
* The loggers need to have minimal overhead since they're used in production.
|
|
325
|
-
*/
|
|
326
|
-
export default function createPerformanceLogger(): IPerformanceLogger {
|
|
327
|
-
return new PerformanceLogger();
|
|
328
|
-
}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
// This implementation is based on iOS logic from file - react-native/Libraries/Vibration/Vibration.js
|
|
2
|
-
import NativeVibration from 'react-native/Libraries/Vibration/NativeVibration'; // RNOH: patch
|
|
3
|
-
|
|
4
|
-
/**
|
|
5
|
-
* Vibration API
|
|
6
|
-
*
|
|
7
|
-
* See https://reactnative.dev/docs/vibration
|
|
8
|
-
*/
|
|
9
|
-
|
|
10
|
-
let _vibrating: boolean = false;
|
|
11
|
-
let _id: number = 0; // _id is necessary to prevent race condition.
|
|
12
|
-
const _default_vibration_length = 400;
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
function vibrateByPattern(pattern: Array<number>, repeat: boolean = false) {
|
|
16
|
-
if (_vibrating) {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
_vibrating = true;
|
|
20
|
-
if (pattern.length === 0) {
|
|
21
|
-
_vibrating = false;
|
|
22
|
-
return;
|
|
23
|
-
}
|
|
24
|
-
vibrateScheduler(++_id, pattern, repeat, 0);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
function vibrateScheduler(
|
|
28
|
-
id: number,
|
|
29
|
-
pattern: Array<number>,
|
|
30
|
-
repeat: boolean,
|
|
31
|
-
nextIndex: number,
|
|
32
|
-
shouldVibrate: boolean = false, // first value in pattern is delay
|
|
33
|
-
) {
|
|
34
|
-
if (!_vibrating || id !== _id) {
|
|
35
|
-
return;
|
|
36
|
-
}
|
|
37
|
-
if (shouldVibrate && nextIndex < pattern.length) {
|
|
38
|
-
NativeVibration.vibrate(pattern[nextIndex]);
|
|
39
|
-
}
|
|
40
|
-
if (nextIndex >= pattern.length) {
|
|
41
|
-
if (repeat) {
|
|
42
|
-
// $FlowFixMe[reassign-const]
|
|
43
|
-
nextIndex = 0;
|
|
44
|
-
shouldVibrate = false;
|
|
45
|
-
} else {
|
|
46
|
-
_vibrating = false;
|
|
47
|
-
return;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
setTimeout(
|
|
51
|
-
() => vibrateScheduler(id, pattern, repeat, nextIndex + 1, !shouldVibrate),
|
|
52
|
-
pattern[nextIndex],
|
|
53
|
-
);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
const Vibration = {
|
|
57
|
-
/**
|
|
58
|
-
* Trigger a vibration with specified `pattern`.
|
|
59
|
-
*
|
|
60
|
-
* See https://reactnative.dev/docs/vibration#vibrate
|
|
61
|
-
*/
|
|
62
|
-
vibrate: function (
|
|
63
|
-
pattern: number | Array<number> = _default_vibration_length,
|
|
64
|
-
repeat: boolean = false,
|
|
65
|
-
) {
|
|
66
|
-
if (_vibrating) {
|
|
67
|
-
return;
|
|
68
|
-
}
|
|
69
|
-
if (typeof pattern === 'number') {
|
|
70
|
-
NativeVibration.vibrate(pattern);
|
|
71
|
-
} else if (Array.isArray(pattern)) {
|
|
72
|
-
vibrateByPattern(pattern, repeat);
|
|
73
|
-
} else {
|
|
74
|
-
throw new Error('Vibration pattern should be a number or array');
|
|
75
|
-
}
|
|
76
|
-
},
|
|
77
|
-
/**
|
|
78
|
-
* Stop vibration
|
|
79
|
-
*
|
|
80
|
-
* See https://reactnative.dev/docs/vibration#cancel
|
|
81
|
-
*/
|
|
82
|
-
cancel: function () {
|
|
83
|
-
_vibrating = false;
|
|
84
|
-
NativeVibration.cancel();
|
|
85
|
-
},
|
|
86
|
-
};
|
|
87
|
-
|
|
88
|
-
module.exports = Vibration;
|
package/harmony/.keep
DELETED
|
File without changes
|
|
Binary file
|
|
Binary file
|
package/types/index.d.ts
DELETED
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Copyright (c) 2024 Huawei Technologies Co., Ltd.
|
|
3
|
-
*
|
|
4
|
-
* This source code is licensed under the MIT license found in the
|
|
5
|
-
* LICENSE-MIT file in the root directory of this source tree.
|
|
6
|
-
*/
|
|
7
|
-
|
|
8
|
-
// export * from 'react-native/Libraries/ActionSheetIOS/ActionSheetIOS';
|
|
9
|
-
export * from 'react-native/Libraries/Alert/Alert';
|
|
10
|
-
export * from 'react-native/Libraries/Animated/Animated';
|
|
11
|
-
export * from 'react-native/Libraries/Animated/Easing';
|
|
12
|
-
export * from 'react-native/Libraries/Animated/useAnimatedValue';
|
|
13
|
-
export * from 'react-native/Libraries/Utilities/useColorScheme';
|
|
14
|
-
export * from 'react-native/Libraries/AppState/AppState';
|
|
15
|
-
export * from 'react-native/Libraries/BatchedBridge/NativeModules';
|
|
16
|
-
export * from 'react-native/Libraries/Components/AccessibilityInfo/AccessibilityInfo';
|
|
17
|
-
export * from 'react-native/Libraries/Components/ActivityIndicator/ActivityIndicator';
|
|
18
|
-
// export * from 'react-native/Libraries/Components/Clipboard/Clipboard';
|
|
19
|
-
// export * from 'react-native/Libraries/Components/DatePicker/DatePickerIOS';
|
|
20
|
-
export * from 'react-native/Libraries/Components/DrawerAndroid/DrawerLayoutAndroid';
|
|
21
|
-
export * from 'react-native/Libraries/Components/Keyboard/Keyboard';
|
|
22
|
-
export * from 'react-native/Libraries/Components/Keyboard/KeyboardAvoidingView';
|
|
23
|
-
export * from 'react-native/Libraries/Components/Pressable/Pressable';
|
|
24
|
-
// export * from 'react-native/Libraries/Components/ProgressBarAndroid/ProgressBarAndroid';
|
|
25
|
-
// export * from 'react-native/Libraries/Components/ProgressViewIOS/ProgressViewIOS';
|
|
26
|
-
export * from 'react-native/Libraries/Components/RefreshControl/RefreshControl';
|
|
27
|
-
export * from 'react-native/Libraries/Components/SafeAreaView/SafeAreaView';
|
|
28
|
-
export * from 'react-native/Libraries/Components/ScrollView/ScrollView';
|
|
29
|
-
// export * from 'react-native/Libraries/Components/Slider/Slider';
|
|
30
|
-
export * from 'react-native/Libraries/Components/StatusBar/StatusBar';
|
|
31
|
-
export * from 'react-native/Libraries/Components/Switch/Switch';
|
|
32
|
-
// export * from 'react-native/Libraries/Components/TextInput/InputAccessoryView';
|
|
33
|
-
export * from 'react-native/Libraries/Components/TextInput/TextInput';
|
|
34
|
-
export * from 'react-native/Libraries/Components/ToastAndroid/ToastAndroid';
|
|
35
|
-
export * from 'react-native/Libraries/Components/Touchable/Touchable';
|
|
36
|
-
export * from 'react-native/Libraries/Components/Touchable/TouchableHighlight';
|
|
37
|
-
export * from 'react-native/Libraries/Components/Touchable/TouchableNativeFeedback';
|
|
38
|
-
export * from 'react-native/Libraries/Components/Touchable/TouchableOpacity';
|
|
39
|
-
export * from 'react-native/Libraries/Components/Touchable/TouchableWithoutFeedback';
|
|
40
|
-
export * from 'react-native/Libraries/Components/View/View';
|
|
41
|
-
export * from 'react-native/Libraries/Components/View/ViewAccessibility';
|
|
42
|
-
export * from 'react-native/Libraries/Components/View/ViewPropTypes';
|
|
43
|
-
export * from 'react-native/Libraries/Components/Button';
|
|
44
|
-
export * from 'react-native/Libraries/EventEmitter/NativeEventEmitter';
|
|
45
|
-
export * from 'react-native/Libraries/EventEmitter/RCTDeviceEventEmitter';
|
|
46
|
-
// export * from 'react-native/Libraries/EventEmitter/RCTNativeAppEventEmitter';
|
|
47
|
-
export * from 'react-native/Libraries/Image/Image';
|
|
48
|
-
export * from 'react-native/Libraries/Image/ImageBackground';
|
|
49
|
-
// export * from 'react-native/Libraries/Image/ImageResizeMode';
|
|
50
|
-
// export * from 'react-native/Libraries/Image/ImageSource';
|
|
51
|
-
export * from 'react-native/Libraries/Interaction/InteractionManager';
|
|
52
|
-
export * from 'react-native/Libraries/Interaction/PanResponder';
|
|
53
|
-
export * from 'react-native/Libraries/LayoutAnimation/LayoutAnimation';
|
|
54
|
-
export * from 'react-native/Libraries/Linking/Linking';
|
|
55
|
-
export * from 'react-native/Libraries/Lists/FlatList';
|
|
56
|
-
export * from 'react-native/Libraries/Lists/SectionList';
|
|
57
|
-
export * from '@react-native/virtualized-lists';
|
|
58
|
-
export * from 'react-native/Libraries/LogBox/LogBox';
|
|
59
|
-
export * from 'react-native/Libraries/Modal/Modal';
|
|
60
|
-
export * as Systrace from 'react-native/Libraries/Performance/Systrace';
|
|
61
|
-
// export * from 'react-native/Libraries/PermissionsAndroid/PermissionsAndroid';
|
|
62
|
-
// export * from 'react-native/Libraries/PushNotificationIOS/PushNotificationIOS';
|
|
63
|
-
export * from 'react-native/Libraries/ReactNative/AppRegistry';
|
|
64
|
-
export * from 'react-native/Libraries/ReactNative/I18nManager';
|
|
65
|
-
export * from 'react-native/Libraries/ReactNative/RendererProxy';
|
|
66
|
-
export * from 'react-native/Libraries/ReactNative/RootTag';
|
|
67
|
-
export * from 'react-native/Libraries/ReactNative/UIManager';
|
|
68
|
-
export * from 'react-native/Libraries/ReactNative/requireNativeComponent';
|
|
69
|
-
// export * from 'react-native/Libraries/Settings/Settings';
|
|
70
|
-
export * from 'react-native/Libraries/Share/Share';
|
|
71
|
-
export * from 'react-native/Libraries/StyleSheet/PlatformColorValueTypesIOS';
|
|
72
|
-
export * from 'react-native/Libraries/StyleSheet/PlatformColorValueTypes';
|
|
73
|
-
export * from 'react-native/Libraries/StyleSheet/StyleSheet';
|
|
74
|
-
export * from 'react-native/Libraries/StyleSheet/StyleSheetTypes';
|
|
75
|
-
export * from 'react-native/Libraries/StyleSheet/processColor';
|
|
76
|
-
export * from 'react-native/Libraries/Text/Text';
|
|
77
|
-
// export * from 'react-native/Libraries/TurboModule/RCTExport';
|
|
78
|
-
export * as TurboModuleRegistry from 'react-native/Libraries/TurboModule/TurboModuleRegistry';
|
|
79
|
-
export * from 'react-native/Libraries/Types/CoreEventTypes';
|
|
80
|
-
export * from 'react-native/Libraries/Utilities/Appearance';
|
|
81
|
-
export * from 'react-native/Libraries/Utilities/BackHandler';
|
|
82
|
-
export * from 'react-native/Libraries/Utilities/DevSettings';
|
|
83
|
-
export * from 'react-native/Libraries/Utilities/Dimensions';
|
|
84
|
-
export * from 'react-native/Libraries/Utilities/PixelRatio';
|
|
85
|
-
export * from '../Libraries/Utilities/Platform';
|
|
86
|
-
export * from 'react-native/Libraries/Vibration/Vibration';
|
|
87
|
-
// export * from 'react-native/Libraries/YellowBox/YellowBoxDeprecated';
|
|
88
|
-
// export * from 'react-native/Libraries/vendor/core/ErrorUtils';
|
|
89
|
-
export * from 'react-native/Libraries/vendor/emitter/EventEmitter';
|
|
90
|
-
|
|
91
|
-
export * from 'react-native/types/public/DeprecatedPropertiesAlias';
|
|
92
|
-
export * from 'react-native/types/public/Insets';
|
|
93
|
-
export * from 'react-native/types/public/ReactNativeRenderer';
|
|
94
|
-
export * from 'react-native/types/public/ReactNativeTypes';
|
|
95
|
-
|
|
96
|
-
// react-native-harmony specific
|
|
97
|
-
export declare function registerViewConfig(
|
|
98
|
-
componentName: string,
|
|
99
|
-
viewConfigFactory: () => Record
|
|
100
|
-
): any;
|
|
101
|
-
|
|
102
|
-
export declare const ReactNativeViewAttributes: Record;
|
|
103
|
-
|
|
104
|
-
export declare function dispatchCommand(
|
|
105
|
-
currentRef: any,
|
|
106
|
-
commandName: string,
|
|
107
|
-
args: any
|
|
108
|
-
);
|