@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
|
@@ -0,0 +1,53 @@
|
|
|
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 file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import * as TurboModuleRegistry from '../../../TurboModule/TurboModuleRegistry';
|
|
9
|
+
import type { TurboModule } from '../../../TurboModule/RCTExport';
|
|
10
|
+
|
|
11
|
+
type NativeStatusBarManagerConstants = {
|
|
12
|
+
HEIGHT: number;
|
|
13
|
+
DEFAULT_BACKGROUND_COLOR?: string;
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
export interface Spec extends TurboModule {
|
|
17
|
+
getConstants: () => NativeStatusBarManagerConstants;
|
|
18
|
+
setColor: (color: number, animated: boolean) => void;
|
|
19
|
+
setTranslucent: (translucent: boolean) => void;
|
|
20
|
+
setStyle: (statusBarStyle: string) => void;
|
|
21
|
+
setHidden: (hidden: boolean) => void;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
const NativeModule = TurboModuleRegistry.getEnforcing<Spec>('StatusBarManager');
|
|
25
|
+
|
|
26
|
+
let constants: NativeStatusBarManagerConstants | null = null;
|
|
27
|
+
|
|
28
|
+
const NativeStatusBarManager: Spec = {
|
|
29
|
+
getConstants(): NativeStatusBarManagerConstants {
|
|
30
|
+
if (constants == null) {
|
|
31
|
+
constants = NativeModule.getConstants();
|
|
32
|
+
}
|
|
33
|
+
return constants;
|
|
34
|
+
},
|
|
35
|
+
|
|
36
|
+
setColor(color: number, animated: boolean): void {
|
|
37
|
+
NativeModule.setColor(color, animated);
|
|
38
|
+
},
|
|
39
|
+
|
|
40
|
+
setTranslucent(translucent: boolean): void {
|
|
41
|
+
NativeModule.setTranslucent(translucent);
|
|
42
|
+
},
|
|
43
|
+
|
|
44
|
+
setStyle(statusBarStyle: string): void {
|
|
45
|
+
NativeModule.setStyle(statusBarStyle);
|
|
46
|
+
},
|
|
47
|
+
|
|
48
|
+
setHidden(hidden: boolean): void {
|
|
49
|
+
NativeModule.setHidden(hidden);
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
|
|
53
|
+
export default NativeStatusBarManager;
|
|
@@ -0,0 +1,83 @@
|
|
|
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 file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
BaseStatusBarDelegate,
|
|
10
|
+
StatusBarAnimation,
|
|
11
|
+
StatusBarStyle,
|
|
12
|
+
} from './BaseStatusBarDelegate';
|
|
13
|
+
import NativeStatusBarManagerHarmony from './NativeStatusBarManagerHarmony.harmony';
|
|
14
|
+
import invariant from 'invariant';
|
|
15
|
+
import processColor from '../../../StyleSheet/processColor';
|
|
16
|
+
|
|
17
|
+
export default class StatusBarDelegate extends BaseStatusBarDelegate {
|
|
18
|
+
override getCurrentHeight(): number {
|
|
19
|
+
return NativeStatusBarManagerHarmony.getConstants().HEIGHT;
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
override getDefaultBackgroundColor(): string {
|
|
23
|
+
return (
|
|
24
|
+
NativeStatusBarManagerHarmony.getConstants().DEFAULT_BACKGROUND_COLOR ??
|
|
25
|
+
'black'
|
|
26
|
+
);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
override setBarStyle(style: StatusBarStyle, animated?: boolean): void {
|
|
30
|
+
NativeStatusBarManagerHarmony.setStyle(style);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
override setColor(processedColor: number, animated?: boolean): void {
|
|
34
|
+
NativeStatusBarManagerHarmony.setColor(processedColor, animated ?? false);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
override setHidden(hidden: boolean, animation?: StatusBarAnimation): void {
|
|
38
|
+
NativeStatusBarManagerHarmony.setHidden(hidden);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
override setNetworkActivityIndicatorVisible(visible: boolean): void {
|
|
42
|
+
// NOOP
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
override setTranslucent(translucent: boolean): void {
|
|
47
|
+
NativeStatusBarManagerHarmony.setTranslucent(translucent);
|
|
48
|
+
}
|
|
49
|
+
|
|
50
|
+
override updatePropsStack(oldProps: any, newProps: any): void {
|
|
51
|
+
if (!oldProps || oldProps.hidden.value !== newProps.hidden.value) {
|
|
52
|
+
NativeStatusBarManagerHarmony.setHidden(newProps.hidden.value);
|
|
53
|
+
}
|
|
54
|
+
if (!oldProps || oldProps.barStyle.value !== newProps.barStyle.value) {
|
|
55
|
+
NativeStatusBarManagerHarmony.setStyle(newProps.barStyle.value);
|
|
56
|
+
}
|
|
57
|
+
if (!oldProps || oldProps.translucent !== newProps.translucent) {
|
|
58
|
+
NativeStatusBarManagerHarmony.setTranslucent(newProps.translucent);
|
|
59
|
+
}
|
|
60
|
+
if (
|
|
61
|
+
!oldProps ||
|
|
62
|
+
oldProps.backgroundColor.value !== newProps.backgroundColor.value
|
|
63
|
+
) {
|
|
64
|
+
const processedColor = (processColor as any)(
|
|
65
|
+
newProps.backgroundColor.value
|
|
66
|
+
);
|
|
67
|
+
if (processedColor == null) {
|
|
68
|
+
console.warn(
|
|
69
|
+
`\`StatusBarDelegate::updatePropsStack\`: Color ${newProps.backgroundColor.value} parsed to null or undefined`
|
|
70
|
+
);
|
|
71
|
+
} else {
|
|
72
|
+
invariant(
|
|
73
|
+
typeof processedColor === 'number',
|
|
74
|
+
'Unexpected color given in StatusBarDelegate::updatePropsStack'
|
|
75
|
+
);
|
|
76
|
+
NativeStatusBarManagerHarmony.setColor(
|
|
77
|
+
processedColor,
|
|
78
|
+
newProps.backgroundColor.animated
|
|
79
|
+
);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
}
|
|
83
|
+
}
|
|
@@ -0,0 +1,98 @@
|
|
|
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 file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import {
|
|
9
|
+
BaseTextInputDelegate,
|
|
10
|
+
GetNativeTextContentTypeOptions,
|
|
11
|
+
} from './BaseTextInputDelegate';
|
|
12
|
+
|
|
13
|
+
const RCTSinglelineTextInputView =
|
|
14
|
+
require('../RCTSingelineTextInputNativeComponent').default;
|
|
15
|
+
const RCTMultilineTextInputView =
|
|
16
|
+
require('../RCTMultilineTextInputNativeComponent').default;
|
|
17
|
+
const RCTSinglelineTextInputNativeCommands =
|
|
18
|
+
require('../RCTSingelineTextInputNativeComponent').Commands;
|
|
19
|
+
const RCTMultilineTextInputNativeCommands =
|
|
20
|
+
require('../RCTMultilineTextInputNativeComponent').Commands;
|
|
21
|
+
|
|
22
|
+
export default class TextInputDelegate extends BaseTextInputDelegate {
|
|
23
|
+
override createNativeTextInput(props: any): React.ReactNode {
|
|
24
|
+
const RCTTextInputView =
|
|
25
|
+
props.multiline === true
|
|
26
|
+
? RCTMultilineTextInputView
|
|
27
|
+
: RCTSinglelineTextInputView;
|
|
28
|
+
|
|
29
|
+
return <RCTTextInputView {...props} />;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
private keyboardTypeByInputMode = new Map<string, string>()
|
|
33
|
+
.set('none', 'default')
|
|
34
|
+
.set('text', 'default')
|
|
35
|
+
.set('decimal', 'decimal-pad')
|
|
36
|
+
.set('numeric', 'number-pad')
|
|
37
|
+
.set('tel', 'phone-pad')
|
|
38
|
+
.set('search', 'web-search')
|
|
39
|
+
.set('email', 'email-address')
|
|
40
|
+
.set('url', 'url');
|
|
41
|
+
|
|
42
|
+
override getKeyboardTypeByInputMode(inputMode: string): string {
|
|
43
|
+
return this.keyboardTypeByInputMode.get(inputMode) ?? 'default';
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
override getSupportedKeyboardTypes(): string[] {
|
|
47
|
+
return [
|
|
48
|
+
'default',
|
|
49
|
+
'email-address',
|
|
50
|
+
'numeric',
|
|
51
|
+
'phone-pad',
|
|
52
|
+
'number-pad',
|
|
53
|
+
'url',
|
|
54
|
+
'decimal-pad',
|
|
55
|
+
'ascii-capable',
|
|
56
|
+
'numbers-and-punctuation',
|
|
57
|
+
'name-phone-pad',
|
|
58
|
+
'twitter',
|
|
59
|
+
'web-search',
|
|
60
|
+
'ascii-capable-number-pad',
|
|
61
|
+
'visible-password',
|
|
62
|
+
];
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
override getNativeAutocomplete(
|
|
66
|
+
autocomplete: string | null | undefined
|
|
67
|
+
): string | null | undefined {
|
|
68
|
+
return undefined;
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
override getNativeTextContentType(
|
|
72
|
+
textContentType: string | null | undefined,
|
|
73
|
+
{
|
|
74
|
+
autocomplete,
|
|
75
|
+
autocompleteWebToTextContentTypeMap,
|
|
76
|
+
}: GetNativeTextContentTypeOptions
|
|
77
|
+
): string | null | undefined {
|
|
78
|
+
return textContentType != null
|
|
79
|
+
? textContentType
|
|
80
|
+
: autocomplete && autocomplete in autocompleteWebToTextContentTypeMap
|
|
81
|
+
? autocompleteWebToTextContentTypeMap[autocomplete]
|
|
82
|
+
: textContentType;
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
override shouldBeCancellable(
|
|
86
|
+
rejectResponderTermination: boolean
|
|
87
|
+
): boolean | null {
|
|
88
|
+
return !rejectResponderTermination;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
override getTextInputCommands(multiline: boolean): any {
|
|
92
|
+
if (multiline) {
|
|
93
|
+
return RCTMultilineTextInputNativeCommands;
|
|
94
|
+
} else {
|
|
95
|
+
return RCTSinglelineTextInputNativeCommands;
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
}
|
|
@@ -0,0 +1,20 @@
|
|
|
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 file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { BaseTextInputStateDelegate } from './BaseTextInputStateDelegate';
|
|
9
|
+
// @ts-ignore
|
|
10
|
+
import { Commands } from '../RCTSingelineTextInputNativeComponent';
|
|
11
|
+
|
|
12
|
+
export default class TextInputDelegate extends BaseTextInputStateDelegate {
|
|
13
|
+
blur(ref: React.ComponentRef<any>): void {
|
|
14
|
+
Commands.blur(ref);
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
focus(ref: React.ComponentRef<any>): void {
|
|
18
|
+
Commands.focus(ref);
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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 file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { BaseTouchableHighlightDelegate } from './BaseTouchableHighlightDelegate';
|
|
9
|
+
|
|
10
|
+
export default class TouchableHighlightDelegate extends BaseTouchableHighlightDelegate {
|
|
11
|
+
override getExtraContainerProps(): Record<string, any> {
|
|
12
|
+
return { collapsable: false };
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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 file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { BaseTouchableNativeFeedbackDelegate } from './BaseTouchableNativeFeedbackDelegate';
|
|
9
|
+
|
|
10
|
+
export default class TouchableNativeFeedbackDelegate extends BaseTouchableNativeFeedbackDelegate {
|
|
11
|
+
override getExtraProps(): Record<string, any> {
|
|
12
|
+
return { collapsable: false };
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
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 file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { BaseTouchableWithoutFeedbackDelegate } from './BaseTouchableWithoutFeedbackDelegate';
|
|
9
|
+
|
|
10
|
+
export default class TouchableWithoutFeedbackDelegate extends BaseTouchableWithoutFeedbackDelegate {
|
|
11
|
+
override getExtraProps(): Record<string, any> {
|
|
12
|
+
return { collapsable: false };
|
|
13
|
+
}
|
|
14
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
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 file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import { TextStyle, ViewStyle } from 'react-native';
|
|
9
|
+
import { BaseButtonDelegate } from './BaseButtonDelegate';
|
|
10
|
+
|
|
11
|
+
export default class ButtonDelegate extends BaseButtonDelegate {
|
|
12
|
+
override getButtonDisabledStyle(): ViewStyle {
|
|
13
|
+
return {
|
|
14
|
+
opacity: 0.4,
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
override getButtonStyle(): ViewStyle {
|
|
19
|
+
return {
|
|
20
|
+
backgroundColor: '#317aff',
|
|
21
|
+
borderRadius: 8,
|
|
22
|
+
};
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
override getTextDisabledStyle(): TextStyle {
|
|
26
|
+
return {
|
|
27
|
+
fontWeight: '500',
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
override getTextStyle(): TextStyle {
|
|
32
|
+
return {
|
|
33
|
+
color: '#FFFFFF',
|
|
34
|
+
fontSize: 16,
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
override getInnerViewFocusable(): boolean {
|
|
39
|
+
return false;
|
|
40
|
+
}
|
|
41
|
+
}
|
|
@@ -0,0 +1,30 @@
|
|
|
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 file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
const {
|
|
9
|
+
setRuntimeConfigProvider,
|
|
10
|
+
} = require('../NativeComponent/NativeComponentRegistry');
|
|
11
|
+
|
|
12
|
+
setRuntimeConfigProvider((_viewConfigName) => {
|
|
13
|
+
return {
|
|
14
|
+
/**
|
|
15
|
+
* A ViewConfig describe what a component can send "to" and "from" the native side.
|
|
16
|
+
* On iOS/Android ViewConfigs for core components are configured in JS.
|
|
17
|
+
*
|
|
18
|
+
* In RNOH, ViewConfigs for core components are defined on the native side in ComponentJSIBinders.
|
|
19
|
+
* Native ViewConfigs are prefered for RNOH because they:
|
|
20
|
+
* 1) don't require patching RN
|
|
21
|
+
* 2) improve code consistency by using the same approach that is used by third party components
|
|
22
|
+
*
|
|
23
|
+
* After upgrading RNOH to 0.77 and enabling bridgless, RNOH needs to inform RN explicitly to continue using native ViewConfigs.
|
|
24
|
+
*
|
|
25
|
+
* ReactNativeFeatureFlags.js::useNativeViewConfigsInBridgelessMode can't be used here, because this code is executed before TurboModules can be used.
|
|
26
|
+
*/
|
|
27
|
+
native: true,
|
|
28
|
+
verify: false,
|
|
29
|
+
};
|
|
30
|
+
});
|
|
@@ -79,16 +79,12 @@ class AssetSourceResolver {
|
|
|
79
79
|
return !!this.serverUrl;
|
|
80
80
|
}
|
|
81
81
|
|
|
82
|
-
isLoadedFromFileSystem(): boolean {
|
|
83
|
-
return !!(this.jsbundleUrl && this.jsbundleUrl.startsWith('file://'));
|
|
84
|
-
}
|
|
85
|
-
|
|
86
82
|
public defaultAsset(): ResolvedAssetSource {
|
|
87
83
|
if (this.isLoadedFromServer()) {
|
|
88
84
|
return this.assetServerURL();
|
|
89
85
|
}
|
|
90
86
|
|
|
91
|
-
const path =
|
|
87
|
+
const path = 'asset://';
|
|
92
88
|
|
|
93
89
|
// Assets can have relative paths outside of the project root.
|
|
94
90
|
// Replace `../` with `_` to make sure they don't end up outside of
|
|
@@ -0,0 +1,17 @@
|
|
|
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 file in the root directory of this source tree.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
// @ts-ignore
|
|
9
|
+
import Image from './Image.ios';
|
|
10
|
+
// @ts-ignore
|
|
11
|
+
import ImageAndroid from './Image.android';
|
|
12
|
+
|
|
13
|
+
Image.getSize = ImageAndroid.getSize
|
|
14
|
+
Image.prefetch = ImageAndroid.prefetch
|
|
15
|
+
Image.abortPrefetch = ImageAndroid.abortPrefetch
|
|
16
|
+
|
|
17
|
+
export default Image;
|