diff --git a/en/react-native-screens.md b/en/react-native-screens.md
index ac221641ee937dd6a95ae3368d4774e1367a69e8..0554ba859fc96510ea25661726bbf2839f0c9716 100644
--- a/en/react-native-screens.md
+++ b/en/react-native-screens.md
@@ -16,116 +16,294 @@
## Installation and Usage
-Go to the project directory and execute the following instruction:
+The HarmonyOS implementation of this library depends on the native code from @react-native-oh-tpl/native and @react-navigation/native-stack and @react-native-oh-tpl/react-native-safe-area-context and @react-native-oh-tpl/react-native-gesture-handler. If this library is included into your HarmonyOS application, there is no need to include it again; you can skip the steps in this section and use it directly.
+
+If it is not included, follow the guide provided in [@react-native-oh-tpl/native](/en/react-navigation-native.md) and [@react-native-oh-tpl/native-stack](/en/react-navigation-native-stack.md) and [@react-native-oh-tpl/react-native-safe-area-context](/en/react-native-safe-area-context.md) and [@react-native-oh-tpl/react-native-gesture-handler](/en/react-native-gesture-handler.md) to add it to your project.
-
+Please visit the Releases page of the third-party library to check the corresponding version information: [@react-native-oh-tpl/react-native-screens Releases](https://github.com/react-native-oh-library/react-native-harmony-screens/releases). For older versions that have not been published to npm, please refer to the [Installation Guide](/zh-cn/tgz-usage.md) to install the tgz package.
+Go to the project directory and execute the following instruction:
#### **npm**
```bash
-npm install @react-navigation/native
-npm install @react-native-oh-tpl/stack
-npm install @react-native-oh-tpl/react-native-safe-area-context
-npm install react-native-screens@3.29.0
+npm install @react-native-oh-tpl/react-native-screens
```
#### **yarn**
```bash
-yarn add @react-navigation/native
-yarn add @react-navigation/stack
-yarn add @react-native-oh-tpl/react-native-safe-area-context
-yarn add react-native-screens@3.29.0
+npm install @react-native-oh-tpl/react-native-screens
```
-
-
The following code shows the basic use scenario of the repository:
> [!WARNING] The name of the imported repository remains unchanged.
```js
-import React from 'react';
-import {ScrollView, Button, View, Text} from 'react-native';
-import {NavigationContainer} from '@react-navigation/native';
-import {createStackNavigator} from '@react-navigation/stack';
+import * as React from 'react';
+import { Button, View } from 'react-native';
+import { NavigationContainer } from '@react-navigation/native';
+import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { enableScreens } from "react-native-screens";
+enableScreens(true);
+
+function HomeScreen({ navigation }) {
+ return (
+
+
+ );
+}
+
+function ProfileScreen({ navigation }) {
+ return (
+
+
+ );
+}
-enableScreens(false);
-function Home({navigation}) {
- return (
-
-
- Home Screen
-
- navigation.push('Detail')} />
-
- );
+function NotificationsScreen({ navigation }) {
+ return (
+
+ navigation.navigate('Settings')}
+ />
+ navigation.goBack()} />
+
+ );
}
-function Detail({navigation}) {
- return (
-
- Details Screen
- navigation.goBack()} />
-
- );
+function SettingsScreen({ navigation }) {
+ return (
+
+ navigation.goBack()} />
+
+ );
}
-const Stack = createStackNavigator();
-
-function NativeNavigation() {
- return (
-
-
-
-
-
-
- );
+const Stack = createNativeStackNavigator();
+
+function MyStack() {
+ return (
+
+
+
+
+
+
+ );
}
-export default function RNScreenTest() {
- return ;
+export default function App() {
+ return (
+
+
+
+ );
}
```
-#### 禁用 `react-native-screens`
-因为 ArkUI侧未提供capi接口,容器组件需要capi化,故本库未实现harmonyOS原生化,所以 react-native-screens 禁用 HarmonyOS 原生屏幕使用 react-native views 即可,请在您的入口文件中添加以下代码。 (例如. `App.js`):
+## Use Codegen
-```js
-import { enableScreens } from "react-native-screens";
+If this repository has been adapted to `Codegen`, generate the bridge code of the third-party library by using the `Codegen`. For details, see [Codegen Usage Guide](https://gitee.com/react-native-oh-library/usage-docs/blob/master/en/codegen.md).
+
+## Link
-enableScreens(false);
+Currently, HarmonyOS does not support AutoLink. Therefore, you need to manually configure the linking.
+Open the `harmony` directory of the HarmonyOS project in DevEco Studio.
+
+### 1. Adding the overrides Field to oh-package.json5 File in the Root Directory of the Project
+
+```json
+{
+ ...
+ "overrides": {
+ "@rnoh/react-native-openharmony" : "file:../node_modules/@rnoh/react-native-harmony/harmony/react_native_openharmony.har"
+ }
+}
```
+### 2. Introducing Native Code
-您还可以通过[detachInactiveScreens](https://reactnavigation.org/docs/stack-navigator#detachinactivescreens)在每个导航器中禁用原生屏幕。
+Currently, two methods are available:
-## Link
-The HarmonyOS implementation of this library depends on the native code from @react-native-oh-tpl/stack and @react-native-oh-tpl/react-native-safe-area-context. If this library is included into your HarmonyOS application, there is no need to include it again; you can skip the steps in this section and use it directly.
+Method 1 (recommended): Use the HAR file.
+
+> [!TIP] The HAR file is stored in the `harmony` directory in the installation path of the third-party library.
+
+Open `entry/oh-package.json5` file and add the following dependencies:
+
+```json
+"dependencies": {
+ "@rnoh/react-native-openharmony": "file:../../node_modules/@rnoh/react-native-harmony/harmony/react_native_openharmony.har",
+ "@react-native-oh-tpl/react-native-screens": "file:../../node_modules/@react-native-oh-tpl/react-native-screens/harmony/screens.har"
+ }
+```
+
+Click the `sync` button in the upper right corner.
+
+Alternatively, run the following instruction on the terminal:
+
+```bash
+cd entry
+ohpm install
+```
+
+Method 2: Directly link to the source code.
+
+> [!TIP] For details, see [Directly Linking Source Code](/en/link-source-code.md).
+
+### 3. Configuring CMakeLists and Introducing Package
+
+Open `entry/src/main/cpp/CMakeLists.txt` and add the following code:
+
+```diff
+project(rnapp)
+cmake_minimum_required(VERSION 3.4.1)
+set(CMAKE_SKIP_BUILD_RPATH TRUE)
+set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules")
+set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules/@rnoh/react-native-openharmony/src/main/cpp")
++ set(OH_MODULES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
+set(RNOH_GENERATED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/generated")
+set(LOG_VERBOSITY_LEVEL 1)
+set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments")
+set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie")
+set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use
+add_compile_definitions(WITH_HITRACE_SYSTRACE)
+
+add_subdirectory("${RNOH_CPP_DIR}" ./rn)
+
+# RNOH_BEGIN: manual_package_linking_1
+add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
++ add_subdirectory("${OH_MODULES_DIR}/@react-native-oh-tpl/react-native-screens/src/main/cpp" ./rnoh_screens)
+# RNOH_END: manual_package_linking_1
+
+file(GLOB GENERATED_CPP_FILES "./generated/*.cpp")
+
+add_library(rnoh_app SHARED
+ ${GENERATED_CPP_FILES}
+ "./PackageProvider.cpp"
+ "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
+)
+target_link_libraries(rnoh_app PUBLIC rnoh)
+
+# RNOH_BEGIN: manual_package_linking_2
+target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
++ target_link_libraries(rnoh_app PUBLIC rnoh_screens)
+# RNOH_END: manual_package_linking_2
+```
+
+Open `entry/src/main/cpp/PackageProvider.cpp`, add:
-If it is not included, follow the guide provided in [@react-native-oh-tpl/stack](/en/react-navigation-stack.md) and [@react-native-oh-tpl/react-native-safe-area-context](/en/react-native-safe-area-context.md) to add it to your project.
+```diff
+#include "RNOH/PackageProvider.h"
+#include "generated/RNOHGeneratedPackage.h"
++ #include "RnohReactNativeHarmonyScreensPackage.h"
+
+using namespace rnoh;
+
+std::vector> PackageProvider::getPackages(Package::Context ctx) {
+ return {
+ std::make_shared(ctx),
+ std::make_shared(ctx),
++ std::make_shared(ctx),
+ };
+}
+```
+
+### 4. Introducing Component to ArkTS
+
+Find `function buildCustomRNComponent()`, which is usually located in `entry/src/main/ets/pages/index.ets` or `entry/src/main/ets/rn/LoadBundle.ets`, and add the following code:
+
+```diff
+ ...
++ import { componentBuilder } from "@react-native-oh-tpl/react-native-screens"
+
+@Builder
+export function buildCustomRNComponent(ctx: ComponentBuilderContext) {
+ ...
+ Stack() {
++ componentBuilder(ctx)
+ }
+ ...
+}
+...
+```
+
+> [!TIP] If the repository uses a mixed solution, the component name needs to be added.
+
+Find the constant `arkTsComponentNames` in `entry/src/main/ets/pages/index.ets` or `entry/src/main/ets/rn/LoadBundle.ets` and add the component name to the array.
+
+```diff
+const arkTsComponentNames: Array = [
++ "RNSScreen",
++ "RNSFullWindowOverlay",
++ "RNSModalScreen",
++ "RNSScreenContainer",
++ "RNSScreenNavigationContainer",
++ "RNSScreenStack",
++ "RNSScreenStackHeaderSubview",
++ "RNSSearchBar",
++ "RNSScreenStackHeaderConfig",
++ "RNSScreenStackHeaderSubview"
+];
+```
+
+### 5. Introducing Package to ArkTS
+
+Open `src/main/ets/RNOHPackagesFactory.ets`, add:
+
+```diff
+import type { RNPackageContext, RNPackage } from '@rnoh/react-native-openharmony';
++ import RnohReactNativeHarmonyScreensPackage from '@react-native-oh-tpl/react-native-screens';
+
+export function createRNOHPackages(ctx: RNPackageContext): RNPackage[] {
+ return [
+ new SamplePackage(ctx),
++ new RnohReactNativeHarmonyScreensPackage(ctx),
+ ];
+}
+
+```
+
+### 6. Running
+
+Click the `sync` button in the upper right corner.
+
+Alternatively, run the following instruction on the terminal:
+
+```bash
+cd entry
+ohpm install
+```
+
+Then build and run the code.
## Constraints
### Compatibility
-This document is verified based on the following versions:
+To use this repository, you need to use the correct React-Native and RNOH versions. In addition, you need to use DevEco Studio and the ROM on your phone.
-1.RNOH:0.72.29; SDK:HarmonyOS-NEXT-DB6 5.0.0.61; IDE:DevEco Studio 5.0.3.706; ROM:3.0.0.60;
+Check the release version information in the release address of the third-party library: [@react-native-oh-tpl/react-native-screens Releases](https://github.com/react-native-oh-library/react-native-harmony-screens/releases)
## Properties
@@ -133,27 +311,57 @@ This document is verified based on the following versions:
> [!TIP] If the value of **HarmonyOS Support** is **yes**, it means that the HarmonyOS platform supports this property; **no** means the opposite; **partially** means some capabilities of this property are supported. The usage method is the same on different platforms and the effect is the same as that of iOS or Android.
-| Name | Description | Type | Required | Platform | HarmonyOS Support |
-|-----------------------------------------------------------|---------------------------------------------------------------------------------------|----------|----------|-------------|-------------------|
-| enableScreens | 支持原生及其 React Native View | function | No | iOS Android | Yes |
-| enableFreeze | 对 react-freeze 的支持,使用 ReactSuspense 机制来防止 React 组件树的部分渲染 | function | No | iOS Android | Yes |
-| createNativeStackNavigator | 提供屏幕切换的能力 | function | No | iOS Android | NO |
-| NativeStackNavigationProp | 切换页面属性的封装 | object | No | iOS Android | Yes |
-| NativeStackNavigationOptions | 导航栏属性设置封装 | object | No | iOS Android | NO |
-| FullWindowOverlay | 一个组件,可以将其子组件放在其他组件之上 | object | No | iOS Android | NO |
-| SearchBarProps | 搜索栏的属性设置封装 | object | No | iOS Android | NO |
-| SearchBarCommands | 搜索栏的操作封装 | object | No | iOS Android | NO |
-| useTransitionProgress | 提供屏幕过渡的动画插值器 | function | No | iOS Android | NO |
-| userReanimatedTransitionProgress ReanimatedScreenProvider | 屏幕切换期间调用的帧回调,用于 react-native-reanimated 2.0 及其以上的版本,并使用 ReanimatedScreenProvider 进行封装 | function | No | iOS Android | NO |
-| userHeaderHeight | 计算静态标题栏的高度,当屏幕方向发生更改,此值会发生更改 | function | No | iOS Android | NO |
-| userAnimatedHeaderHeight | 动态计算标题栏的高度,此值会随着每个视图布局变化而变化 | function | No | iOS Android | NO |
+| Name | Description | Type | Required | Platform | HarmonyOS Support |
+| --------------------------------------------------------- | ------------------------------------------------------------ | -------- | -------- | ----------- | ----------------- |
+| enableScreens | Support native and its React Native View | function | No | iOS Android | Yes |
+| enableFreeze | Support for react-freeze, using ReactSuspende mechanism to prevent partial rendering of React component tree | function | No | iOS Android | Yes |
+| onAppear | A callback that gets called when the current screen appears | function | No | iOS Android | Yes |
+| onDisappear | A callback that gets called when the current screen disappears. | function | No | iOS Android | Yes |
+| onWillAppear | A callback that gets called when the current screen will appear | function | No | iOS Android | Yes |
+| onWillDisappear | A callback that gets called when the current screen will disappear | function | No | iOS Android | Yes |
+| fullScreenSwipeEnabled | Boolean indicating whether the swipe gesture should work on whole screen | property | No | iOS Android | Yes |
+| gestureEnabled | Whether you can use gestures to dismiss this screen | property | No | iOS Android | Yes |
+| statusBarColor | Sets the status bar color | property | No | iOS Android | No |
+| screenOrientation | In which orientation should the screen appear | property | No | iOS Android | Yes |
+| statusBarStyle | Sets the status bar color | property | No | iOS Android | Yes |
+| statusBarTranslucent | Sets the translucency of the status bar | property | No | iOS Android | Yes |
+| statusBarHidden | Whether the status bar should be hidden on this screen | property | No | iOS Android | Yes |
+| gestureResponseDistance | Use it to restrict the distance from the edges of screen in which the gesture should be recognized | property | No | iOS Android | Yes |
+| stackPresentation | how should the screen be presented | property | No | iOS Android | Yes |
+| stackAnimation | ow the screen should appear/disappear when pushed or popped at the top of the stack | property | No | iOS Android | Yes |
+| replaceAnimation | How should the screen replacing another screen animate | property | No | iOS Android | Yes |
+| backgroundColor | Controls the color of the navigation header | property | No | iOS Android | Yes |
+| hidden | When set to true the header will be hidden while the parent Screen is on the top of the stack | property | No | iOS Android | Yes |
+| translucent | Boolean indicating whether the navigation bar is translucent | property | No | iOS Android | Yes |
+| hideBackButton | Boolean indicating whether to hide the back button in header | property | No | iOS Android | Yes |
+| backTitle | Title to display in the back button. | property | No | iOS Android | Yes |
+| backTitleFontSize | Allows for customizing font size to be used for back button title | property | No | iOS Android | Yes |
+| backTitleVisible | Whether the back button title should be visible or nots | property | No | iOS Android | Yes |
+| title | String that can be displayed in the header as a fallback for `headerTitle` | property | No | iOS Android | Yes |
+| titleFontSize | Customize the size of the font to be used for the title. | property | No | iOS Android | Yes |
+| titleFontWeight | Customize the weight of the font to be used for the title. | property | No | iOS Android | Yes |
+| titleColor | Allows for setting text color of the title | property | No | iOS Android | Yes |
+| type | Subtitle type | property | No | iOS Android | Yes |
+| onSearchFocus | Search bar focus | function | No | iOS Android | Yes |
+| onSearchBlur | Search bar loses focus | function | No | iOS Android | Yes |
+| onSearchButtonPress | A callback that gets called when the search button is pressed | function | No | iOS Android | Yes |
+| onCancelButtonPress | A callback that gets called when the cancel button is pressed | function | No | iOS Android | Yes |
+| onChangeText | A callback that gets called when the text changes | function | No | iOS Android | Yes |
+| cancelButtonText | The text to be used instead of default `Cancel` button text | property | No | iOS Android | Yes |
+| barTintColor | The search field background color | property | No | iOS Android | Yes |
+| tintColor | The color for the cursor caret and cancel button text | property | No | iOS Android | Yes |
+| textColor | text color | property | No | iOS Android | Yes |
+| inputType | Sets type of the input. Defaults to `text`. | property | No | iOS Android | Yes |
+| onClose | A callback that gets called when search bar is closed | function | No | iOS Android | Yes |
+| onOpen | A callback that gets called when search bar is opened | function | No | iOS Android | Yes |
+| headerIconColor | The search and close icon color shown in the header | property | No | iOS Android | Yes |
+| shouldShowHintSearchIcon | Show the search hint icon when search bar is focused | property | No | iOS Android | Yes |
## Known Issues
-
-- [ ] ArkUI侧未提供capi接口,容器组件需要capi化,故本库未实现harmonyOS原生化适配,harmonyOS侧仅支持部分属性。
+- [ ] The formSheet page is currently using a regular page, and the Context.openBindSheet system method used on this page has a misalignment of the binding position of the JS page, resulting in unresponsive button events. Need to be supplemented after system correction. [issue#4](https://github.com/react-native-oh-library/react-native-harmony-screens/issues/4)
## Others
## License
-This project is licensed under [The MIT License (MIT)](https://github.com/software-mansion/react-native-screens/blob/main/LICENSE).
+This project is licensed under [The MIT License (MIT)](https://github.com/react-native-oh-library/react-native-harmony-screens/blob/sig/LICENSE).
diff --git a/zh-cn/react-native-screens.md b/zh-cn/react-native-screens.md
index a13e3dcb44c41114165d9826d7d2eae2fd3c024f..08fb6cbba3c592a22caa2508a4a1634c6ace1479 100644
--- a/zh-cn/react-native-screens.md
+++ b/zh-cn/react-native-screens.md
@@ -16,115 +16,298 @@
## 安装与使用
-进入到工程目录并输入以下命令:
+本库 HarmonyOS 侧实现依赖 @react-navigation/native 、 @react-navigation/native-stack 、 @react-native-oh-tpl/react-native-safe-area-context 、 @react-native-oh-tpl/react-native-gesture-handler 的原生端代码,如已在 HarmonyOS 工程中引入过该库,则无需再次引入,可跳过本章节步骤,直接使用。
+
+如未引入请参照 [@react-navigation/native 文档的 Link 章节](/zh-cn/react-navigation-native.md) , [@react-navigation/native-stack 文档的 Link 章节](/zh-cn/react-navigation-native-stack.md) ,[@react-native-oh-tpl/react-native-gesture-handler 文档的 Link 章节](/zh-cn/react-native-gesture-handler.md) ,[@react-native-oh-tpl/react-native-safe-area-context 文档的 Link 章节](/zh-cn/react-native-safe-area-context.md)进行引入。
-
+请到三方库的 Releases 发布地址查看配套的版本信息:[@react-native-oh-tpl/react-native-screens Releases](https://github.com/react-native-oh-library/react-native-harmony-screens/releases) 。对于未发布到npm的旧版本,请参考[安装指南](/zh-cn/tgz-usage.md)安装tgz包。
+
+进入到工程目录并输入以下命令:
#### **npm**
```bash
-npm install @react-navigation/native
-npm install @react-native-oh-tpl/stack
-npm install @react-native-oh-tpl/react-native-safe-area-context
-npm install react-native-screens@3.29.0
+npm install @react-native-oh-tpl/react-native-screens
```
#### **yarn**
```bash
-yarn add @react-navigation/native
-yarn add @react-navigation/stack
-yarn add @react-native-oh-tpl/react-native-safe-area-context
-yarn add react-native-screens@3.29.0
+npm install @react-native-oh-tpl/react-native-screens
```
-
-
下面的代码展示了这个库的基本使用场景:
> [!WARNING] 使用时 import 的库名不变。
```js
-import React from 'react';
-import {ScrollView, Button, View, Text} from 'react-native';
-import {NavigationContainer} from '@react-navigation/native';
-import {createStackNavigator} from '@react-navigation/stack';
+import * as React from 'react';
+import { Button, View } from 'react-native';
+import { NavigationContainer } from '@react-navigation/native';
+import { createNativeStackNavigator } from '@react-navigation/native-stack';
import { enableScreens } from "react-native-screens";
+enableScreens(true);
+
+function HomeScreen({ navigation }) {
+ return (
+
+ navigation.navigate('Profile')}
+ />
+
+ );
+}
+
+function ProfileScreen({ navigation }) {
+ return (
+
+ navigation.navigate('Notifications')}
+ />
+ navigation.goBack()} />
+
+ );
+}
-enableScreens(false);
-function Home({navigation}) {
- return (
-
-
- Home Screen
-
- navigation.push('Detail')} />
-
- );
+function NotificationsScreen({ navigation }) {
+ return (
+
+ navigation.navigate('Settings')}
+ />
+ navigation.goBack()} />
+
+ );
}
-function Detail({navigation}) {
- return (
-
- 我是Details Screen
- navigation.goBack()} />
-
- );
+function SettingsScreen({ navigation }) {
+ return (
+
+ navigation.goBack()} />
+
+ );
}
-const Stack = createStackNavigator();
-
-function NativeNavigation() {
- return (
-
-
-
-
-
-
- );
+const Stack = createNativeStackNavigator();
+
+function MyStack() {
+ return (
+
+
+
+
+
+
+ );
}
-export default function RNScreenTest() {
- return ;
+export default function App() {
+ return (
+
+
+
+ );
}
```
-#### 禁用 `react-native-screens`
+## 使用 Codegen
-因为 ArkUI侧未提供capi接口,容器组件需要capi化,故本库未实现harmonyOS原生化,所以 react-native-screens 禁用 HarmonyOS 原生屏幕使用 react-native views 即可,请在您的入口文件中添加以下代码。 (例如. `App.js`):
+本库已经适配了 `Codegen` ,在使用前需要主动执行生成三方库桥接代码,详细请参考[ Codegen 使用文档](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/codegen.md)。
-```js
-import { enableScreens } from "react-native-screens";
+## Link
+
+
+目前HarmonyOS暂不支持 AutoLink,所以 Link 步骤需要手动配置。
+首先需要使用 DevEco Studio 打开项目里的HarmonyOS工程 `harmony`
+
+### 1.在工程根目录的 `oh-package.json5` 添加 overrides 字段
-enableScreens(false);
+```json
+{
+ ...
+ "overrides": {
+ "@rnoh/react-native-openharmony" : "file:../node_modules/@rnoh/react-native-harmony/harmony/react_native_openharmony.har"
+ }
+}
```
-您还可以通过[detachInactiveScreens](https://reactnavigation.org/docs/stack-navigator#detachinactivescreens)在每个导航器中禁用原生屏幕。
+### 2.引入原生端代码
-## Link
+目前有两种方法:
+
+1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
+2. 直接链接源码。
+
+方法一:通过 har 包引入(推荐)
+
+> [!TIP] har 包位于三方库安装路径的 `harmony` 文件夹下。
+
+打开 `entry/oh-package.json5`,添加以下依赖
+
+```json
+"dependencies": {
+ "@rnoh/react-native-openharmony": "file:../../node_modules/@rnoh/react-native-harmony/harmony/react_native_openharmony.har",
+ "@react-native-oh-tpl/react-native-screens": "file:../../node_modules/@react-native-oh-tpl/react-native-screens/harmony/screens.har"
+ }
+```
+
+点击右上角的 `sync` 按钮
+
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+方法二:直接链接源码
+
+> [!TIP] 如需使用直接链接源码,请参考[直接链接源码说明](/zh-cn/link-source-code.md)
+
+### 3.配置 CMakeLists 和引入 Package
+
+打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
+
+```diff
+project(rnapp)
+cmake_minimum_required(VERSION 3.4.1)
+set(CMAKE_SKIP_BUILD_RPATH TRUE)
+set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+set(NODE_MODULES "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../node_modules")
+set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules/@rnoh/react-native-openharmony/src/main/cpp")
++ set(OH_MODULES_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
+set(RNOH_GENERATED_DIR "${CMAKE_CURRENT_SOURCE_DIR}/generated")
+set(LOG_VERBOSITY_LEVEL 1)
+set(CMAKE_ASM_FLAGS "-Wno-error=unused-command-line-argument -Qunused-arguments")
+set(CMAKE_CXX_FLAGS "-fstack-protector-strong -Wl,-z,relro,-z,now,-z,noexecstack -s -fPIE -pie")
+set(WITH_HITRACE_SYSTRACE 1) # for other CMakeLists.txt files to use
+add_compile_definitions(WITH_HITRACE_SYSTRACE)
+
+add_subdirectory("${RNOH_CPP_DIR}" ./rn)
+
+# RNOH_BEGIN: manual_package_linking_1
+add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
++ add_subdirectory("${OH_MODULES_DIR}/@react-native-oh-tpl/react-native-screens/src/main/cpp" ./rnoh_screens)
+# RNOH_END: manual_package_linking_1
+
+file(GLOB GENERATED_CPP_FILES "./generated/*.cpp")
+
+add_library(rnoh_app SHARED
+ ${GENERATED_CPP_FILES}
+ "./PackageProvider.cpp"
+ "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
+)
+target_link_libraries(rnoh_app PUBLIC rnoh)
+
+# RNOH_BEGIN: manual_package_linking_2
+target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
++ target_link_libraries(rnoh_app PUBLIC rnoh_screens)
+# RNOH_END: manual_package_linking_2
+```
+
+打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
+
+```diff
+#include "RNOH/PackageProvider.h"
+#include "generated/RNOHGeneratedPackage.h"
++ #include "RnohReactNativeHarmonyScreensPackage.h"
+
+using namespace rnoh;
+
+std::vector> PackageProvider::getPackages(Package::Context ctx) {
+ return {
+ std::make_shared(ctx),
+ std::make_shared(ctx),
++ std::make_shared(ctx),
+ };
+}
+```
+
+### 4.在ArkTs侧导入组件
+
+找到 function buildCustomRNComponent(),一般位于 entry/src/main/ets/pages/index.ets 或 entry/src/main/ets/rn/LoadBundle.ets,添加:
+
+```diff
+ ...
++ import { componentBuilder } from "@react-native-oh-tpl/react-native-screens"
+
+@Builder
+export function buildCustomRNComponent(ctx: ComponentBuilderContext) {
+ ...
+ Stack() {
++ componentBuilder(ctx)
+ }
+ ...
+}
+...
+```
+
+> [!TIP] 本库使用了混合方案,需要添加组件名。
+
+在entry/src/main/ets/pages/index.ets 或 entry/src/main/ets/rn/LoadBundle.ets 找到常量 arkTsComponentNames 在其数组里添加组件名
+
+```diff
+const arkTsComponentNames: Array = [
++ "RNSScreen",
++ "RNSFullWindowOverlay",
++ "RNSModalScreen",
++ "RNSScreenContainer",
++ "RNSScreenNavigationContainer",
++ "RNSScreenStack",
++ "RNSScreenStackHeaderSubview",
++ "RNSSearchBar",
++ "RNSScreenStackHeaderConfig",
++ "RNSScreenStackHeaderSubview"
+];
+```
+
+### 5.在ArkTs侧引入Package
+
+打开 `src/main/ets/RNOHPackagesFactory.ets`,添加:
+
+```diff
+ ...
+import type { RNPackageContext, RNPackage } from '@rnoh/react-native-openharmony';
++ import RnohReactNativeHarmonyScreensPackage from '@react-native-oh-tpl/react-native-screens';
+
+export function createRNOHPackages(ctx: RNPackageContext): RNPackage[] {
+ return [
+ new SamplePackage(ctx),
++ new RnohReactNativeHarmonyScreensPackage(ctx),
+ ];
+}
+
+```
+
+### 6.运行
-本库 HarmonyOS 侧实现依赖 @react-native-oh-tpl/stack 与 @react-native-oh-tpl/react-native-safe-area-context 的原生端代码,如已在 HarmonyOS 工程中引入过该库,则无需再次引入,可跳过本章节步骤,直接使用。
+点击右上角的 `sync` 按钮
-如未引入请参照 [@react-native-oh-tpl/stack 文档的 Link 章节](/zh-cn/react-navigation-stack.md) 与 [@react-native-oh-tpl/react-native-safe-area-context 文档的 Link 章节](/zh-cn/react-native-safe-area-context.md)进行引入。
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+然后编译、运行即可。
## 约束与限制
### 兼容性
-本文档内容基于以下版本验证通过:
+要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
-1.RNOH:0.72.29; SDK:HarmonyOS-NEXT-DB6 5.0.0.61; IDE:DevEco Studio 5.0.3.706; ROM:3.0.0.60;
+请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[@react-native-oh-tpl/react-native-harmony-screens Releases](https://github.com/react-native-oh-library/react-native-harmony-screens/releases)
## 属性
@@ -132,27 +315,57 @@ enableScreens(false);
> [!TIP] "HarmonyOS Support"列为 yes 表示 HarmonyOS 平台支持该属性;no 则表示不支持;partially 表示部分支持。使用方法跨平台一致,效果对标 iOS 或 Android 的效果。
-| Name | Description | Type | Required | Platform | HarmonyOS Support |
-|-----------------------------------------------------------|---------------------------------------------------------------------------------------|----------|----------|-------------|-------------------|
-| enableScreens | 支持原生及其 React Native View | function | No | iOS Android | Yes |
-| enableFreeze | 对 react-freeze 的支持,使用 ReactSuspense 机制来防止 React 组件树的部分渲染 | function | No | iOS Android | Yes |
-| createNativeStackNavigator | 提供屏幕切换的能力 | function | No | iOS Android | NO |
-| NativeStackNavigationProp | 切换页面属性的封装 | object | No | iOS Android | Yes |
-| NativeStackNavigationOptions | 导航栏属性设置封装 | object | No | iOS Android | NO |
-| FullWindowOverlay | 一个组件,可以将其子组件放在其他组件之上 | object | No | iOS Android | NO |
-| SearchBarProps | 搜索栏的属性设置封装 | object | No | iOS Android | NO |
-| SearchBarCommands | 搜索栏的操作封装 | object | No | iOS Android | NO |
-| useTransitionProgress | 提供屏幕过渡的动画插值器 | function | No | iOS Android | NO |
-| userReanimatedTransitionProgress ReanimatedScreenProvider | 屏幕切换期间调用的帧回调,用于 react-native-reanimated 2.0 及其以上的版本,并使用 ReanimatedScreenProvider 进行封装 | function | No | iOS Android | NO |
-| userHeaderHeight | 计算静态标题栏的高度,当屏幕方向发生更改,此值会发生更改 | function | No | iOS Android | NO |
-| userAnimatedHeaderHeight | 动态计算标题栏的高度,此值会随着每个视图布局变化而变化 | function | No | iOS Android | NO |
+| Name | Description | Type | Required | Platform | HarmonyOS Support |
+| --------------------------------------------------------- | ------------------------------------------------------------ | -------- | -------- | ----------- | ----------------- |
+| enableScreens | 支持原生及其 React Native View | function | No | iOS Android | Yes |
+| enableFreeze | 对 react-freeze 的支持,使用 ReactSuspense 机制来防止 React 组件树的部分渲染 | function | No | iOS Android | Yes |
+| onAppear | 页面显示 | function | No | iOS Android | Yes |
+| onDisappear | 页面消失 | function | No | iOS Android | Yes |
+| onWillAppear | 页面将显示 | function | No | iOS Android | Yes |
+| onWillDisappear | 页面将消失 | function | No | iOS Android | Yes |
+| fullScreenSwipeEnabled | 全屏滑动 | property | No | iOS Android | Yes |
+| gestureEnabled | 是否开启手势滑动 | property | No | iOS Android | Yes |
+| statusBarColor | 状态栏颜色 | property | No | iOS Android | No |
+| screenOrientation | 屏幕显示方向 | property | No | iOS Android | Yes |
+| statusBarStyle | 状态栏样式 | property | No | iOS Android | Yes |
+| statusBarTranslucent | 状态栏是否透明化 | property | No | iOS Android | Yes |
+| statusBarHidden | 隐藏状态栏 | property | No | iOS Android | Yes |
+| gestureResponseDistance | 手势滑动的有效区域 | property | No | iOS Android | Yes |
+| stackPresentation | 页面类型 | property | No | iOS Android | Yes |
+| stackAnimation | 转场动画类型 | property | No | iOS Android | Yes |
+| replaceAnimation | 进出栈类型 | property | No | iOS Android | Yes |
+| backgroundColor | 标题栏背景色 | property | No | iOS Android | Yes |
+| hidden | 隐藏标题栏 | property | No | iOS Android | Yes |
+| translucent | 标题栏是否透明化 | property | No | iOS Android | Yes |
+| hideBackButton | 隐藏标题栏返回按钮 | property | No | iOS Android | Yes |
+| backTitle | 返回按钮文本内容 | property | No | iOS Android | Yes |
+| backTitleFontSize | 返回按钮文本字号大小 | property | No | iOS Android | Yes |
+| backTitleVisible | 返回按钮文本是否显示 | property | No | iOS Android | Yes |
+| title | 标题栏标题 | property | No | iOS Android | Yes |
+| titleFontSize | 标题字号大小 | property | No | iOS Android | Yes |
+| titleFontWeight | 标题字号比重 | property | No | iOS Android | Yes |
+| titleColor | 标题颜色 | property | No | iOS Android | Yes |
+| type | 子标题类型 | property | No | iOS Android | Yes |
+| onSearchFocus | 搜索栏聚焦 | function | No | iOS Android | Yes |
+| onSearchBlur | 搜索栏失去焦点 | function | No | iOS Android | Yes |
+| onSearchButtonPress | 搜索 | function | No | iOS Android | Yes |
+| onCancelButtonPress | 取消搜索 | function | No | iOS Android | Yes |
+| onChangeText | 搜索栏文本变更 | function | No | iOS Android | Yes |
+| cancelButtonText | 取消按钮文本内容 | property | No | iOS Android | Yes |
+| barTintColor | 搜索背景色 | property | No | iOS Android | Yes |
+| tintColor | 搜索提示文字颜色 | property | No | iOS Android | Yes |
+| textColor | 文字颜色 | property | No | iOS Android | Yes |
+| inputType | 文本输入类型 | property | No | iOS Android | Yes |
+| onClose | 关闭搜索 | function | No | iOS Android | Yes |
+| onOpen | 展示搜索 | function | No | iOS Android | Yes |
+| headerIconColor | 图标颜色 | property | No | iOS Android | Yes |
+| shouldShowHintSearchIcon | 是否隐藏搜索图标 | property | No | iOS Android | Yes |
## 遗留问题
-
-- [ ] ArkUI侧未提供capi接口,容器组件需要capi化,故本库未实现harmonyOS原生化适配,harmonyOS侧仅支持部分属性。
+- [ ] formSheet页面暂使用普通页面,该页面使用的Context.openBindSheet系统方法存在绑定的js页面绑定的位置错乱,造成按钮事件会无法响应。需要系统修正后补充。 [issue#4](https://github.com/react-native-oh-library/react-native-harmony-screens/issues/4)
## 其他
## 开源协议
-本项目基于 [The MIT License (MIT)](https://github.com/software-mansion/react-native-screens/blob/main/LICENSE) ,请自由地享受和参与开源。
+本项目基于 [The MIT License (MIT)](https://github.com/react-native-oh-library/react-native-harmony-screens/blob/sig/LICENSE) ,请自由地享受和参与开源。