@react-native-oh/react-native-harmony 0.77.22 → 0.77.33

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.
@@ -128,7 +128,7 @@ class Alert {
128
128
  keyboardType?: string,
129
129
  options?: Options,
130
130
  ): void {
131
- ALERT_DELEGATE.prompt(title, message, callbackOrButtons, type, defaultValue, keyboardValue, options);
131
+ ALERT_DELEGATE.prompt(title, message, callbackOrButtons, type, defaultValue, keyboardType, options);
132
132
  // if (Platform.OS === 'ios') {
133
133
  // let callbacks: Array<?any> = [];
134
134
  // const buttons = [];
File without changes
File without changes
@@ -26,6 +26,7 @@ import AndroidDrawerLayoutNativeComponent, {
26
26
  } from './AndroidDrawerLayoutNativeComponent';
27
27
  import nullthrows from 'nullthrows';
28
28
  import * as React from 'react';
29
+ import DrawerLayoutAndroidDelegate from './delegates/DrawerLayoutAndroidDelegate'; // RNC_patch
29
30
 
30
31
  const DRAWER_STATES = ['Idle', 'Dragging', 'Settling'];
31
32
 
@@ -154,6 +155,13 @@ type State = {|
154
155
  * ```
155
156
  */
156
157
  class DrawerLayoutAndroid extends React.Component<Props, State> {
158
+ _delegate: DrawerLayoutAndroidDelegate; // RNC_patch
159
+
160
+ constructor(props: Props) {
161
+ super(props);
162
+ this._delegate = new DrawerLayoutAndroidDelegate({ getProps: () => this.props }); // RNC_patch
163
+ }
164
+
157
165
  static get positions(): mixed {
158
166
  console.warn(
159
167
  'Setting DrawerLayoutAndroid drawerPosition using `DrawerLayoutAndroid.positions` is deprecated. Instead pass the string value "left" or "right"',
@@ -173,66 +181,76 @@ class DrawerLayoutAndroid extends React.Component<Props, State> {
173
181
  };
174
182
 
175
183
  render(): React.Node {
176
- const {
177
- drawerBackgroundColor = 'white',
178
- onDrawerStateChanged,
179
- renderNavigationView,
180
- onDrawerOpen,
181
- onDrawerClose,
182
- ...props
183
- } = this.props;
184
- const drawStatusBar = this.props.statusBarBackgroundColor != null;
185
- const drawerViewWrapper = (
186
- <View
187
- style={[
188
- styles.drawerSubview,
189
- {
190
- width: this.props.drawerWidth,
191
- backgroundColor: drawerBackgroundColor,
192
- },
193
- ]}
194
- pointerEvents={this.state.drawerOpened ? 'auto' : 'none'}
195
- collapsable={false}>
196
- {renderNavigationView()}
197
- {drawStatusBar && <View style={styles.drawerStatusBar} />}
198
- </View>
199
- );
200
- const childrenWrapper = (
201
- <View style={styles.mainSubview} collapsable={false}>
202
- {drawStatusBar && (
203
- <StatusBar
204
- translucent
205
- backgroundColor={this.props.statusBarBackgroundColor}
206
- />
207
- )}
208
- {drawStatusBar && (
209
- <View
210
- style={[
211
- styles.statusBar,
212
- {backgroundColor: this.props.statusBarBackgroundColor},
213
- ]}
214
- />
215
- )}
216
- {this.props.children}
217
- </View>
218
- );
219
- return (
220
- <AndroidDrawerLayoutNativeComponent
221
- {...props}
222
- ref={this._nativeRef}
223
- drawerBackgroundColor={drawerBackgroundColor}
224
- drawerWidth={this.props.drawerWidth}
225
- drawerPosition={this.props.drawerPosition}
226
- drawerLockMode={this.props.drawerLockMode}
227
- style={[styles.base, this.props.style]}
228
- onDrawerSlide={this._onDrawerSlide}
229
- onDrawerOpen={this._onDrawerOpen}
230
- onDrawerClose={this._onDrawerClose}
231
- onDrawerStateChanged={this._onDrawerStateChanged}>
232
- {childrenWrapper}
233
- {drawerViewWrapper}
234
- </AndroidDrawerLayoutNativeComponent>
235
- );
184
+ // RNC_patch
185
+
186
+ // const {
187
+ // drawerBackgroundColor = 'white',
188
+ // onDrawerStateChanged,
189
+ // renderNavigationView,
190
+ // onDrawerOpen,
191
+ // onDrawerClose,
192
+ // ...props
193
+ // } = this.props;
194
+ // const drawStatusBar = this.props.statusBarBackgroundColor != null;
195
+ // const drawerViewWrapper = (
196
+ // <View
197
+ // style={[
198
+ // styles.drawerSubview,
199
+ // {
200
+ // width: this.props.drawerWidth,
201
+ // backgroundColor: drawerBackgroundColor,
202
+ // },
203
+ // ]}
204
+ // pointerEvents={this.state.drawerOpened ? 'auto' : 'none'}
205
+ // collapsable={false}>
206
+ // {renderNavigationView()}
207
+ // {drawStatusBar && <View style={styles.drawerStatusBar} />}
208
+ // </View>
209
+ // );
210
+ // const childrenWrapper = (
211
+ // <View style={styles.mainSubview} collapsable={false}>
212
+ // {drawStatusBar && (
213
+ // <StatusBar
214
+ // translucent
215
+ // backgroundColor={this.props.statusBarBackgroundColor}
216
+ // />
217
+ // )}
218
+ // {drawStatusBar && (
219
+ // <View
220
+ // style={[
221
+ // styles.statusBar,
222
+ // {backgroundColor: this.props.statusBarBackgroundColor},
223
+ // ]}
224
+ // />
225
+ // )}
226
+ // {this.props.children}
227
+ // </View>
228
+ // );
229
+ // return (
230
+ // <AndroidDrawerLayoutNativeComponent
231
+ // {...props}
232
+ // ref={this._nativeRef}
233
+ // drawerBackgroundColor={drawerBackgroundColor}
234
+ // drawerWidth={this.props.drawerWidth}
235
+ // drawerPosition={this.props.drawerPosition}
236
+ // drawerLockMode={this.props.drawerLockMode}
237
+ // style={[styles.base, this.props.style]}
238
+ // onDrawerSlide={this._onDrawerSlide}
239
+ // onDrawerOpen={this._onDrawerOpen}
240
+ // onDrawerClose={this._onDrawerClose}
241
+ // onDrawerStateChanged={this._onDrawerStateChanged}>
242
+ // {childrenWrapper}
243
+ // {drawerViewWrapper}
244
+ // </AndroidDrawerLayoutNativeComponent>
245
+ // );
246
+ return this._delegate.render({
247
+ drawerOpened: this.state.drawerOpened,
248
+ nativeRef: this._nativeRef,
249
+ onDrawerOpen: this._onDrawerOpen,
250
+ onDrawerClose: this._onDrawerClose,
251
+ onDrawerSlide: this._onDrawerSlide,
252
+ onDrawerStateChanged: this._onDrawerStateChanged,
253
+ }); // RNC_patch
236
254
  }
237
255
 
238
256
  /* $FlowFixMe[missing-local-annot] The type annotation(s) required by Flow's
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Copyright (c) 2025 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
+ //RNOH patch: We want to use the android patch of RNC. This could be done differently but that would result in a bigger patch and/or metro problems.
9
+ module.exports = require('./DrawerLayoutAndroid.android.js');
@@ -0,0 +1,28 @@
1
+ /**
2
+ * @format
3
+ */
4
+ import type { DrawerLayoutAndroidProps } from '../DrawerLayoutAndroid';
5
+ import AndroidDrawerLayoutNativeComponent from '../AndroidDrawerLayoutNativeComponent';
6
+
7
+ export type BaseDrawerLayoutAndroidDelegateContext = {
8
+ getProps: () => DrawerLayoutAndroidProps
9
+ };
10
+
11
+ export type DrawerLayoutAndroidDelegateInternalProps<
12
+ TNativeComponent extends { new(props: any): React.Component<any> },
13
+ > = {
14
+ drawerOpened: boolean,
15
+ nativeRef: React.ElementRef<typeof AndroidDrawerLayoutNativeComponent>,
16
+ onDrawerOpen: () => void,
17
+ onDrawerClose: () => void,
18
+ onDrawerSlide: (event: { nativeEvent: { offset: number } }) => void,
19
+ onDrawerStateChanged: (newState: 'Idle' | 'Dragging' | 'Settling') => void,
20
+ };
21
+
22
+
23
+ export abstract class BaseDrawerLayoutAndroidDelegate {
24
+ constructor(protected ctx: BaseDrawerLayoutAndroidDelegateContext) { }
25
+ abstract render(
26
+ internalProps: DrawerLayoutAndroidDelegateInternalProps<any>,
27
+ ): React.ReactNode;
28
+ }
@@ -0,0 +1,130 @@
1
+ /**
2
+ * Copyright (c) 2025 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 { View } from "react-native";
9
+ import {
10
+ BaseDrawerLayoutAndroidDelegate,
11
+ DrawerLayoutAndroidDelegateInternalProps,
12
+ } from "./BaseDrawerLayoutAndroidDelegate";
13
+ import AndroidDrawerLayoutNativeComponent from "../AndroidDrawerLayoutNativeComponent";
14
+ import StyleSheet from "../../../StyleSheet/StyleSheet";
15
+ import StatusBar from "../../StatusBar/StatusBar";
16
+ import React from "react";
17
+ import requireNativeComponent from "../../../ReactNative/requireNativeComponent";
18
+ import type { ViewProps } from "../../View/ViewPropTypes";
19
+
20
+ const DrawerLayoutChildWrapperView = requireNativeComponent<
21
+ ViewProps & {
22
+ postTouches: boolean;
23
+ }
24
+ >("DrawerLayoutChildWrapperView");
25
+
26
+ export default class DrawerLayoutAndroidDelegate extends BaseDrawerLayoutAndroidDelegate {
27
+ override render(
28
+ internalProps: DrawerLayoutAndroidDelegateInternalProps<any>
29
+ ): React.ReactNode {
30
+ const propsFromCtx = this.ctx.getProps();
31
+ const {
32
+ drawerBackgroundColor = "white",
33
+ onDrawerStateChanged,
34
+ renderNavigationView,
35
+ onDrawerOpen,
36
+ onDrawerClose,
37
+ ...props
38
+ } = propsFromCtx;
39
+
40
+ const drawStatusBar = propsFromCtx.statusBarBackgroundColor != null;
41
+ const drawerViewWrapper = (
42
+ <DrawerLayoutChildWrapperView
43
+ style={[
44
+ styles.drawerSubview,
45
+ {
46
+ width: propsFromCtx.drawerWidth,
47
+ backgroundColor: drawerBackgroundColor,
48
+ },
49
+ ]}
50
+ pointerEvents={internalProps.drawerOpened ? "auto" : "none"}
51
+ postTouches={true}
52
+ collapsable={false}
53
+ >
54
+ {renderNavigationView()}
55
+ {drawStatusBar && <View style={styles.drawerStatusBar} />}
56
+ </DrawerLayoutChildWrapperView>
57
+ );
58
+ const childrenWrapper = (
59
+ <DrawerLayoutChildWrapperView
60
+ style={styles.mainSubview}
61
+ collapsable={false}
62
+ >
63
+ {drawStatusBar && (
64
+ <StatusBar
65
+ translucent
66
+ backgroundColor={propsFromCtx.statusBarBackgroundColor}
67
+ />
68
+ )}
69
+ {drawStatusBar && (
70
+ <View
71
+ style={[
72
+ styles.statusBar,
73
+ { backgroundColor: propsFromCtx.statusBarBackgroundColor },
74
+ ]}
75
+ />
76
+ )}
77
+ {propsFromCtx.children}
78
+ </DrawerLayoutChildWrapperView>
79
+ );
80
+ //RNOH patch: reorder the drawer and children wrappers to conform to ArkUI's sidebarcontainer
81
+ return (
82
+ <AndroidDrawerLayoutNativeComponent
83
+ {...props}
84
+ ref={internalProps.nativeRef}
85
+ drawerBackgroundColor={drawerBackgroundColor}
86
+ drawerWidth={propsFromCtx.drawerWidth}
87
+ drawerPosition={propsFromCtx.drawerPosition}
88
+ drawerLockMode={propsFromCtx.drawerLockMode}
89
+ style={[styles.base, propsFromCtx.style]}
90
+ onDrawerSlide={internalProps.onDrawerSlide}
91
+ onDrawerOpen={internalProps.onDrawerOpen}
92
+ onDrawerClose={internalProps.onDrawerClose}
93
+ onDrawerStateChanged={internalProps.onDrawerStateChanged}
94
+ >
95
+ {drawerViewWrapper}
96
+ {childrenWrapper}
97
+ </AndroidDrawerLayoutNativeComponent>
98
+ );
99
+ }
100
+ }
101
+
102
+ const styles = StyleSheet.create({
103
+ base: {
104
+ flex: 1,
105
+ elevation: 16,
106
+ },
107
+ mainSubview: {
108
+ position: "absolute",
109
+ top: 0,
110
+ left: 0,
111
+ right: 0,
112
+ bottom: 0,
113
+ },
114
+ drawerSubview: {
115
+ position: "absolute",
116
+ top: 0,
117
+ bottom: 0,
118
+ },
119
+ statusBar: {
120
+ height: StatusBar.currentHeight,
121
+ },
122
+ drawerStatusBar: {
123
+ position: "absolute",
124
+ top: 0,
125
+ left: 0,
126
+ right: 0,
127
+ height: StatusBar.currentHeight,
128
+ backgroundColor: "rgba(0, 0, 0, 0.251)",
129
+ },
130
+ });
@@ -0,0 +1,8 @@
1
+ import { UnsupportedByPlatformError } from "../../../../delegates/DelegateError";
2
+ import { BaseDrawerLayoutAndroidDelegate, DrawerLayoutAndroidDelegateInternalProps } from "./BaseDrawerLayoutAndroidDelegate";
3
+
4
+ export default class DrawerLayoutAndroidDelegate extends BaseDrawerLayoutAndroidDelegate {
5
+ render(internalProps: DrawerLayoutAndroidDelegateInternalProps<any>): React.ReactNode {
6
+ throw new UnsupportedByPlatformError();
7
+ }
8
+ }
@@ -337,3 +337,4 @@ const Touchable: component(
337
337
  Touchable.displayName = 'TouchableOpacity';
338
338
 
339
339
  module.exports = Touchable;
340
+ module.exports.TouchableOpacity = TouchableOpacity;
@@ -260,7 +260,7 @@ class Modal extends React.Component<Props, State> {
260
260
 
261
261
  // Helper function to encapsulate platform specific logic to show or not the Modal.
262
262
  _shouldShowModal(): boolean {
263
- if (Platform.OS === 'ios') {
263
+ if (Platform.OS === 'ios' || Platform.OS === 'harmony') {
264
264
  return this.props.visible === true || this.state.isRendered === true;
265
265
  }
266
266
 
@@ -296,8 +296,8 @@ class Modal extends React.Component<Props, State> {
296
296
  );
297
297
 
298
298
  const onDismiss = () => {
299
- // OnDismiss is implemented on iOS only.
300
- if (Platform.OS === 'ios') {
299
+ // OnDismiss is implemented on iOS and Harmony.
300
+ if (Platform.OS === 'ios' || Platform.OS === 'harmony') {
301
301
  this.setState({isRendered: false}, () => {
302
302
  if (this.props.onDismiss) {
303
303
  this.props.onDismiss();
File without changes
package/index.js CHANGED
@@ -1,8 +1,27 @@
1
+ if (global.window === undefined) {
2
+ /**
3
+ * Some RN framework uses RNOH 72 as a dependency and users of that framework don't install RNOH directly.
4
+ * RN upstream code integration approach changed in RNOH 77, and RNOH must be installed directly.
5
+ *
6
+ * That RN framework SHOULD NOT use RNOH as a dependency (RNOH should be peerDependency). React Native expects
7
+ * Out of Tree platforms to be directly installed in application projects. There's no guarantee that preserving
8
+ * this behavior will be possible in future RN versions.
9
+ *
10
+ * If RN doesn't recognize RNOH as an OOT platform, serializer::getModulesRunBeforeMainModule won't be used.
11
+ * Part of the RN OOT recognition logic depends on dependencies listed in application's package.json
12
+ * (https://github.com/react-native-community/cli/blob/main/packages/cli-config/src/findDependencies.ts).
13
+ */
14
+ require('./Libraries/Core/InitializeCore');
15
+ }
16
+
1
17
  module.exports = {
2
18
  get AccessibilityInfo() {
3
19
  return require('./Libraries/Components/AccessibilityInfo/AccessibilityInfo')
4
20
  .default;
5
21
  },
22
+ get ActionSheetIOS() {
23
+ return require('./Libraries/ActionSheetIOS/ActionSheetIOS');
24
+ },
6
25
  get ActivityIndicator() {
7
26
  return require('./Libraries/Components/ActivityIndicator/ActivityIndicator')
8
27
  .default;
@@ -55,6 +74,10 @@ module.exports = {
55
74
  get ImageBackground() {
56
75
  return require('./Libraries/Image/ImageBackground');
57
76
  },
77
+ get InputAccessoryView() {
78
+ return require('./Libraries/Components/TextInput/InputAccessoryView')
79
+ .default;
80
+ },
58
81
  get I18nManager() {
59
82
  return require('./Libraries/ReactNative/I18nManager');
60
83
  },
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@react-native-oh/react-native-harmony",
3
- "version": "0.77.22",
3
+ "version": "0.77.33",
4
4
  "description": "",
5
5
  "publishConfig": {
6
6
  "registry": "https://registry.npmjs.org/",
@@ -20,7 +20,9 @@
20
20
  "./LICENSE-Meta",
21
21
  "./NOTICE.md",
22
22
  "./metro.config.d.ts",
23
- "./react_native_openharmony.har"
23
+ "./react_native_openharmony.har",
24
+ "./react_native_openharmony_release.har",
25
+ "./react_native_openharmony_release2.har"
24
26
  ],
25
27
  "scripts": {
26
28
  "build": "node ./scripts/build-har.js",
@@ -78,10 +80,5 @@
78
80
  },
79
81
  "harmony": {
80
82
  "autolinking": null
81
- },
82
- "homepage": "https://gitcode.com/openharmony-sig/ohos_react_native",
83
- "repository": {
84
- "type": "gitcode",
85
- "url": "https://gitcode.com/openharmony-sig/ohos_react_native"
86
83
  }
87
84
  }
Binary file
@@ -21,7 +21,7 @@ export * from '../Libraries/Components/ScrollView/ScrollView';
21
21
  // export * from '../Libraries/Components/Slider/Slider';
22
22
  export * from '../Libraries/Components/StatusBar/StatusBar';
23
23
  export * from '../Libraries/Components/Switch/Switch';
24
- // export * from '../Libraries/Components/TextInput/InputAccessoryView';
24
+ export * from '../Libraries/Components/TextInput/InputAccessoryView';
25
25
  export * from '../Libraries/Components/TextInput/TextInput';
26
26
  export * from '../Libraries/Components/ToastAndroid/ToastAndroid';
27
27
  export * from '../Libraries/Components/Touchable/Touchable';