@react-native-oh/react-native-harmony 0.72.82 → 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 +75 -29
- 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
package/package.json
CHANGED
|
@@ -1,59 +1,80 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@react-native-oh/react-native-harmony",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.77.18",
|
|
4
4
|
"description": "",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"registry": "https://registry.npmjs.org/",
|
|
7
7
|
"access": "public"
|
|
8
8
|
},
|
|
9
|
+
"license": "MIT",
|
|
10
|
+
"author": "",
|
|
11
|
+
"types": "types/index.harmony.d.ts",
|
|
12
|
+
"files": [
|
|
13
|
+
"./Libraries/**/*",
|
|
14
|
+
"./delegates/**/*",
|
|
15
|
+
"./src/**/*",
|
|
16
|
+
"./types/**/*",
|
|
17
|
+
"./*.js",
|
|
18
|
+
"./*.json",
|
|
19
|
+
"./LICENSE",
|
|
20
|
+
"./LICENSE-Meta",
|
|
21
|
+
"./NOTICE.md",
|
|
22
|
+
"./metro.config.d.ts",
|
|
23
|
+
"./react_native_openharmony.har"
|
|
24
|
+
],
|
|
9
25
|
"scripts": {
|
|
10
|
-
"
|
|
11
|
-
"
|
|
12
|
-
"hermes
|
|
13
|
-
"
|
|
14
|
-
"
|
|
15
|
-
"
|
|
16
|
-
"verify": "react-native verify-package-harmony --package-path . --skip-checks oh_package_name_is_derived_from_npm_package_name",
|
|
17
|
-
"test": "jest"
|
|
26
|
+
"build": "node ./scripts/build-har.js",
|
|
27
|
+
"build:har": "node ./scripts/build-har.js",
|
|
28
|
+
"build:hermes": "sh ./scripts/build-hermes.sh",
|
|
29
|
+
"prepack": "cd .. && pnpm _integrate-upstream-code && cd react-native-harmony && pnpm build:har",
|
|
30
|
+
"test": "jest",
|
|
31
|
+
"verify": "npm run test"
|
|
18
32
|
},
|
|
19
|
-
"
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
"react-native": "0.
|
|
33
|
+
"dependencies": {
|
|
34
|
+
"@react-native/assets-registry": "0.77.1",
|
|
35
|
+
"@react-native/js-polyfills": "0.77.1",
|
|
36
|
+
"@react-native/normalize-colors": "0.77.1",
|
|
37
|
+
"@react-native/virtualized-lists": "0.77.1",
|
|
38
|
+
"abort-controller": "^3.0.0",
|
|
39
|
+
"anser": "^1.4.9",
|
|
40
|
+
"ansi-regex": "^5.0.0",
|
|
41
|
+
"base64-js": "^1.5.1",
|
|
42
|
+
"colors": "^1.4.0",
|
|
43
|
+
"event-target-shim": "^5.0.1",
|
|
44
|
+
"invariant": "^2.2.4",
|
|
45
|
+
"memoize-one": "^5.0.0",
|
|
46
|
+
"metro-runtime": "^0.81.0",
|
|
47
|
+
"nullthrows": "^1.1.1",
|
|
48
|
+
"pretty-format": "^29.7.0",
|
|
49
|
+
"promise": "^8.3.0",
|
|
50
|
+
"react-devtools-core": "^6.0.1",
|
|
51
|
+
"react-refresh": "^0.14.0",
|
|
52
|
+
"regenerator-runtime": "^0.13.2",
|
|
53
|
+
"scheduler": "0.24.0-canary-efb381bbf-20230505",
|
|
54
|
+
"stacktrace-parser": "^0.1.10",
|
|
55
|
+
"whatwg-fetch": "^3.0.0"
|
|
23
56
|
},
|
|
24
|
-
"types": "types",
|
|
25
57
|
"devDependencies": {
|
|
26
|
-
"@react-native-community/cli": "^11.2.0",
|
|
27
58
|
"@react-native-community/cli-types": "^11.2.0",
|
|
28
|
-
"@react-native/metro-config": "
|
|
29
|
-
"@
|
|
30
|
-
"@types/
|
|
31
|
-
"@types/jest": "^29.5.
|
|
32
|
-
"@types/node": "^
|
|
59
|
+
"@react-native/metro-config": "0.77.1",
|
|
60
|
+
"@react-native/typescript-config": "0.77.1",
|
|
61
|
+
"@types/invariant": "^2.2.37",
|
|
62
|
+
"@types/jest": "^29.5.14",
|
|
63
|
+
"@types/node": "^22.7.5",
|
|
33
64
|
"@types/react": "^18.2.24",
|
|
34
65
|
"@types/tmp": "^0.2.6",
|
|
35
66
|
"jest": "^29.5.0",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
67
|
+
"metro": "^0.81.0",
|
|
68
|
+
"metro-config": "0.80.12",
|
|
38
69
|
"tmp": "^0.2.1",
|
|
39
70
|
"ts-jest": "^29.1.2",
|
|
40
|
-
"ts-node": "^10.9.1",
|
|
41
71
|
"typescript": "^5.0.4"
|
|
42
72
|
},
|
|
43
|
-
"
|
|
44
|
-
"
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
"
|
|
48
|
-
"./harmony/*",
|
|
49
|
-
"./*.har"
|
|
50
|
-
],
|
|
51
|
-
"dependencies": {
|
|
52
|
-
"@react-native-oh/react-native-harmony-cli": "^0.0.30",
|
|
53
|
-
"colors": "^1.4.0",
|
|
54
|
-
"fs-extra": "^11.1.1",
|
|
55
|
-
"metro": "^0.76.3",
|
|
56
|
-
"metro-config": "^0.76.3"
|
|
73
|
+
"peerDependencies": {
|
|
74
|
+
"react-native": "0.77.1"
|
|
75
|
+
},
|
|
76
|
+
"engines": {
|
|
77
|
+
"node": ">=18"
|
|
57
78
|
},
|
|
58
79
|
"harmony": {
|
|
59
80
|
"autolinking": null
|
package/react-native.config.js
CHANGED
|
@@ -1,17 +1,65 @@
|
|
|
1
|
+
const pathUtils = require('node:path');
|
|
2
|
+
|
|
3
|
+
let commands = [];
|
|
4
|
+
try {
|
|
5
|
+
const harmony = require('@react-native-oh/react-native-harmony-cli');
|
|
6
|
+
commands = harmony?.config?.commands;
|
|
7
|
+
} catch (err) {
|
|
8
|
+
if (typeof err === 'object' && err?.code === 'MODULE_NOT_FOUND') {
|
|
9
|
+
console.warn(
|
|
10
|
+
'react-native-harmony is installed but @react-native-oh/react-native-harmony-cli is not. "*-harmony" commands are unavailable. Please install @react-native-oh/react-native-harmony-cli in your project. This change was introduced in React native 0.76.\n'
|
|
11
|
+
);
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
|
|
1
15
|
/**
|
|
2
|
-
*
|
|
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.
|
|
16
|
+
* Package name shouldn't be hardcoded because this package can be installed under an alias.
|
|
6
17
|
*/
|
|
7
|
-
|
|
8
|
-
|
|
18
|
+
const rnohNpmPackageName =
|
|
19
|
+
deriveFullNpmPackageNameFromDirname(__dirname) ??
|
|
20
|
+
'@react-native-oh/react-native-harmony';
|
|
9
21
|
|
|
10
22
|
/**
|
|
11
23
|
* @type {import("@react-native-community/cli-types").Config}
|
|
12
24
|
*/
|
|
13
25
|
const config = {
|
|
14
|
-
commands
|
|
15
|
-
|
|
26
|
+
commands,
|
|
27
|
+
platforms: {
|
|
28
|
+
harmony: {
|
|
29
|
+
npmPackageName: rnohNpmPackageName,
|
|
30
|
+
projectConfig: () => ({}),
|
|
31
|
+
dependencyConfig: () => ({}),
|
|
32
|
+
},
|
|
33
|
+
},
|
|
34
|
+
};
|
|
16
35
|
|
|
17
|
-
module.exports = config
|
|
36
|
+
module.exports = config;
|
|
37
|
+
|
|
38
|
+
/**
|
|
39
|
+
* @param {string} dirname
|
|
40
|
+
* @return {string | null}
|
|
41
|
+
*/
|
|
42
|
+
function deriveFullNpmPackageNameFromDirname(dirname) {
|
|
43
|
+
const pathSegments = dirname.split(pathUtils.sep);
|
|
44
|
+
if (pathSegments.includes('node_modules')) {
|
|
45
|
+
/**
|
|
46
|
+
* Production environment
|
|
47
|
+
*/
|
|
48
|
+
const nodeModulesIndex = pathSegments.indexOf('node_modules');
|
|
49
|
+
const organizationNameMaybeAndPackageName = pathSegments.slice(
|
|
50
|
+
nodeModulesIndex + 1
|
|
51
|
+
);
|
|
52
|
+
if (organizationNameMaybeAndPackageName.length === 1) {
|
|
53
|
+
return organizationNameMaybeAndPackageName[0]; // packageName
|
|
54
|
+
}
|
|
55
|
+
if (organizationNameMaybeAndPackageName.length === 2) {
|
|
56
|
+
return organizationNameMaybeAndPackageName.join('/');
|
|
57
|
+
}
|
|
58
|
+
return null;
|
|
59
|
+
} else {
|
|
60
|
+
/**
|
|
61
|
+
* RNOH development environment
|
|
62
|
+
*/
|
|
63
|
+
return null;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
Binary file
|
package/tsconfig.json
CHANGED
|
@@ -1,14 +1,20 @@
|
|
|
1
1
|
{
|
|
2
2
|
"extends": [
|
|
3
|
-
"@
|
|
3
|
+
"@react-native/typescript-config/tsconfig.json",
|
|
4
4
|
],
|
|
5
|
-
"
|
|
6
|
-
"
|
|
5
|
+
"include": [
|
|
6
|
+
"metro.config.js",
|
|
7
|
+
"react-native.config.js",
|
|
8
|
+
"index.js",
|
|
9
|
+
"tests"
|
|
7
10
|
],
|
|
8
11
|
"compilerOptions": {
|
|
12
|
+
"noImplicitAny": false,
|
|
13
|
+
"allowJs": true,
|
|
9
14
|
"types": [
|
|
10
15
|
"node", // Removes an error when exporting with module.exports.
|
|
11
16
|
"jest"
|
|
12
|
-
]
|
|
17
|
+
],
|
|
18
|
+
"preserveSymlinks": true,
|
|
13
19
|
}
|
|
14
20
|
}
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
// export * from '../Libraries/ActionSheetIOS/ActionSheetIOS';
|
|
2
|
+
export * from '../Libraries/Alert/Alert';
|
|
3
|
+
export * from '../Libraries/Animated/Animated';
|
|
4
|
+
export * from '../Libraries/Animated/Easing';
|
|
5
|
+
export * from '../Libraries/Animated/useAnimatedValue';
|
|
6
|
+
export * from '../Libraries/AppState/AppState';
|
|
7
|
+
export * from '../Libraries/BatchedBridge/NativeModules';
|
|
8
|
+
export * from '../Libraries/Components/AccessibilityInfo/AccessibilityInfo';
|
|
9
|
+
export * from '../Libraries/Components/ActivityIndicator/ActivityIndicator';
|
|
10
|
+
// export * from '../Libraries/Components/Clipboard/Clipboard';
|
|
11
|
+
// export * from '../Libraries/Components/DatePicker/DatePickerIOS';
|
|
12
|
+
export * from '../Libraries/Components/DrawerAndroid/DrawerLayoutAndroid';
|
|
13
|
+
export * from '../Libraries/Components/Keyboard/Keyboard';
|
|
14
|
+
export * from '../Libraries/Components/Keyboard/KeyboardAvoidingView';
|
|
15
|
+
export * from '../Libraries/Components/Pressable/Pressable';
|
|
16
|
+
// export * from '../Libraries/Components/ProgressBarAndroid/ProgressBarAndroid';
|
|
17
|
+
// export * from '../Libraries/Components/ProgressViewIOS/ProgressViewIOS';
|
|
18
|
+
export * from '../Libraries/Components/RefreshControl/RefreshControl';
|
|
19
|
+
export * from '../Libraries/Components/SafeAreaView/SafeAreaView';
|
|
20
|
+
export * from '../Libraries/Components/ScrollView/ScrollView';
|
|
21
|
+
// export * from '../Libraries/Components/Slider/Slider';
|
|
22
|
+
export * from '../Libraries/Components/StatusBar/StatusBar';
|
|
23
|
+
export * from '../Libraries/Components/Switch/Switch';
|
|
24
|
+
// export * from '../Libraries/Components/TextInput/InputAccessoryView';
|
|
25
|
+
export * from '../Libraries/Components/TextInput/TextInput';
|
|
26
|
+
export * from '../Libraries/Components/ToastAndroid/ToastAndroid';
|
|
27
|
+
export * from '../Libraries/Components/Touchable/Touchable';
|
|
28
|
+
export * from '../Libraries/Components/Touchable/TouchableHighlight';
|
|
29
|
+
export * from '../Libraries/Components/Touchable/TouchableNativeFeedback';
|
|
30
|
+
export * from '../Libraries/Components/Touchable/TouchableOpacity';
|
|
31
|
+
export * from '../Libraries/Components/Touchable/TouchableWithoutFeedback';
|
|
32
|
+
export * from '../Libraries/Components/View/View';
|
|
33
|
+
export * from '../Libraries/Components/View/ViewAccessibility';
|
|
34
|
+
export * from '../Libraries/Components/View/ViewPropTypes';
|
|
35
|
+
export * from '../Libraries/Components/Button';
|
|
36
|
+
export * from '../Libraries/EventEmitter/NativeEventEmitter';
|
|
37
|
+
export * from '../Libraries/EventEmitter/RCTDeviceEventEmitter';
|
|
38
|
+
// export * from '../Libraries/EventEmitter/RCTNativeAppEventEmitter';
|
|
39
|
+
export * from '../Libraries/Image/Image';
|
|
40
|
+
// export * from '../Libraries/Image/ImageResizeMode';
|
|
41
|
+
// export * from '../Libraries/Image/ImageSource';
|
|
42
|
+
export * from '../Libraries/Interaction/InteractionManager';
|
|
43
|
+
export * from '../Libraries/Interaction/PanResponder';
|
|
44
|
+
export * from '../Libraries/LayoutAnimation/LayoutAnimation';
|
|
45
|
+
export * from '../Libraries/Linking/Linking';
|
|
46
|
+
export * from '../Libraries/Lists/FlatList';
|
|
47
|
+
export * from '../Libraries/Lists/SectionList';
|
|
48
|
+
export * from '@react-native/virtualized-lists';
|
|
49
|
+
export * from '../Libraries/LogBox/LogBox';
|
|
50
|
+
export * from '../Libraries/Modal/Modal';
|
|
51
|
+
export * as Systrace from '../Libraries/Performance/Systrace';
|
|
52
|
+
// export * from '../Libraries/PermissionsAndroid/PermissionsAndroid';
|
|
53
|
+
// export * from '../Libraries/PushNotificationIOS/PushNotificationIOS';
|
|
54
|
+
export * from '../Libraries/ReactNative/AppRegistry';
|
|
55
|
+
export * from '../Libraries/ReactNative/I18nManager';
|
|
56
|
+
export * from '../Libraries/ReactNative/RendererProxy';
|
|
57
|
+
export * from '../Libraries/ReactNative/RootTag';
|
|
58
|
+
export * from '../Libraries/ReactNative/UIManager';
|
|
59
|
+
export * from '../Libraries/ReactNative/requireNativeComponent';
|
|
60
|
+
export * from '../Libraries/Settings/Settings';
|
|
61
|
+
export * from '../Libraries/Share/Share';
|
|
62
|
+
export * from '../Libraries/StyleSheet/PlatformColorValueTypesIOS';
|
|
63
|
+
export * from '../Libraries/StyleSheet/PlatformColorValueTypes';
|
|
64
|
+
export * from '../Libraries/StyleSheet/StyleSheet';
|
|
65
|
+
export * from '../Libraries/StyleSheet/StyleSheetTypes';
|
|
66
|
+
export * from '../Libraries/StyleSheet/processColor';
|
|
67
|
+
export * from '../Libraries/Text/Text';
|
|
68
|
+
// export * from '../Libraries/TurboModule/RCTExport';
|
|
69
|
+
export * as TurboModuleRegistry from '../Libraries/TurboModule/TurboModuleRegistry';
|
|
70
|
+
export * from '../Libraries/Types/CoreEventTypes';
|
|
71
|
+
export * from '../Libraries/Utilities/Appearance';
|
|
72
|
+
export * from '../Libraries/Utilities/BackHandler';
|
|
73
|
+
export * from '../Libraries/Utilities/DevSettings';
|
|
74
|
+
export * from '../Libraries/Utilities/Dimensions';
|
|
75
|
+
export * from '../Libraries/Utilities/PixelRatio';
|
|
76
|
+
export * from '../Libraries/Utilities/Platform';
|
|
77
|
+
export * from '../Libraries/Vibration/Vibration';
|
|
78
|
+
// export * from '../Libraries/YellowBox/YellowBoxDeprecated';
|
|
79
|
+
// export * from '../Libraries/vendor/core/ErrorUtils';
|
|
80
|
+
export * from '../Libraries/vendor/emitter/EventEmitter';
|
|
81
|
+
|
|
82
|
+
export * from '../types/public/DeprecatedPropertiesAlias';
|
|
83
|
+
export * from '../types/public/Insets';
|
|
84
|
+
export * from '../types/public/ReactNativeRenderer';
|
|
85
|
+
export * from '../types/public/ReactNativeTypes';
|
|
86
|
+
|
|
87
|
+
// react-native-harmony specific
|
|
88
|
+
export declare function registerViewConfig(
|
|
89
|
+
componentName: string,
|
|
90
|
+
viewConfigFactory: () => Record<any, any>
|
|
91
|
+
): any;
|
|
92
|
+
|
|
93
|
+
export declare const ReactNativeViewAttributes: Record<any, any>;
|
|
94
|
+
|
|
95
|
+
export declare function dispatchCommand(
|
|
96
|
+
currentRef: any,
|
|
97
|
+
commandName: string,
|
|
98
|
+
args: any
|
|
99
|
+
): void;
|
|
@@ -1,77 +0,0 @@
|
|
|
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 three buttons. Ignore rest.
|
|
44
|
-
const validButtons: Buttons = (buttons ?? [{text: "OK"}]).slice(0, 3)
|
|
45
|
-
const tertiaryButton = validButtons.pop();
|
|
46
|
-
const secondaryButton = validButtons.pop();
|
|
47
|
-
const primaryButton = validButtons.pop();
|
|
48
|
-
|
|
49
|
-
if (primaryButton) {
|
|
50
|
-
alertOptions.primaryButton = primaryButton.text || "";
|
|
51
|
-
}
|
|
52
|
-
if (secondaryButton) {
|
|
53
|
-
alertOptions.secondaryButton = secondaryButton.text || "";
|
|
54
|
-
}
|
|
55
|
-
if (tertiaryButton) {
|
|
56
|
-
alertOptions.tertiaryButton = tertiaryButton.text || "";
|
|
57
|
-
}
|
|
58
|
-
|
|
59
|
-
const onAction = (action, buttonKey) => {
|
|
60
|
-
if (action === constants.buttonClicked) {
|
|
61
|
-
if (buttonKey === constants.primaryButton) {
|
|
62
|
-
primaryButton.onPress && primaryButton.onPress();
|
|
63
|
-
} else if (buttonKey === constants.secondaryButton) {
|
|
64
|
-
secondaryButton.onPress && secondaryButton.onPress();
|
|
65
|
-
} else if (buttonKey === constants.tertiaryButton) {
|
|
66
|
-
tertiaryButton.onPress && tertiaryButton.onPress();
|
|
67
|
-
}
|
|
68
|
-
} else if (action === constants.dismissed) {
|
|
69
|
-
options && options.onDismiss && options.onDismiss();
|
|
70
|
-
}
|
|
71
|
-
};
|
|
72
|
-
const onError = (errorMessage: string) => console.warn(errorMessage);
|
|
73
|
-
AlertManager.alert(alertOptions, onError, onAction);
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
module.exports = Alert;
|