@react-native-oh/react-native-harmony 0.72.23 → 0.72.27
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/Libraries/Alert/Alert.harmony.js +71 -71
- package/Libraries/Alert/AlertManager.ts +35 -35
- package/Libraries/Animated/NativeAnimatedHelper.harmony.js +601 -601
- package/Libraries/Components/AccessibilityInfo/AccessibilityInfo.harmony.js +445 -426
- package/Libraries/Components/AccessibilityInfo/NativeAccessibilityManager.harmony.js +30 -0
- package/Libraries/Components/AccessibilityInfo/legacySendAccessibilityEvent.harmony.js +26 -0
- package/Libraries/Components/Button/Button.harmony.js +450 -450
- package/Libraries/Components/Image/Image.flow.harmony.js +53 -0
- package/Libraries/Components/Image/Image.harmony.js +299 -0
- package/Libraries/Components/Image/NativeImageLoaderHarmony.js +38 -0
- package/Libraries/Components/RefreshControl/RefreshControl.harmony.js +210 -208
- package/Libraries/Components/SafeAreaView/SafeAreaView.harmony.tsx +76 -75
- package/Libraries/Components/ScrollView/ScrollView.harmony.js +1951 -1930
- package/Libraries/Components/ScrollView/processDecelerationRate.harmony.js +24 -24
- package/Libraries/Components/StatusBar/NativeStatusBarManagerHarmony.js +71 -68
- package/Libraries/Components/StatusBar/StatusBar.harmony.js +447 -447
- package/Libraries/Components/TextInput/TextInput.harmony.js +1707 -1697
- package/Libraries/Components/TextInput/TextInputState.harmony.js +220 -220
- package/Libraries/Components/Touchable/TouchableHighlight.harmony.js +396 -396
- package/Libraries/Components/Touchable/TouchableNativeFeedback.harmony.js +364 -364
- package/Libraries/Components/Touchable/TouchableWithoutFeedback.harmony.js +227 -227
- package/Libraries/Components/View/View.harmony.js +149 -149
- package/Libraries/Core/setUpReactDevTools.harmony.js +93 -93
- package/Libraries/Image/AssetSourceResolver.harmony.ts +78 -78
- package/Libraries/NativeComponent/BaseViewConfig.harmony.js +337 -337
- package/Libraries/ReactNative/UIManager.harmony.js +210 -210
- package/Libraries/Settings/Settings.harmony.js +15 -15
- package/Libraries/Share/Share.harmony.js +174 -0
- package/Libraries/StyleSheet/NativePlatformColor.ts +8 -8
- package/Libraries/StyleSheet/PlatformColorValueTypes.harmony.ts +14 -14
- package/Libraries/Utilities/BackHandler.harmony.js +109 -109
- package/Libraries/Utilities/{NativePlatformConstantsHarmony.ts → NativePlatformConstants.harmony.ts} +8 -8
- package/Libraries/Utilities/Platform.d.ts +117 -117
- package/Libraries/Utilities/Platform.harmony.ts +33 -33
- package/Libraries/Utilities/createPerformanceLogger.harmony.js +328 -328
- package/Libraries/Vibration/Vibration.harmony.js +88 -88
- package/index.js +212 -202
- package/jest.config.js +5 -5
- package/metro.config.js +348 -349
- package/package.json +58 -55
- package/react-native.config.js +10 -10
- package/{rnoh-4.1.0.404-vmall.har → react_native_openharmony.har} +0 -0
- package/tsconfig.json +13 -13
- package/types/index.d.ts +101 -101
|
@@ -1,71 +1,71 @@
|
|
|
1
|
-
import type { AlertOptions } from "./AlertManager";
|
|
2
|
-
|
|
3
|
-
export type Buttons = Array<{
|
|
4
|
-
text?: string,
|
|
5
|
-
onPress?: ?Function,
|
|
6
|
-
}>;
|
|
7
|
-
|
|
8
|
-
type Options = {
|
|
9
|
-
cancelable?: ?boolean,
|
|
10
|
-
onDismiss?: ?() => void,
|
|
11
|
-
...
|
|
12
|
-
};
|
|
13
|
-
|
|
14
|
-
/**
|
|
15
|
-
* Launches an alert dialog with the specified title and message.
|
|
16
|
-
*
|
|
17
|
-
* See https://reactnative.dev/docs/alert
|
|
18
|
-
*/
|
|
19
|
-
class Alert {
|
|
20
|
-
static alert(
|
|
21
|
-
title: ?string,
|
|
22
|
-
message?: ?string,
|
|
23
|
-
buttons?: Buttons,
|
|
24
|
-
options?: Options
|
|
25
|
-
): void {
|
|
26
|
-
const AlertManager = require("./AlertManager").default;
|
|
27
|
-
if (!AlertManager) {
|
|
28
|
-
return;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
const alertOptions: AlertOptions = {
|
|
32
|
-
title: title || "",
|
|
33
|
-
message: message || "",
|
|
34
|
-
cancelable: false,
|
|
35
|
-
};
|
|
36
|
-
|
|
37
|
-
const constants = AlertManager.getConstants();
|
|
38
|
-
|
|
39
|
-
if (options && options.cancelable) {
|
|
40
|
-
alertOptions.cancelable = options.cancelable;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
// At most two buttons. Ignore rest.
|
|
44
|
-
const validButtons: Buttons = (buttons ?? [{text: "OK"}]).slice(0, 2)
|
|
45
|
-
const secondaryButton = validButtons.pop();
|
|
46
|
-
const primaryButton = validButtons.pop();
|
|
47
|
-
|
|
48
|
-
if (primaryButton) {
|
|
49
|
-
alertOptions.primaryButton = primaryButton.text || "";
|
|
50
|
-
}
|
|
51
|
-
if (secondaryButton) {
|
|
52
|
-
alertOptions.secondaryButton = secondaryButton.text || "";
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
const onAction = (action, buttonKey) => {
|
|
56
|
-
if (action === constants.buttonClicked) {
|
|
57
|
-
if (buttonKey === constants.primaryButton) {
|
|
58
|
-
primaryButton.onPress && primaryButton.onPress();
|
|
59
|
-
} else if (buttonKey === constants.secondaryButton) {
|
|
60
|
-
secondaryButton.onPress && secondaryButton.onPress();
|
|
61
|
-
}
|
|
62
|
-
} else if (action === constants.dismissed) {
|
|
63
|
-
options && options.onDismiss && options.onDismiss();
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
const onError = (errorMessage: string) => console.warn(errorMessage);
|
|
67
|
-
AlertManager.alert(alertOptions, onError, onAction);
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
module.exports = Alert;
|
|
1
|
+
import type { AlertOptions } from "./AlertManager";
|
|
2
|
+
|
|
3
|
+
export type Buttons = Array<{
|
|
4
|
+
text?: string,
|
|
5
|
+
onPress?: ?Function,
|
|
6
|
+
}>;
|
|
7
|
+
|
|
8
|
+
type Options = {
|
|
9
|
+
cancelable?: ?boolean,
|
|
10
|
+
onDismiss?: ?() => void,
|
|
11
|
+
...
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Launches an alert dialog with the specified title and message.
|
|
16
|
+
*
|
|
17
|
+
* See https://reactnative.dev/docs/alert
|
|
18
|
+
*/
|
|
19
|
+
class Alert {
|
|
20
|
+
static alert(
|
|
21
|
+
title: ?string,
|
|
22
|
+
message?: ?string,
|
|
23
|
+
buttons?: Buttons,
|
|
24
|
+
options?: Options
|
|
25
|
+
): void {
|
|
26
|
+
const AlertManager = require("./AlertManager").default;
|
|
27
|
+
if (!AlertManager) {
|
|
28
|
+
return;
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
const alertOptions: AlertOptions = {
|
|
32
|
+
title: title || "",
|
|
33
|
+
message: message || "",
|
|
34
|
+
cancelable: false,
|
|
35
|
+
};
|
|
36
|
+
|
|
37
|
+
const constants = AlertManager.getConstants();
|
|
38
|
+
|
|
39
|
+
if (options && options.cancelable) {
|
|
40
|
+
alertOptions.cancelable = options.cancelable;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
// At most two buttons. Ignore rest.
|
|
44
|
+
const validButtons: Buttons = (buttons ?? [{text: "OK"}]).slice(0, 2)
|
|
45
|
+
const secondaryButton = validButtons.pop();
|
|
46
|
+
const primaryButton = validButtons.pop();
|
|
47
|
+
|
|
48
|
+
if (primaryButton) {
|
|
49
|
+
alertOptions.primaryButton = primaryButton.text || "";
|
|
50
|
+
}
|
|
51
|
+
if (secondaryButton) {
|
|
52
|
+
alertOptions.secondaryButton = secondaryButton.text || "";
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
const onAction = (action, buttonKey) => {
|
|
56
|
+
if (action === constants.buttonClicked) {
|
|
57
|
+
if (buttonKey === constants.primaryButton) {
|
|
58
|
+
primaryButton.onPress && primaryButton.onPress();
|
|
59
|
+
} else if (buttonKey === constants.secondaryButton) {
|
|
60
|
+
secondaryButton.onPress && secondaryButton.onPress();
|
|
61
|
+
}
|
|
62
|
+
} else if (action === constants.dismissed) {
|
|
63
|
+
options && options.onDismiss && options.onDismiss();
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const onError = (errorMessage: string) => console.warn(errorMessage);
|
|
67
|
+
AlertManager.alert(alertOptions, onError, onAction);
|
|
68
|
+
}
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
module.exports = Alert;
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import type { TurboModule } from "react-native/Libraries/TurboModule/RCTExport";
|
|
2
|
-
|
|
3
|
-
import * as TurboModuleRegistry from "react-native/Libraries/TurboModule/TurboModuleRegistry";
|
|
4
|
-
|
|
5
|
-
/* 'buttonClicked' | 'dismissed' */
|
|
6
|
-
type AlertAction = string;
|
|
7
|
-
/*
|
|
8
|
-
primaryButton = 1,
|
|
9
|
-
secondaryButton = 2,
|
|
10
|
-
*/
|
|
11
|
-
type AlertButtonKey = number;
|
|
12
|
-
export type AlertOptions = {
|
|
13
|
-
title?: string;
|
|
14
|
-
message?: string;
|
|
15
|
-
primaryButton?: string;
|
|
16
|
-
secondaryButton?: string;
|
|
17
|
-
items?: Array<string>;
|
|
18
|
-
cancelable?: boolean;
|
|
19
|
-
};
|
|
20
|
-
|
|
21
|
-
export interface Spec extends TurboModule {
|
|
22
|
-
getConstants: () => {
|
|
23
|
-
buttonClicked: AlertAction;
|
|
24
|
-
dismissed: AlertAction;
|
|
25
|
-
primaryButton: AlertButtonKey;
|
|
26
|
-
secondaryButton: AlertButtonKey;
|
|
27
|
-
};
|
|
28
|
-
alert: (
|
|
29
|
-
options: AlertOptions,
|
|
30
|
-
onError: (error: string) => void,
|
|
31
|
-
onAction: (action: AlertAction, buttonKey?: AlertButtonKey) => void
|
|
32
|
-
) => void;
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
export default TurboModuleRegistry.get<Spec>("AlertManager");
|
|
1
|
+
import type { TurboModule } from "react-native/Libraries/TurboModule/RCTExport";
|
|
2
|
+
|
|
3
|
+
import * as TurboModuleRegistry from "react-native/Libraries/TurboModule/TurboModuleRegistry";
|
|
4
|
+
|
|
5
|
+
/* 'buttonClicked' | 'dismissed' */
|
|
6
|
+
type AlertAction = string;
|
|
7
|
+
/*
|
|
8
|
+
primaryButton = 1,
|
|
9
|
+
secondaryButton = 2,
|
|
10
|
+
*/
|
|
11
|
+
type AlertButtonKey = number;
|
|
12
|
+
export type AlertOptions = {
|
|
13
|
+
title?: string;
|
|
14
|
+
message?: string;
|
|
15
|
+
primaryButton?: string;
|
|
16
|
+
secondaryButton?: string;
|
|
17
|
+
items?: Array<string>;
|
|
18
|
+
cancelable?: boolean;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
export interface Spec extends TurboModule {
|
|
22
|
+
getConstants: () => {
|
|
23
|
+
buttonClicked: AlertAction;
|
|
24
|
+
dismissed: AlertAction;
|
|
25
|
+
primaryButton: AlertButtonKey;
|
|
26
|
+
secondaryButton: AlertButtonKey;
|
|
27
|
+
};
|
|
28
|
+
alert: (
|
|
29
|
+
options: AlertOptions,
|
|
30
|
+
onError: (error: string) => void,
|
|
31
|
+
onAction: (action: AlertAction, buttonKey?: AlertButtonKey) => void
|
|
32
|
+
) => void;
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
export default TurboModuleRegistry.get<Spec>("AlertManager");
|