From 1b42f1218890b1afb65a92860685b5f17f508a3f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98bug123?= <1518171514@qq.com>
Date: Wed, 6 Dec 2023 01:55:19 +0000
Subject: [PATCH 01/15] =?UTF-8?q?[Issues:=20#I8M3G8]=20=E6=B7=BB=E5=8A=A0d?=
=?UTF-8?q?atetimepicker=E6=96=87=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zh-cn/datetimepicker.md | 253 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 253 insertions(+)
create mode 100644 zh-cn/datetimepicker.md
diff --git a/zh-cn/datetimepicker.md b/zh-cn/datetimepicker.md
new file mode 100644
index 000000000..85e42d24b
--- /dev/null
+++ b/zh-cn/datetimepicker.md
@@ -0,0 +1,253 @@
+
+
@react-native-community/datetimepicker
+
+
+
+
+
+
+
+
+
+
+## 安装与使用
+
+进入到工程目录并输入以下命令:
+
+```bash
+yarn add @react-native-community/datetimepicker@npm:@react-native-oh-tpl/datetimepicker
+```
+
+或者
+
+```bash
+npm install @react-native-community/datetimepicker@npm:@react-native-oh-tpl/datetimepicker
+```
+
+下面的代码展示了这个库的基本使用场景:
+
+```js
+import DateTimePicker from '@react-native-community/datetimepicker';
+
+export const App = () => {
+ const [date, setDate] = useState(new Date(1598051730000));
+ const [mode, setMode] = useState('date');
+ const [show, setShow] = useState(false);
+
+ const onChange = (event, selectedDate) => {
+ const currentDate = selectedDate;
+ setShow(false);
+ setDate(currentDate);
+ };
+
+ const showMode = (currentMode) => {
+ setShow(true);
+ setMode(currentMode);
+ };
+
+ const showDatepicker = () => {
+ showMode('date');
+ };
+
+ const showTimepicker = () => {
+ showMode('time');
+ };
+
+ return (
+
+
+
+ selected: {date.toLocaleString()}
+ {show && (
+
+ )}
+
+ );
+};
+```
+
+## Link
+
+目前鸿蒙暂不支持 AutoLink,所以 Link 步骤需要手动配置。
+
+首先需要使用 DevEco Studio 打开项目里的鸿蒙工程 `harmony`
+
+### 引入原生端代码
+
+目前有两种方法:
+
+1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
+2. 直接链接源码。
+
+方法一:通过 har 包引入
+打开 `entry/oh-package.json5`,添加以下依赖
+
+```json
+"dependencies": {
+ "rnoh": "file:../rnoh",
+ "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker.har"
+ }
+```
+
+点击右上角的 `sync` 按钮
+
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+方法二:直接链接源码
+打开 `entry/oh-package.json5`,添加以下依赖
+
+```json
+"dependencies": {
+ "rnoh": "file:../rnoh",
+ "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker"
+ }
+```
+
+打开终端,执行:
+
+```bash
+cd entry
+ohpm install --no-link
+```
+
+### 配置 CMakeLists 和引入 datetimepicker
+
+打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
+
+```diff
+project(rnapp)
+cmake_minimum_required(VERSION 3.4.1)
+set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
+set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
+
+add_subdirectory("${RNOH_CPP_DIR}" ./rn)
+
+# RNOH_BEGIN: add_package_subdirectories
+add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
++ add_subdirectory("${OH_MODULE_DIR}/rnoh-datetimepicker/src/main/cpp" ./datetimepicker)
+# RNOH_END: add_package_subdirectories
+
+add_library(rnoh_app SHARED
+ "./PackageProvider.cpp"
+ "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
+)
+
+target_link_libraries(rnoh_app PUBLIC rnoh)
+
+# RNOH_BEGIN: link_packages
+target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
++ target_link_libraries(rnoh_app PUBLIC rnoh_datetime_picker)
+# RNOH_END: link_packages
+```
+
+打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
+
+```diff
+#include "RNOH/PackageProvider.h"
+#include "SamplePackage.h"
++ #include "DateTimePickerPackage.h"
+
+using namespace rnoh;
+
+std::vector> PackageProvider::getPackages(Package::Context ctx) {
+ return {
+ std::make_shared(ctx),
++ std::make_shared(ctx)
+ };
+}
+```
+
+### 在 ArkTs 侧引入 DateTimePicker 组件
+
+打开 `entry/src/main/ets/pages/index.ets`,添加:
+
+```diff
+import {
+ RNApp,
+ ComponentBuilderContext,
+ RNAbility,
+ AnyJSBundleProvider,
+ MetroJSBundleProvider,
+ ResourceJSBundleProvider,
+} from 'rnoh'
+import { SampleView, SAMPLE_VIEW_TYPE, PropsDisplayer } from "rnoh-sample-package"
+import { createRNPackages } from '../RNPackagesFactory'
++ import { RNDateTimePicker, DATETIME_PICKER_VIEW_TYPE } from "rnoh-datetimepicker"
+
+@Builder
+function CustomComponentBuilder(ctx: ComponentBuilderContext) {
+ if (ctx.componentName === SAMPLE_VIEW_TYPE) {
+ SampleView({
+ ctx: ctx.rnohContext,
+ tag: ctx.descriptor.tag,
+ buildCustomComponent: CustomComponentBuilder
+ })
+ }
++ else if (ctx.componentName === DATETIME_PICKER_VIEW_TYPE) {
++ RNDateTimePicker({
++ ctx: ctx.rnohContext,
++ tag: ctx.descriptor.tag,
++ buildCustomComponent: CustomComponentBuilder
++ })
++ }
+ ...
+}
+...
+```
+
+### 运行
+
+点击右上角的 `sync` 按钮
+
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+然后编译、运行即可。
+
+## 兼容性
+
+要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
+
+| `@react-native-oh-library/datetimepicker` Version | Required React Native Version | Required RNOH Version | Required DevEco Studio Version | Required ROM Version |
+| ------------------------------------------------- | ----------------------------- | --------------------- | ------------------------------ | --------------------- |
+| `7.6.2-0.0.2` | `0.72.5` | `0.72.9` | `4.0.3.601` | `OpenHarmony 4.10.11` |
+
+## 属性
+
+| 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
+| ----------- | ------------------------------------------------------------------------- | -------- | -------- | ------------------------ | -------- |
+| mode | Defines the type of the picker | string | 否 | All | yes |
+| style | Sets style directly on picker component. | object | 否 | All | yes |
+| display | Defines the visual display of the picker. The default value is "default". | string | 否 | All | yes |
+| onChange | Date change handler. | function | 否 | All | yes |
+| value | Defines the date or time value used in the component. | Date | 是 | All | yes |
+| is24Hour | Allows changing of the time picker to a 24-hour format. | bool | 否 | Windows and Android only | yes |
+| maximumDate | Defines the maximum date that can be selected | Date | 否 | All | yes |
+| minimumDate | Defines the minimum date that can be selected. | Date | 否 | All | yes |
+| disabled | If true, the user won't be able to interact with the view. | bool | 否 | All | yes |
+
+## 遗留问题
+
+- [ ] 部分接口,未适配
+
+## 其他
+
+## 开源协议
+
+本项目基于 [The MIT License (MIT)](https://github.com/react-native-oh-library/datetimepicker/blob/harmony/LICENSE) ,请自由地享受和参与开源。
--
Gitee
From 6074fadda54da6c0d7f86e747f543452263f5414 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98bug123?= <1518171514@qq.com>
Date: Wed, 6 Dec 2023 10:36:33 +0000
Subject: [PATCH 02/15] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20zh?=
=?UTF-8?q?-cn/datetimepicker.md?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zh-cn/datetimepicker.md | 253 ----------------------------------------
1 file changed, 253 deletions(-)
delete mode 100644 zh-cn/datetimepicker.md
diff --git a/zh-cn/datetimepicker.md b/zh-cn/datetimepicker.md
deleted file mode 100644
index 85e42d24b..000000000
--- a/zh-cn/datetimepicker.md
+++ /dev/null
@@ -1,253 +0,0 @@
-
-
@react-native-community/datetimepicker
-
-
-
-
-
-
-
-
-
-
-## 安装与使用
-
-进入到工程目录并输入以下命令:
-
-```bash
-yarn add @react-native-community/datetimepicker@npm:@react-native-oh-tpl/datetimepicker
-```
-
-或者
-
-```bash
-npm install @react-native-community/datetimepicker@npm:@react-native-oh-tpl/datetimepicker
-```
-
-下面的代码展示了这个库的基本使用场景:
-
-```js
-import DateTimePicker from '@react-native-community/datetimepicker';
-
-export const App = () => {
- const [date, setDate] = useState(new Date(1598051730000));
- const [mode, setMode] = useState('date');
- const [show, setShow] = useState(false);
-
- const onChange = (event, selectedDate) => {
- const currentDate = selectedDate;
- setShow(false);
- setDate(currentDate);
- };
-
- const showMode = (currentMode) => {
- setShow(true);
- setMode(currentMode);
- };
-
- const showDatepicker = () => {
- showMode('date');
- };
-
- const showTimepicker = () => {
- showMode('time');
- };
-
- return (
-
-
-
- selected: {date.toLocaleString()}
- {show && (
-
- )}
-
- );
-};
-```
-
-## Link
-
-目前鸿蒙暂不支持 AutoLink,所以 Link 步骤需要手动配置。
-
-首先需要使用 DevEco Studio 打开项目里的鸿蒙工程 `harmony`
-
-### 引入原生端代码
-
-目前有两种方法:
-
-1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
-2. 直接链接源码。
-
-方法一:通过 har 包引入
-打开 `entry/oh-package.json5`,添加以下依赖
-
-```json
-"dependencies": {
- "rnoh": "file:../rnoh",
- "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker.har"
- }
-```
-
-点击右上角的 `sync` 按钮
-
-或者在终端执行:
-
-```bash
-cd entry
-ohpm install
-```
-
-方法二:直接链接源码
-打开 `entry/oh-package.json5`,添加以下依赖
-
-```json
-"dependencies": {
- "rnoh": "file:../rnoh",
- "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker"
- }
-```
-
-打开终端,执行:
-
-```bash
-cd entry
-ohpm install --no-link
-```
-
-### 配置 CMakeLists 和引入 datetimepicker
-
-打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
-
-```diff
-project(rnapp)
-cmake_minimum_required(VERSION 3.4.1)
-set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
-set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
-
-add_subdirectory("${RNOH_CPP_DIR}" ./rn)
-
-# RNOH_BEGIN: add_package_subdirectories
-add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
-+ add_subdirectory("${OH_MODULE_DIR}/rnoh-datetimepicker/src/main/cpp" ./datetimepicker)
-# RNOH_END: add_package_subdirectories
-
-add_library(rnoh_app SHARED
- "./PackageProvider.cpp"
- "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
-)
-
-target_link_libraries(rnoh_app PUBLIC rnoh)
-
-# RNOH_BEGIN: link_packages
-target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
-+ target_link_libraries(rnoh_app PUBLIC rnoh_datetime_picker)
-# RNOH_END: link_packages
-```
-
-打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
-
-```diff
-#include "RNOH/PackageProvider.h"
-#include "SamplePackage.h"
-+ #include "DateTimePickerPackage.h"
-
-using namespace rnoh;
-
-std::vector> PackageProvider::getPackages(Package::Context ctx) {
- return {
- std::make_shared(ctx),
-+ std::make_shared(ctx)
- };
-}
-```
-
-### 在 ArkTs 侧引入 DateTimePicker 组件
-
-打开 `entry/src/main/ets/pages/index.ets`,添加:
-
-```diff
-import {
- RNApp,
- ComponentBuilderContext,
- RNAbility,
- AnyJSBundleProvider,
- MetroJSBundleProvider,
- ResourceJSBundleProvider,
-} from 'rnoh'
-import { SampleView, SAMPLE_VIEW_TYPE, PropsDisplayer } from "rnoh-sample-package"
-import { createRNPackages } from '../RNPackagesFactory'
-+ import { RNDateTimePicker, DATETIME_PICKER_VIEW_TYPE } from "rnoh-datetimepicker"
-
-@Builder
-function CustomComponentBuilder(ctx: ComponentBuilderContext) {
- if (ctx.componentName === SAMPLE_VIEW_TYPE) {
- SampleView({
- ctx: ctx.rnohContext,
- tag: ctx.descriptor.tag,
- buildCustomComponent: CustomComponentBuilder
- })
- }
-+ else if (ctx.componentName === DATETIME_PICKER_VIEW_TYPE) {
-+ RNDateTimePicker({
-+ ctx: ctx.rnohContext,
-+ tag: ctx.descriptor.tag,
-+ buildCustomComponent: CustomComponentBuilder
-+ })
-+ }
- ...
-}
-...
-```
-
-### 运行
-
-点击右上角的 `sync` 按钮
-
-或者在终端执行:
-
-```bash
-cd entry
-ohpm install
-```
-
-然后编译、运行即可。
-
-## 兼容性
-
-要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
-
-| `@react-native-oh-library/datetimepicker` Version | Required React Native Version | Required RNOH Version | Required DevEco Studio Version | Required ROM Version |
-| ------------------------------------------------- | ----------------------------- | --------------------- | ------------------------------ | --------------------- |
-| `7.6.2-0.0.2` | `0.72.5` | `0.72.9` | `4.0.3.601` | `OpenHarmony 4.10.11` |
-
-## 属性
-
-| 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
-| ----------- | ------------------------------------------------------------------------- | -------- | -------- | ------------------------ | -------- |
-| mode | Defines the type of the picker | string | 否 | All | yes |
-| style | Sets style directly on picker component. | object | 否 | All | yes |
-| display | Defines the visual display of the picker. The default value is "default". | string | 否 | All | yes |
-| onChange | Date change handler. | function | 否 | All | yes |
-| value | Defines the date or time value used in the component. | Date | 是 | All | yes |
-| is24Hour | Allows changing of the time picker to a 24-hour format. | bool | 否 | Windows and Android only | yes |
-| maximumDate | Defines the maximum date that can be selected | Date | 否 | All | yes |
-| minimumDate | Defines the minimum date that can be selected. | Date | 否 | All | yes |
-| disabled | If true, the user won't be able to interact with the view. | bool | 否 | All | yes |
-
-## 遗留问题
-
-- [ ] 部分接口,未适配
-
-## 其他
-
-## 开源协议
-
-本项目基于 [The MIT License (MIT)](https://github.com/react-native-oh-library/datetimepicker/blob/harmony/LICENSE) ,请自由地享受和参与开源。
--
Gitee
From 430ae00555b0e5b0404326c5a0c6334f6497b46c Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98bug123?= <1518171514@qq.com>
Date: Wed, 6 Dec 2023 10:37:21 +0000
Subject: [PATCH 03/15] =?UTF-8?q?[Issues:=20#I8M3G8]=20=E6=B7=BB=E5=8A=A0?=
=?UTF-8?q?=E6=9C=80=E6=96=B0datetimepicker=E6=96=87=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zh-cn/datetimepicker.md | 251 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 251 insertions(+)
create mode 100644 zh-cn/datetimepicker.md
diff --git a/zh-cn/datetimepicker.md b/zh-cn/datetimepicker.md
new file mode 100644
index 000000000..2e7cbba33
--- /dev/null
+++ b/zh-cn/datetimepicker.md
@@ -0,0 +1,251 @@
+
+
@react-native-community/datetimepicker
+
+
+
+
+
+
+
+
+
+
+## 安装与使用
+
+进入到工程目录并输入以下命令:
+
+```bash
+yarn add @react-native-community/datetimepicker@npm:@react-native-oh-tpl/datetimepicker
+```
+
+或者
+
+```bash
+npm install @react-native-community/datetimepicker@npm:@react-native-oh-tpl/datetimepicker
+```
+
+下面的代码展示了这个库的基本使用场景:
+
+```js
+import DateTimePicker from '@react-native-community/datetimepicker';
+
+export const App = () => {
+ const [date, setDate] = useState(new Date(1598051730000));
+ const [mode, setMode] = useState('date');
+ const [show, setShow] = useState(false);
+
+ const onChange = (event, selectedDate) => {
+ const currentDate = selectedDate;
+ setShow(false);
+ setDate(currentDate);
+ };
+
+ const showMode = (currentMode) => {
+ setShow(true);
+ setMode(currentMode);
+ };
+
+ const showDatepicker = () => {
+ showMode('date');
+ };
+
+ const showTimepicker = () => {
+ showMode('time');
+ };
+
+ return (
+
+
+
+ selected: {date.toLocaleString()}
+ {show && (
+
+ )}
+
+ );
+};
+```
+
+## Link
+
+目前鸿蒙暂不支持 AutoLink,所以 Link 步骤需要手动配置。
+
+首先需要使用 DevEco Studio 打开项目里的鸿蒙工程 `harmony`
+
+### 引入原生端代码
+
+目前有两种方法:
+
+1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
+2. 直接链接源码。
+
+方法一:通过 har 包引入
+打开 `entry/oh-package.json5`,添加以下依赖
+
+```json
+"dependencies": {
+ "rnoh": "file:../rnoh",
+ "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker.har"
+ }
+```
+
+点击右上角的 `sync` 按钮
+
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+方法二:直接链接源码
+打开 `entry/oh-package.json5`,添加以下依赖
+
+```json
+"dependencies": {
+ "rnoh": "file:../rnoh",
+ "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker"
+ }
+```
+
+打开终端,执行:
+
+```bash
+cd entry
+ohpm install --no-link
+```
+
+### 配置 CMakeLists 和引入 datetimepicker
+
+打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
+
+```diff
+project(rnapp)
+cmake_minimum_required(VERSION 3.4.1)
+set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
+set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
+
+add_subdirectory("${RNOH_CPP_DIR}" ./rn)
+
+# RNOH_BEGIN: add_package_subdirectories
+add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
++ add_subdirectory("${OH_MODULE_DIR}/rnoh-datetimepicker/src/main/cpp" ./datetimepicker)
+# RNOH_END: add_package_subdirectories
+
+add_library(rnoh_app SHARED
+ "./PackageProvider.cpp"
+ "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
+)
+
+target_link_libraries(rnoh_app PUBLIC rnoh)
+
+# RNOH_BEGIN: link_packages
+target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
++ target_link_libraries(rnoh_app PUBLIC rnoh_datetime_picker)
+# RNOH_END: link_packages
+```
+
+打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
+
+```diff
+#include "RNOH/PackageProvider.h"
+#include "SamplePackage.h"
++ #include "DateTimePickerPackage.h"
+
+using namespace rnoh;
+
+std::vector> PackageProvider::getPackages(Package::Context ctx) {
+ return {
+ std::make_shared(ctx),
++ std::make_shared(ctx)
+ };
+}
+```
+
+### 在 ArkTs 侧引入 DateTimePicker 组件
+
+打开 `entry/src/main/ets/pages/index.ets`,添加:
+
+```diff
+import {
+ RNApp,
+ ComponentBuilderContext,
+ RNAbility,
+ AnyJSBundleProvider,
+ MetroJSBundleProvider,
+ ResourceJSBundleProvider,
+} from 'rnoh'
+import { SampleView, SAMPLE_VIEW_TYPE, PropsDisplayer } from "rnoh-sample-package"
+import { createRNPackages } from '../RNPackagesFactory'
++ import { RNDateTimePicker, DATETIME_PICKER_VIEW_TYPE } from "rnoh-datetimepicker"
+
+@Builder
+function CustomComponentBuilder(ctx: ComponentBuilderContext) {
+ if (ctx.componentName === SAMPLE_VIEW_TYPE) {
+ SampleView({
+ ctx: ctx.rnohContext,
+ tag: ctx.descriptor.tag,
+ buildCustomComponent: CustomComponentBuilder
+ })
+ }
++ else if (ctx.componentName === DATETIME_PICKER_VIEW_TYPE) {
++ RNDateTimePicker({
++ ctx: ctx.rnohContext,
++ tag: ctx.descriptor.tag,
++ buildCustomComponent: CustomComponentBuilder
++ })
++ }
+ ...
+}
+...
+```
+
+### 运行
+
+点击右上角的 `sync` 按钮
+
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+然后编译、运行即可。
+
+## 兼容性
+
+要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
+
+请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[<@react-native-oh-library/datetimepicker> Releases](https://github.com/react-native-oh-library/datetimepicker/releases/tag/7.6.2-0.0.2)
+
+## 属性
+
+| 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
+| ----------- | ------------------------------------------------------------------------- | -------- | -------- | ------------------------ | -------- |
+| mode | Defines the type of the picker | string | 否 | All | yes |
+| style | Sets style directly on picker component. | object | 否 | All | yes |
+| display | Defines the visual display of the picker. The default value is "default". | string | 否 | All | yes |
+| onChange | Date change handler. | function | 否 | All | yes |
+| value | Defines the date or time value used in the component. | Date | 是 | All | yes |
+| is24Hour | Allows changing of the time picker to a 24-hour format. | bool | 否 | Windows and Android only | yes |
+| maximumDate | Defines the maximum date that can be selected | Date | 否 | All | yes |
+| minimumDate | Defines the minimum date that can be selected. | Date | 否 | All | yes |
+| disabled | If true, the user won't be able to interact with the view. | bool | 否 | All | yes |
+
+## 遗留问题
+
+- [ ] 部分接口,未适配
+
+## 其他
+
+## 开源协议
+
+本项目基于 [The MIT License (MIT)](https://github.com/react-native-oh-library/datetimepicker/blob/harmony/LICENSE) ,请自由地享受和参与开源。
--
Gitee
From 4f65ea235b878076409db7402814f62869ee89f7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98bug123?= <1518171514@qq.com>
Date: Wed, 6 Dec 2023 11:12:58 +0000
Subject: [PATCH 04/15] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20zh?=
=?UTF-8?q?-cn/datetimepicker.md?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zh-cn/datetimepicker.md | 251 ----------------------------------------
1 file changed, 251 deletions(-)
delete mode 100644 zh-cn/datetimepicker.md
diff --git a/zh-cn/datetimepicker.md b/zh-cn/datetimepicker.md
deleted file mode 100644
index 2e7cbba33..000000000
--- a/zh-cn/datetimepicker.md
+++ /dev/null
@@ -1,251 +0,0 @@
-
-
@react-native-community/datetimepicker
-
-
-
-
-
-
-
-
-
-
-## 安装与使用
-
-进入到工程目录并输入以下命令:
-
-```bash
-yarn add @react-native-community/datetimepicker@npm:@react-native-oh-tpl/datetimepicker
-```
-
-或者
-
-```bash
-npm install @react-native-community/datetimepicker@npm:@react-native-oh-tpl/datetimepicker
-```
-
-下面的代码展示了这个库的基本使用场景:
-
-```js
-import DateTimePicker from '@react-native-community/datetimepicker';
-
-export const App = () => {
- const [date, setDate] = useState(new Date(1598051730000));
- const [mode, setMode] = useState('date');
- const [show, setShow] = useState(false);
-
- const onChange = (event, selectedDate) => {
- const currentDate = selectedDate;
- setShow(false);
- setDate(currentDate);
- };
-
- const showMode = (currentMode) => {
- setShow(true);
- setMode(currentMode);
- };
-
- const showDatepicker = () => {
- showMode('date');
- };
-
- const showTimepicker = () => {
- showMode('time');
- };
-
- return (
-
-
-
- selected: {date.toLocaleString()}
- {show && (
-
- )}
-
- );
-};
-```
-
-## Link
-
-目前鸿蒙暂不支持 AutoLink,所以 Link 步骤需要手动配置。
-
-首先需要使用 DevEco Studio 打开项目里的鸿蒙工程 `harmony`
-
-### 引入原生端代码
-
-目前有两种方法:
-
-1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
-2. 直接链接源码。
-
-方法一:通过 har 包引入
-打开 `entry/oh-package.json5`,添加以下依赖
-
-```json
-"dependencies": {
- "rnoh": "file:../rnoh",
- "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker.har"
- }
-```
-
-点击右上角的 `sync` 按钮
-
-或者在终端执行:
-
-```bash
-cd entry
-ohpm install
-```
-
-方法二:直接链接源码
-打开 `entry/oh-package.json5`,添加以下依赖
-
-```json
-"dependencies": {
- "rnoh": "file:../rnoh",
- "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker"
- }
-```
-
-打开终端,执行:
-
-```bash
-cd entry
-ohpm install --no-link
-```
-
-### 配置 CMakeLists 和引入 datetimepicker
-
-打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
-
-```diff
-project(rnapp)
-cmake_minimum_required(VERSION 3.4.1)
-set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
-set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
-
-add_subdirectory("${RNOH_CPP_DIR}" ./rn)
-
-# RNOH_BEGIN: add_package_subdirectories
-add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
-+ add_subdirectory("${OH_MODULE_DIR}/rnoh-datetimepicker/src/main/cpp" ./datetimepicker)
-# RNOH_END: add_package_subdirectories
-
-add_library(rnoh_app SHARED
- "./PackageProvider.cpp"
- "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
-)
-
-target_link_libraries(rnoh_app PUBLIC rnoh)
-
-# RNOH_BEGIN: link_packages
-target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
-+ target_link_libraries(rnoh_app PUBLIC rnoh_datetime_picker)
-# RNOH_END: link_packages
-```
-
-打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
-
-```diff
-#include "RNOH/PackageProvider.h"
-#include "SamplePackage.h"
-+ #include "DateTimePickerPackage.h"
-
-using namespace rnoh;
-
-std::vector> PackageProvider::getPackages(Package::Context ctx) {
- return {
- std::make_shared(ctx),
-+ std::make_shared(ctx)
- };
-}
-```
-
-### 在 ArkTs 侧引入 DateTimePicker 组件
-
-打开 `entry/src/main/ets/pages/index.ets`,添加:
-
-```diff
-import {
- RNApp,
- ComponentBuilderContext,
- RNAbility,
- AnyJSBundleProvider,
- MetroJSBundleProvider,
- ResourceJSBundleProvider,
-} from 'rnoh'
-import { SampleView, SAMPLE_VIEW_TYPE, PropsDisplayer } from "rnoh-sample-package"
-import { createRNPackages } from '../RNPackagesFactory'
-+ import { RNDateTimePicker, DATETIME_PICKER_VIEW_TYPE } from "rnoh-datetimepicker"
-
-@Builder
-function CustomComponentBuilder(ctx: ComponentBuilderContext) {
- if (ctx.componentName === SAMPLE_VIEW_TYPE) {
- SampleView({
- ctx: ctx.rnohContext,
- tag: ctx.descriptor.tag,
- buildCustomComponent: CustomComponentBuilder
- })
- }
-+ else if (ctx.componentName === DATETIME_PICKER_VIEW_TYPE) {
-+ RNDateTimePicker({
-+ ctx: ctx.rnohContext,
-+ tag: ctx.descriptor.tag,
-+ buildCustomComponent: CustomComponentBuilder
-+ })
-+ }
- ...
-}
-...
-```
-
-### 运行
-
-点击右上角的 `sync` 按钮
-
-或者在终端执行:
-
-```bash
-cd entry
-ohpm install
-```
-
-然后编译、运行即可。
-
-## 兼容性
-
-要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
-
-请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[<@react-native-oh-library/datetimepicker> Releases](https://github.com/react-native-oh-library/datetimepicker/releases/tag/7.6.2-0.0.2)
-
-## 属性
-
-| 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
-| ----------- | ------------------------------------------------------------------------- | -------- | -------- | ------------------------ | -------- |
-| mode | Defines the type of the picker | string | 否 | All | yes |
-| style | Sets style directly on picker component. | object | 否 | All | yes |
-| display | Defines the visual display of the picker. The default value is "default". | string | 否 | All | yes |
-| onChange | Date change handler. | function | 否 | All | yes |
-| value | Defines the date or time value used in the component. | Date | 是 | All | yes |
-| is24Hour | Allows changing of the time picker to a 24-hour format. | bool | 否 | Windows and Android only | yes |
-| maximumDate | Defines the maximum date that can be selected | Date | 否 | All | yes |
-| minimumDate | Defines the minimum date that can be selected. | Date | 否 | All | yes |
-| disabled | If true, the user won't be able to interact with the view. | bool | 否 | All | yes |
-
-## 遗留问题
-
-- [ ] 部分接口,未适配
-
-## 其他
-
-## 开源协议
-
-本项目基于 [The MIT License (MIT)](https://github.com/react-native-oh-library/datetimepicker/blob/harmony/LICENSE) ,请自由地享受和参与开源。
--
Gitee
From d4ce8b7e90278d52160d90d590c26a6d04ca2b9b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98bug123?= <1518171514@qq.com>
Date: Wed, 6 Dec 2023 11:13:42 +0000
Subject: [PATCH 05/15] =?UTF-8?q?[Issues:=20#I8M3G8]=20=E6=B7=BB=E5=8A=A0d?=
=?UTF-8?q?atetimepicker=E6=96=87=E6=A1=A3=E6=A8=A1=E6=9D=BF=E5=8F=B7?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zh-cn/datetimepicker.md | 253 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 253 insertions(+)
create mode 100644 zh-cn/datetimepicker.md
diff --git a/zh-cn/datetimepicker.md b/zh-cn/datetimepicker.md
new file mode 100644
index 000000000..11015972f
--- /dev/null
+++ b/zh-cn/datetimepicker.md
@@ -0,0 +1,253 @@
+> 模板版本:v0.0.1
+
+
+
@react-native-community/datetimepicker
+
+
+
+
+
+
+
+
+
+
+## 安装与使用
+
+进入到工程目录并输入以下命令:
+
+```bash
+yarn add @react-native-community/datetimepicker@npm:@react-native-oh-tpl/datetimepicker
+```
+
+或者
+
+```bash
+npm install @react-native-community/datetimepicker@npm:@react-native-oh-tpl/datetimepicker
+```
+
+下面的代码展示了这个库的基本使用场景:
+
+```js
+import DateTimePicker from '@react-native-community/datetimepicker';
+
+export const App = () => {
+ const [date, setDate] = useState(new Date(1598051730000));
+ const [mode, setMode] = useState('date');
+ const [show, setShow] = useState(false);
+
+ const onChange = (event, selectedDate) => {
+ const currentDate = selectedDate;
+ setShow(false);
+ setDate(currentDate);
+ };
+
+ const showMode = (currentMode) => {
+ setShow(true);
+ setMode(currentMode);
+ };
+
+ const showDatepicker = () => {
+ showMode('date');
+ };
+
+ const showTimepicker = () => {
+ showMode('time');
+ };
+
+ return (
+
+
+
+ selected: {date.toLocaleString()}
+ {show && (
+
+ )}
+
+ );
+};
+```
+
+## Link
+
+目前鸿蒙暂不支持 AutoLink,所以 Link 步骤需要手动配置。
+
+首先需要使用 DevEco Studio 打开项目里的鸿蒙工程 `harmony`
+
+### 引入原生端代码
+
+目前有两种方法:
+
+1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
+2. 直接链接源码。
+
+方法一:通过 har 包引入
+打开 `entry/oh-package.json5`,添加以下依赖
+
+```json
+"dependencies": {
+ "rnoh": "file:../rnoh",
+ "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker.har"
+ }
+```
+
+点击右上角的 `sync` 按钮
+
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+方法二:直接链接源码
+打开 `entry/oh-package.json5`,添加以下依赖
+
+```json
+"dependencies": {
+ "rnoh": "file:../rnoh",
+ "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker"
+ }
+```
+
+打开终端,执行:
+
+```bash
+cd entry
+ohpm install --no-link
+```
+
+### 配置 CMakeLists 和引入 datetimepicker
+
+打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
+
+```diff
+project(rnapp)
+cmake_minimum_required(VERSION 3.4.1)
+set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
+set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
+
+add_subdirectory("${RNOH_CPP_DIR}" ./rn)
+
+# RNOH_BEGIN: add_package_subdirectories
+add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
++ add_subdirectory("${OH_MODULE_DIR}/rnoh-datetimepicker/src/main/cpp" ./datetimepicker)
+# RNOH_END: add_package_subdirectories
+
+add_library(rnoh_app SHARED
+ "./PackageProvider.cpp"
+ "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
+)
+
+target_link_libraries(rnoh_app PUBLIC rnoh)
+
+# RNOH_BEGIN: link_packages
+target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
++ target_link_libraries(rnoh_app PUBLIC rnoh_datetime_picker)
+# RNOH_END: link_packages
+```
+
+打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
+
+```diff
+#include "RNOH/PackageProvider.h"
+#include "SamplePackage.h"
++ #include "DateTimePickerPackage.h"
+
+using namespace rnoh;
+
+std::vector> PackageProvider::getPackages(Package::Context ctx) {
+ return {
+ std::make_shared(ctx),
++ std::make_shared(ctx)
+ };
+}
+```
+
+### 在 ArkTs 侧引入 DateTimePicker 组件
+
+打开 `entry/src/main/ets/pages/index.ets`,添加:
+
+```diff
+import {
+ RNApp,
+ ComponentBuilderContext,
+ RNAbility,
+ AnyJSBundleProvider,
+ MetroJSBundleProvider,
+ ResourceJSBundleProvider,
+} from 'rnoh'
+import { SampleView, SAMPLE_VIEW_TYPE, PropsDisplayer } from "rnoh-sample-package"
+import { createRNPackages } from '../RNPackagesFactory'
++ import { RNDateTimePicker, DATETIME_PICKER_VIEW_TYPE } from "rnoh-datetimepicker"
+
+@Builder
+function CustomComponentBuilder(ctx: ComponentBuilderContext) {
+ if (ctx.componentName === SAMPLE_VIEW_TYPE) {
+ SampleView({
+ ctx: ctx.rnohContext,
+ tag: ctx.descriptor.tag,
+ buildCustomComponent: CustomComponentBuilder
+ })
+ }
++ else if (ctx.componentName === DATETIME_PICKER_VIEW_TYPE) {
++ RNDateTimePicker({
++ ctx: ctx.rnohContext,
++ tag: ctx.descriptor.tag,
++ buildCustomComponent: CustomComponentBuilder
++ })
++ }
+ ...
+}
+...
+```
+
+### 运行
+
+点击右上角的 `sync` 按钮
+
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+然后编译、运行即可。
+
+## 兼容性
+
+要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
+
+请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[<@react-native-oh-library/datetimepicker> Releases](https://github.com/react-native-oh-library/datetimepicker/releases/tag/7.6.2-0.0.2)
+
+## 属性
+
+| 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
+| ----------- | ------------------------------------------------------------------------- | -------- | -------- | ------------------------ | -------- |
+| mode | Defines the type of the picker | string | 否 | All | yes |
+| style | Sets style directly on picker component. | object | 否 | All | yes |
+| display | Defines the visual display of the picker. The default value is "default". | string | 否 | All | yes |
+| onChange | Date change handler. | function | 否 | All | yes |
+| value | Defines the date or time value used in the component. | Date | 是 | All | yes |
+| is24Hour | Allows changing of the time picker to a 24-hour format. | bool | 否 | Windows and Android only | yes |
+| maximumDate | Defines the maximum date that can be selected | Date | 否 | All | yes |
+| minimumDate | Defines the minimum date that can be selected. | Date | 否 | All | yes |
+| disabled | If true, the user won't be able to interact with the view. | bool | 否 | All | yes |
+
+## 遗留问题
+
+- [ ] 部分接口,未适配
+
+## 其他
+
+## 开源协议
+
+本项目基于 [The MIT License (MIT)](https://github.com/react-native-oh-library/datetimepicker/blob/harmony/LICENSE) ,请自由地享受和参与开源。
--
Gitee
From fd9241e4526c2454acedeed5d53dcb27283941a0 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98bug123?= <1518171514@qq.com>
Date: Thu, 7 Dec 2023 08:16:18 +0000
Subject: [PATCH 06/15] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20zh?=
=?UTF-8?q?-cn/datetimepicker.md?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zh-cn/datetimepicker.md | 253 ----------------------------------------
1 file changed, 253 deletions(-)
delete mode 100644 zh-cn/datetimepicker.md
diff --git a/zh-cn/datetimepicker.md b/zh-cn/datetimepicker.md
deleted file mode 100644
index 11015972f..000000000
--- a/zh-cn/datetimepicker.md
+++ /dev/null
@@ -1,253 +0,0 @@
-> 模板版本:v0.0.1
-
-
-
@react-native-community/datetimepicker
-
-
-
-
-
-
-
-
-
-
-## 安装与使用
-
-进入到工程目录并输入以下命令:
-
-```bash
-yarn add @react-native-community/datetimepicker@npm:@react-native-oh-tpl/datetimepicker
-```
-
-或者
-
-```bash
-npm install @react-native-community/datetimepicker@npm:@react-native-oh-tpl/datetimepicker
-```
-
-下面的代码展示了这个库的基本使用场景:
-
-```js
-import DateTimePicker from '@react-native-community/datetimepicker';
-
-export const App = () => {
- const [date, setDate] = useState(new Date(1598051730000));
- const [mode, setMode] = useState('date');
- const [show, setShow] = useState(false);
-
- const onChange = (event, selectedDate) => {
- const currentDate = selectedDate;
- setShow(false);
- setDate(currentDate);
- };
-
- const showMode = (currentMode) => {
- setShow(true);
- setMode(currentMode);
- };
-
- const showDatepicker = () => {
- showMode('date');
- };
-
- const showTimepicker = () => {
- showMode('time');
- };
-
- return (
-
-
-
- selected: {date.toLocaleString()}
- {show && (
-
- )}
-
- );
-};
-```
-
-## Link
-
-目前鸿蒙暂不支持 AutoLink,所以 Link 步骤需要手动配置。
-
-首先需要使用 DevEco Studio 打开项目里的鸿蒙工程 `harmony`
-
-### 引入原生端代码
-
-目前有两种方法:
-
-1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
-2. 直接链接源码。
-
-方法一:通过 har 包引入
-打开 `entry/oh-package.json5`,添加以下依赖
-
-```json
-"dependencies": {
- "rnoh": "file:../rnoh",
- "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker.har"
- }
-```
-
-点击右上角的 `sync` 按钮
-
-或者在终端执行:
-
-```bash
-cd entry
-ohpm install
-```
-
-方法二:直接链接源码
-打开 `entry/oh-package.json5`,添加以下依赖
-
-```json
-"dependencies": {
- "rnoh": "file:../rnoh",
- "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker"
- }
-```
-
-打开终端,执行:
-
-```bash
-cd entry
-ohpm install --no-link
-```
-
-### 配置 CMakeLists 和引入 datetimepicker
-
-打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
-
-```diff
-project(rnapp)
-cmake_minimum_required(VERSION 3.4.1)
-set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
-set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
-
-add_subdirectory("${RNOH_CPP_DIR}" ./rn)
-
-# RNOH_BEGIN: add_package_subdirectories
-add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
-+ add_subdirectory("${OH_MODULE_DIR}/rnoh-datetimepicker/src/main/cpp" ./datetimepicker)
-# RNOH_END: add_package_subdirectories
-
-add_library(rnoh_app SHARED
- "./PackageProvider.cpp"
- "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
-)
-
-target_link_libraries(rnoh_app PUBLIC rnoh)
-
-# RNOH_BEGIN: link_packages
-target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
-+ target_link_libraries(rnoh_app PUBLIC rnoh_datetime_picker)
-# RNOH_END: link_packages
-```
-
-打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
-
-```diff
-#include "RNOH/PackageProvider.h"
-#include "SamplePackage.h"
-+ #include "DateTimePickerPackage.h"
-
-using namespace rnoh;
-
-std::vector> PackageProvider::getPackages(Package::Context ctx) {
- return {
- std::make_shared(ctx),
-+ std::make_shared(ctx)
- };
-}
-```
-
-### 在 ArkTs 侧引入 DateTimePicker 组件
-
-打开 `entry/src/main/ets/pages/index.ets`,添加:
-
-```diff
-import {
- RNApp,
- ComponentBuilderContext,
- RNAbility,
- AnyJSBundleProvider,
- MetroJSBundleProvider,
- ResourceJSBundleProvider,
-} from 'rnoh'
-import { SampleView, SAMPLE_VIEW_TYPE, PropsDisplayer } from "rnoh-sample-package"
-import { createRNPackages } from '../RNPackagesFactory'
-+ import { RNDateTimePicker, DATETIME_PICKER_VIEW_TYPE } from "rnoh-datetimepicker"
-
-@Builder
-function CustomComponentBuilder(ctx: ComponentBuilderContext) {
- if (ctx.componentName === SAMPLE_VIEW_TYPE) {
- SampleView({
- ctx: ctx.rnohContext,
- tag: ctx.descriptor.tag,
- buildCustomComponent: CustomComponentBuilder
- })
- }
-+ else if (ctx.componentName === DATETIME_PICKER_VIEW_TYPE) {
-+ RNDateTimePicker({
-+ ctx: ctx.rnohContext,
-+ tag: ctx.descriptor.tag,
-+ buildCustomComponent: CustomComponentBuilder
-+ })
-+ }
- ...
-}
-...
-```
-
-### 运行
-
-点击右上角的 `sync` 按钮
-
-或者在终端执行:
-
-```bash
-cd entry
-ohpm install
-```
-
-然后编译、运行即可。
-
-## 兼容性
-
-要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
-
-请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[<@react-native-oh-library/datetimepicker> Releases](https://github.com/react-native-oh-library/datetimepicker/releases/tag/7.6.2-0.0.2)
-
-## 属性
-
-| 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
-| ----------- | ------------------------------------------------------------------------- | -------- | -------- | ------------------------ | -------- |
-| mode | Defines the type of the picker | string | 否 | All | yes |
-| style | Sets style directly on picker component. | object | 否 | All | yes |
-| display | Defines the visual display of the picker. The default value is "default". | string | 否 | All | yes |
-| onChange | Date change handler. | function | 否 | All | yes |
-| value | Defines the date or time value used in the component. | Date | 是 | All | yes |
-| is24Hour | Allows changing of the time picker to a 24-hour format. | bool | 否 | Windows and Android only | yes |
-| maximumDate | Defines the maximum date that can be selected | Date | 否 | All | yes |
-| minimumDate | Defines the minimum date that can be selected. | Date | 否 | All | yes |
-| disabled | If true, the user won't be able to interact with the view. | bool | 否 | All | yes |
-
-## 遗留问题
-
-- [ ] 部分接口,未适配
-
-## 其他
-
-## 开源协议
-
-本项目基于 [The MIT License (MIT)](https://github.com/react-native-oh-library/datetimepicker/blob/harmony/LICENSE) ,请自由地享受和参与开源。
--
Gitee
From 76f24770f924d338b098f4e5d2276ccd0cbbffed Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98bug123?= <1518171514@qq.com>
Date: Thu, 7 Dec 2023 08:16:58 +0000
Subject: [PATCH 07/15] =?UTF-8?q?[Issues:=20#I8M3G8]=20=E4=BF=AE=E6=94=B9d?=
=?UTF-8?q?atetimepicker=E6=96=87=E6=A1=A3?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zh-cn/datetimepicker.md | 261 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 261 insertions(+)
create mode 100644 zh-cn/datetimepicker.md
diff --git a/zh-cn/datetimepicker.md b/zh-cn/datetimepicker.md
new file mode 100644
index 000000000..1e9c82d2f
--- /dev/null
+++ b/zh-cn/datetimepicker.md
@@ -0,0 +1,261 @@
+> 模板版本:v0.0.1
+
+
+
@react-native-community/datetimepicker
+
+
+
+
+
+
+
+
+
+
+## 安装与使用
+
+进入到工程目录并输入以下命令:
+
+
+
+**正在 npm 发布中,当前请先从仓库[Release](https://github.com/react-native-oh-library/datetimepicker/releases)中获取库 tgz,通过使用本地依赖来安装本库。**
+
+#### **yarn**
+
+```bash
+yarn add xxx
+```
+
+#### **npm**
+
+```bash
+npm install xxx
+```
+
+
+
+下面的代码展示了这个库的基本使用场景:
+
+```js
+import DateTimePicker from '@react-native-community/datetimepicker';
+
+export const App = () => {
+ const [date, setDate] = useState(new Date(1598051730000));
+ const [mode, setMode] = useState('date');
+ const [show, setShow] = useState(false);
+
+ const onChange = (event, selectedDate) => {
+ const currentDate = selectedDate;
+ setShow(false);
+ setDate(currentDate);
+ };
+
+ const showMode = (currentMode) => {
+ setShow(true);
+ setMode(currentMode);
+ };
+
+ const showDatepicker = () => {
+ showMode('date');
+ };
+
+ const showTimepicker = () => {
+ showMode('time');
+ };
+
+ return (
+
+
+
+ selected: {date.toLocaleString()}
+ {show && (
+
+ )}
+
+ );
+};
+```
+
+## Link
+
+目前鸿蒙暂不支持 AutoLink,所以 Link 步骤需要手动配置。
+
+首先需要使用 DevEco Studio 打开项目里的鸿蒙工程 `harmony`
+
+### 引入原生端代码
+
+目前有两种方法:
+
+1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
+2. 直接链接源码。
+
+方法一:通过 har 包引入
+打开 `entry/oh-package.json5`,添加以下依赖
+
+```json
+"dependencies": {
+ "rnoh": "file:../rnoh",
+ "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker.har"
+ }
+```
+
+点击右上角的 `sync` 按钮
+
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+方法二:直接链接源码
+打开 `entry/oh-package.json5`,添加以下依赖
+
+```json
+"dependencies": {
+ "rnoh": "file:../rnoh",
+ "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker"
+ }
+```
+
+打开终端,执行:
+
+```bash
+cd entry
+ohpm install --no-link
+```
+
+### 配置 CMakeLists 和引入 datetimepicker
+
+打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
+
+```diff
+project(rnapp)
+cmake_minimum_required(VERSION 3.4.1)
+set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
+set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
+
+add_subdirectory("${RNOH_CPP_DIR}" ./rn)
+
+# RNOH_BEGIN: add_package_subdirectories
+add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
++ add_subdirectory("${OH_MODULE_DIR}/rnoh-datetimepicker/src/main/cpp" ./datetimepicker)
+# RNOH_END: add_package_subdirectories
+
+add_library(rnoh_app SHARED
+ "./PackageProvider.cpp"
+ "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
+)
+
+target_link_libraries(rnoh_app PUBLIC rnoh)
+
+# RNOH_BEGIN: link_packages
+target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
++ target_link_libraries(rnoh_app PUBLIC rnoh_datetime_picker)
+# RNOH_END: link_packages
+```
+
+打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
+
+```diff
+#include "RNOH/PackageProvider.h"
+#include "SamplePackage.h"
++ #include "DateTimePickerPackage.h"
+
+using namespace rnoh;
+
+std::vector> PackageProvider::getPackages(Package::Context ctx) {
+ return {
+ std::make_shared(ctx),
++ std::make_shared(ctx)
+ };
+}
+```
+
+### 在 ArkTs 侧引入 DateTimePicker 组件
+
+打开 `entry/src/main/ets/pages/index.ets`,添加:
+
+```diff
+import {
+ RNApp,
+ ComponentBuilderContext,
+ RNAbility,
+ AnyJSBundleProvider,
+ MetroJSBundleProvider,
+ ResourceJSBundleProvider,
+} from 'rnoh'
+import { SampleView, SAMPLE_VIEW_TYPE, PropsDisplayer } from "rnoh-sample-package"
+import { createRNPackages } from '../RNPackagesFactory'
++ import { RNDateTimePicker, DATETIME_PICKER_VIEW_TYPE } from "rnoh-datetimepicker"
+
+@Builder
+function CustomComponentBuilder(ctx: ComponentBuilderContext) {
+ if (ctx.componentName === SAMPLE_VIEW_TYPE) {
+ SampleView({
+ ctx: ctx.rnohContext,
+ tag: ctx.descriptor.tag,
+ buildCustomComponent: CustomComponentBuilder
+ })
+ }
++ else if (ctx.componentName === DATETIME_PICKER_VIEW_TYPE) {
++ RNDateTimePicker({
++ ctx: ctx.rnohContext,
++ tag: ctx.descriptor.tag,
++ buildCustomComponent: CustomComponentBuilder
++ })
++ }
+ ...
+}
+...
+```
+
+### 运行
+
+点击右上角的 `sync` 按钮
+
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+然后编译、运行即可。
+
+## 兼容性
+
+要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
+
+请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[<@react-native-oh-library/datetimepicker> Releases](https://github.com/react-native-oh-library/datetimepicker/releases/tag/7.6.2-0.0.2)
+
+## 属性
+
+| 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
+| ----------- | ------------------------------------------------------------------------- | -------- | -------- | ------------------------ | --------------------------- |
+| mode | Defines the type of the picker | string | 否 | All | yes (仅支持 date/time 模式) |
+| style | Sets style directly on picker component. | object | 否 | IOS only | yes |
+| display | Defines the visual display of the picker. The default value is "default". | string | 否 | All | yes |
+| onChange | Date change handler. | function | 否 | All | yes (仅支持 type 为 set) |
+| value | Defines the date or time value used in the component. | Date | 是 | All | yes |
+| is24Hour | Allows changing of the time picker to a 24-hour format. | bool | 否 | Windows and Android only | yes |
+| maximumDate | Defines the maximum date that can be selected | Date | 否 | All | yes |
+| minimumDate | Defines the minimum date that can be selected. | Date | 否 | All | yes |
+| disabled | If true, the user won't be able to interact with the view. | bool | 否 | IOS only | yes |
+
+## 遗留问题
+
+- [ ] 部分接口,未适配
+
+## 其他
+
+## 开源协议
+
+本项目基于 [The MIT License (MIT)](https://github.com/react-native-oh-library/datetimepicker/blob/harmony/LICENSE) ,请自由地享受和参与开源。
--
Gitee
From b105f7155aebe47e7380f2dbfc79f80d3cf9f0ec Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98bug123?= <1518171514@qq.com>
Date: Thu, 7 Dec 2023 08:26:09 +0000
Subject: [PATCH 08/15] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20zh?=
=?UTF-8?q?-cn/datetimepicker.md?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zh-cn/datetimepicker.md | 261 ----------------------------------------
1 file changed, 261 deletions(-)
delete mode 100644 zh-cn/datetimepicker.md
diff --git a/zh-cn/datetimepicker.md b/zh-cn/datetimepicker.md
deleted file mode 100644
index 1e9c82d2f..000000000
--- a/zh-cn/datetimepicker.md
+++ /dev/null
@@ -1,261 +0,0 @@
-> 模板版本:v0.0.1
-
-
-
@react-native-community/datetimepicker
-
-
-
-
-
-
-
-
-
-
-## 安装与使用
-
-进入到工程目录并输入以下命令:
-
-
-
-**正在 npm 发布中,当前请先从仓库[Release](https://github.com/react-native-oh-library/datetimepicker/releases)中获取库 tgz,通过使用本地依赖来安装本库。**
-
-#### **yarn**
-
-```bash
-yarn add xxx
-```
-
-#### **npm**
-
-```bash
-npm install xxx
-```
-
-
-
-下面的代码展示了这个库的基本使用场景:
-
-```js
-import DateTimePicker from '@react-native-community/datetimepicker';
-
-export const App = () => {
- const [date, setDate] = useState(new Date(1598051730000));
- const [mode, setMode] = useState('date');
- const [show, setShow] = useState(false);
-
- const onChange = (event, selectedDate) => {
- const currentDate = selectedDate;
- setShow(false);
- setDate(currentDate);
- };
-
- const showMode = (currentMode) => {
- setShow(true);
- setMode(currentMode);
- };
-
- const showDatepicker = () => {
- showMode('date');
- };
-
- const showTimepicker = () => {
- showMode('time');
- };
-
- return (
-
-
-
- selected: {date.toLocaleString()}
- {show && (
-
- )}
-
- );
-};
-```
-
-## Link
-
-目前鸿蒙暂不支持 AutoLink,所以 Link 步骤需要手动配置。
-
-首先需要使用 DevEco Studio 打开项目里的鸿蒙工程 `harmony`
-
-### 引入原生端代码
-
-目前有两种方法:
-
-1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
-2. 直接链接源码。
-
-方法一:通过 har 包引入
-打开 `entry/oh-package.json5`,添加以下依赖
-
-```json
-"dependencies": {
- "rnoh": "file:../rnoh",
- "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker.har"
- }
-```
-
-点击右上角的 `sync` 按钮
-
-或者在终端执行:
-
-```bash
-cd entry
-ohpm install
-```
-
-方法二:直接链接源码
-打开 `entry/oh-package.json5`,添加以下依赖
-
-```json
-"dependencies": {
- "rnoh": "file:../rnoh",
- "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker"
- }
-```
-
-打开终端,执行:
-
-```bash
-cd entry
-ohpm install --no-link
-```
-
-### 配置 CMakeLists 和引入 datetimepicker
-
-打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
-
-```diff
-project(rnapp)
-cmake_minimum_required(VERSION 3.4.1)
-set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
-set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
-
-add_subdirectory("${RNOH_CPP_DIR}" ./rn)
-
-# RNOH_BEGIN: add_package_subdirectories
-add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
-+ add_subdirectory("${OH_MODULE_DIR}/rnoh-datetimepicker/src/main/cpp" ./datetimepicker)
-# RNOH_END: add_package_subdirectories
-
-add_library(rnoh_app SHARED
- "./PackageProvider.cpp"
- "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
-)
-
-target_link_libraries(rnoh_app PUBLIC rnoh)
-
-# RNOH_BEGIN: link_packages
-target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
-+ target_link_libraries(rnoh_app PUBLIC rnoh_datetime_picker)
-# RNOH_END: link_packages
-```
-
-打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
-
-```diff
-#include "RNOH/PackageProvider.h"
-#include "SamplePackage.h"
-+ #include "DateTimePickerPackage.h"
-
-using namespace rnoh;
-
-std::vector> PackageProvider::getPackages(Package::Context ctx) {
- return {
- std::make_shared(ctx),
-+ std::make_shared(ctx)
- };
-}
-```
-
-### 在 ArkTs 侧引入 DateTimePicker 组件
-
-打开 `entry/src/main/ets/pages/index.ets`,添加:
-
-```diff
-import {
- RNApp,
- ComponentBuilderContext,
- RNAbility,
- AnyJSBundleProvider,
- MetroJSBundleProvider,
- ResourceJSBundleProvider,
-} from 'rnoh'
-import { SampleView, SAMPLE_VIEW_TYPE, PropsDisplayer } from "rnoh-sample-package"
-import { createRNPackages } from '../RNPackagesFactory'
-+ import { RNDateTimePicker, DATETIME_PICKER_VIEW_TYPE } from "rnoh-datetimepicker"
-
-@Builder
-function CustomComponentBuilder(ctx: ComponentBuilderContext) {
- if (ctx.componentName === SAMPLE_VIEW_TYPE) {
- SampleView({
- ctx: ctx.rnohContext,
- tag: ctx.descriptor.tag,
- buildCustomComponent: CustomComponentBuilder
- })
- }
-+ else if (ctx.componentName === DATETIME_PICKER_VIEW_TYPE) {
-+ RNDateTimePicker({
-+ ctx: ctx.rnohContext,
-+ tag: ctx.descriptor.tag,
-+ buildCustomComponent: CustomComponentBuilder
-+ })
-+ }
- ...
-}
-...
-```
-
-### 运行
-
-点击右上角的 `sync` 按钮
-
-或者在终端执行:
-
-```bash
-cd entry
-ohpm install
-```
-
-然后编译、运行即可。
-
-## 兼容性
-
-要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
-
-请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[<@react-native-oh-library/datetimepicker> Releases](https://github.com/react-native-oh-library/datetimepicker/releases/tag/7.6.2-0.0.2)
-
-## 属性
-
-| 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
-| ----------- | ------------------------------------------------------------------------- | -------- | -------- | ------------------------ | --------------------------- |
-| mode | Defines the type of the picker | string | 否 | All | yes (仅支持 date/time 模式) |
-| style | Sets style directly on picker component. | object | 否 | IOS only | yes |
-| display | Defines the visual display of the picker. The default value is "default". | string | 否 | All | yes |
-| onChange | Date change handler. | function | 否 | All | yes (仅支持 type 为 set) |
-| value | Defines the date or time value used in the component. | Date | 是 | All | yes |
-| is24Hour | Allows changing of the time picker to a 24-hour format. | bool | 否 | Windows and Android only | yes |
-| maximumDate | Defines the maximum date that can be selected | Date | 否 | All | yes |
-| minimumDate | Defines the minimum date that can be selected. | Date | 否 | All | yes |
-| disabled | If true, the user won't be able to interact with the view. | bool | 否 | IOS only | yes |
-
-## 遗留问题
-
-- [ ] 部分接口,未适配
-
-## 其他
-
-## 开源协议
-
-本项目基于 [The MIT License (MIT)](https://github.com/react-native-oh-library/datetimepicker/blob/harmony/LICENSE) ,请自由地享受和参与开源。
--
Gitee
From 1a21e69a8cedbdf2a1dca637d23b3fa6dbd97a1b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98bug123?= <1518171514@qq.com>
Date: Thu, 7 Dec 2023 08:26:43 +0000
Subject: [PATCH 09/15] =?UTF-8?q?[Issues:=20#I8M3G8]=20=E6=B7=BB=E5=8A=A0d?=
=?UTF-8?q?atetimepicker=E6=96=87=E6=A1=A3=E6=94=AF=E6=8C=81=E5=B1=9E?=
=?UTF-8?q?=E6=80=A7=E6=8F=8F=E8=BF=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zh-cn/datetimepicker.md | 261 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 261 insertions(+)
create mode 100644 zh-cn/datetimepicker.md
diff --git a/zh-cn/datetimepicker.md b/zh-cn/datetimepicker.md
new file mode 100644
index 000000000..14f820149
--- /dev/null
+++ b/zh-cn/datetimepicker.md
@@ -0,0 +1,261 @@
+> 模板版本:v0.0.1
+
+
+
@react-native-community/datetimepicker
+
+
+
+
+
+
+
+
+
+
+## 安装与使用
+
+进入到工程目录并输入以下命令:
+
+
+
+**正在 npm 发布中,当前请先从仓库[Release](https://github.com/react-native-oh-library/datetimepicker/releases)中获取库 tgz,通过使用本地依赖来安装本库。**
+
+#### **yarn**
+
+```bash
+yarn add xxx
+```
+
+#### **npm**
+
+```bash
+npm install xxx
+```
+
+
+
+下面的代码展示了这个库的基本使用场景:
+
+```js
+import DateTimePicker from '@react-native-community/datetimepicker';
+
+export const App = () => {
+ const [date, setDate] = useState(new Date(1598051730000));
+ const [mode, setMode] = useState('date');
+ const [show, setShow] = useState(false);
+
+ const onChange = (event, selectedDate) => {
+ const currentDate = selectedDate;
+ setShow(false);
+ setDate(currentDate);
+ };
+
+ const showMode = (currentMode) => {
+ setShow(true);
+ setMode(currentMode);
+ };
+
+ const showDatepicker = () => {
+ showMode('date');
+ };
+
+ const showTimepicker = () => {
+ showMode('time');
+ };
+
+ return (
+
+
+
+ selected: {date.toLocaleString()}
+ {show && (
+
+ )}
+
+ );
+};
+```
+
+## Link
+
+目前鸿蒙暂不支持 AutoLink,所以 Link 步骤需要手动配置。
+
+首先需要使用 DevEco Studio 打开项目里的鸿蒙工程 `harmony`
+
+### 引入原生端代码
+
+目前有两种方法:
+
+1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
+2. 直接链接源码。
+
+方法一:通过 har 包引入
+打开 `entry/oh-package.json5`,添加以下依赖
+
+```json
+"dependencies": {
+ "rnoh": "file:../rnoh",
+ "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker.har"
+ }
+```
+
+点击右上角的 `sync` 按钮
+
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+方法二:直接链接源码
+打开 `entry/oh-package.json5`,添加以下依赖
+
+```json
+"dependencies": {
+ "rnoh": "file:../rnoh",
+ "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker"
+ }
+```
+
+打开终端,执行:
+
+```bash
+cd entry
+ohpm install --no-link
+```
+
+### 配置 CMakeLists 和引入 datetimepicker
+
+打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
+
+```diff
+project(rnapp)
+cmake_minimum_required(VERSION 3.4.1)
+set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
+set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
+
+add_subdirectory("${RNOH_CPP_DIR}" ./rn)
+
+# RNOH_BEGIN: add_package_subdirectories
+add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
++ add_subdirectory("${OH_MODULE_DIR}/rnoh-datetimepicker/src/main/cpp" ./datetimepicker)
+# RNOH_END: add_package_subdirectories
+
+add_library(rnoh_app SHARED
+ "./PackageProvider.cpp"
+ "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
+)
+
+target_link_libraries(rnoh_app PUBLIC rnoh)
+
+# RNOH_BEGIN: link_packages
+target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
++ target_link_libraries(rnoh_app PUBLIC rnoh_datetime_picker)
+# RNOH_END: link_packages
+```
+
+打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
+
+```diff
+#include "RNOH/PackageProvider.h"
+#include "SamplePackage.h"
++ #include "DateTimePickerPackage.h"
+
+using namespace rnoh;
+
+std::vector> PackageProvider::getPackages(Package::Context ctx) {
+ return {
+ std::make_shared(ctx),
++ std::make_shared(ctx)
+ };
+}
+```
+
+### 在 ArkTs 侧引入 DateTimePicker 组件
+
+打开 `entry/src/main/ets/pages/index.ets`,添加:
+
+```diff
+import {
+ RNApp,
+ ComponentBuilderContext,
+ RNAbility,
+ AnyJSBundleProvider,
+ MetroJSBundleProvider,
+ ResourceJSBundleProvider,
+} from 'rnoh'
+import { SampleView, SAMPLE_VIEW_TYPE, PropsDisplayer } from "rnoh-sample-package"
+import { createRNPackages } from '../RNPackagesFactory'
++ import { RNDateTimePicker, DATETIME_PICKER_VIEW_TYPE } from "rnoh-datetimepicker"
+
+@Builder
+function CustomComponentBuilder(ctx: ComponentBuilderContext) {
+ if (ctx.componentName === SAMPLE_VIEW_TYPE) {
+ SampleView({
+ ctx: ctx.rnohContext,
+ tag: ctx.descriptor.tag,
+ buildCustomComponent: CustomComponentBuilder
+ })
+ }
++ else if (ctx.componentName === DATETIME_PICKER_VIEW_TYPE) {
++ RNDateTimePicker({
++ ctx: ctx.rnohContext,
++ tag: ctx.descriptor.tag,
++ buildCustomComponent: CustomComponentBuilder
++ })
++ }
+ ...
+}
+...
+```
+
+### 运行
+
+点击右上角的 `sync` 按钮
+
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+然后编译、运行即可。
+
+## 兼容性
+
+要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
+
+请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[<@react-native-oh-library/datetimepicker> Releases](https://github.com/react-native-oh-library/datetimepicker/releases/tag/7.6.2-0.0.2)
+
+## 属性
+
+| 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
+| ----------- | ------------------------------------------------------------------------- | -------- | -------- | ------------------------ | --------------------------------------------------- |
+| mode | Defines the type of the picker | string | 否 | All | yes (仅支持 date/time 模式) |
+| style | Sets style directly on picker component. | object | 否 | IOS only | yes |
+| display | Defines the visual display of the picker. The default value is "default". | string | 否 | All | yes (支持"default","spinner","compact","inline") |
+| onChange | Date change handler. | function | 否 | All | yes (仅支持 type 为 set) |
+| value | Defines the date or time value used in the component. | Date | 是 | All | yes |
+| is24Hour | Allows changing of the time picker to a 24-hour format. | bool | 否 | Windows and Android only | yes |
+| maximumDate | Defines the maximum date that can be selected | Date | 否 | All | yes |
+| minimumDate | Defines the minimum date that can be selected. | Date | 否 | All | yes |
+| disabled | If true, the user won't be able to interact with the view. | bool | 否 | IOS only | yes |
+
+## 遗留问题
+
+- [ ] 部分接口,未适配
+
+## 其他
+
+## 开源协议
+
+本项目基于 [The MIT License (MIT)](https://github.com/react-native-oh-library/datetimepicker/blob/harmony/LICENSE) ,请自由地享受和参与开源。
--
Gitee
From 308d92ca30b6d3e6dfcd8d78c231a73035e7d294 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98bug123?= <1518171514@qq.com>
Date: Thu, 7 Dec 2023 11:23:39 +0000
Subject: [PATCH 10/15] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20zh?=
=?UTF-8?q?-cn/datetimepicker.md?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zh-cn/datetimepicker.md | 261 ----------------------------------------
1 file changed, 261 deletions(-)
delete mode 100644 zh-cn/datetimepicker.md
diff --git a/zh-cn/datetimepicker.md b/zh-cn/datetimepicker.md
deleted file mode 100644
index 14f820149..000000000
--- a/zh-cn/datetimepicker.md
+++ /dev/null
@@ -1,261 +0,0 @@
-> 模板版本:v0.0.1
-
-
-
@react-native-community/datetimepicker
-
-
-
-
-
-
-
-
-
-
-## 安装与使用
-
-进入到工程目录并输入以下命令:
-
-
-
-**正在 npm 发布中,当前请先从仓库[Release](https://github.com/react-native-oh-library/datetimepicker/releases)中获取库 tgz,通过使用本地依赖来安装本库。**
-
-#### **yarn**
-
-```bash
-yarn add xxx
-```
-
-#### **npm**
-
-```bash
-npm install xxx
-```
-
-
-
-下面的代码展示了这个库的基本使用场景:
-
-```js
-import DateTimePicker from '@react-native-community/datetimepicker';
-
-export const App = () => {
- const [date, setDate] = useState(new Date(1598051730000));
- const [mode, setMode] = useState('date');
- const [show, setShow] = useState(false);
-
- const onChange = (event, selectedDate) => {
- const currentDate = selectedDate;
- setShow(false);
- setDate(currentDate);
- };
-
- const showMode = (currentMode) => {
- setShow(true);
- setMode(currentMode);
- };
-
- const showDatepicker = () => {
- showMode('date');
- };
-
- const showTimepicker = () => {
- showMode('time');
- };
-
- return (
-
-
-
- selected: {date.toLocaleString()}
- {show && (
-
- )}
-
- );
-};
-```
-
-## Link
-
-目前鸿蒙暂不支持 AutoLink,所以 Link 步骤需要手动配置。
-
-首先需要使用 DevEco Studio 打开项目里的鸿蒙工程 `harmony`
-
-### 引入原生端代码
-
-目前有两种方法:
-
-1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
-2. 直接链接源码。
-
-方法一:通过 har 包引入
-打开 `entry/oh-package.json5`,添加以下依赖
-
-```json
-"dependencies": {
- "rnoh": "file:../rnoh",
- "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker.har"
- }
-```
-
-点击右上角的 `sync` 按钮
-
-或者在终端执行:
-
-```bash
-cd entry
-ohpm install
-```
-
-方法二:直接链接源码
-打开 `entry/oh-package.json5`,添加以下依赖
-
-```json
-"dependencies": {
- "rnoh": "file:../rnoh",
- "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker"
- }
-```
-
-打开终端,执行:
-
-```bash
-cd entry
-ohpm install --no-link
-```
-
-### 配置 CMakeLists 和引入 datetimepicker
-
-打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
-
-```diff
-project(rnapp)
-cmake_minimum_required(VERSION 3.4.1)
-set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
-set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
-
-add_subdirectory("${RNOH_CPP_DIR}" ./rn)
-
-# RNOH_BEGIN: add_package_subdirectories
-add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
-+ add_subdirectory("${OH_MODULE_DIR}/rnoh-datetimepicker/src/main/cpp" ./datetimepicker)
-# RNOH_END: add_package_subdirectories
-
-add_library(rnoh_app SHARED
- "./PackageProvider.cpp"
- "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
-)
-
-target_link_libraries(rnoh_app PUBLIC rnoh)
-
-# RNOH_BEGIN: link_packages
-target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
-+ target_link_libraries(rnoh_app PUBLIC rnoh_datetime_picker)
-# RNOH_END: link_packages
-```
-
-打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
-
-```diff
-#include "RNOH/PackageProvider.h"
-#include "SamplePackage.h"
-+ #include "DateTimePickerPackage.h"
-
-using namespace rnoh;
-
-std::vector> PackageProvider::getPackages(Package::Context ctx) {
- return {
- std::make_shared(ctx),
-+ std::make_shared(ctx)
- };
-}
-```
-
-### 在 ArkTs 侧引入 DateTimePicker 组件
-
-打开 `entry/src/main/ets/pages/index.ets`,添加:
-
-```diff
-import {
- RNApp,
- ComponentBuilderContext,
- RNAbility,
- AnyJSBundleProvider,
- MetroJSBundleProvider,
- ResourceJSBundleProvider,
-} from 'rnoh'
-import { SampleView, SAMPLE_VIEW_TYPE, PropsDisplayer } from "rnoh-sample-package"
-import { createRNPackages } from '../RNPackagesFactory'
-+ import { RNDateTimePicker, DATETIME_PICKER_VIEW_TYPE } from "rnoh-datetimepicker"
-
-@Builder
-function CustomComponentBuilder(ctx: ComponentBuilderContext) {
- if (ctx.componentName === SAMPLE_VIEW_TYPE) {
- SampleView({
- ctx: ctx.rnohContext,
- tag: ctx.descriptor.tag,
- buildCustomComponent: CustomComponentBuilder
- })
- }
-+ else if (ctx.componentName === DATETIME_PICKER_VIEW_TYPE) {
-+ RNDateTimePicker({
-+ ctx: ctx.rnohContext,
-+ tag: ctx.descriptor.tag,
-+ buildCustomComponent: CustomComponentBuilder
-+ })
-+ }
- ...
-}
-...
-```
-
-### 运行
-
-点击右上角的 `sync` 按钮
-
-或者在终端执行:
-
-```bash
-cd entry
-ohpm install
-```
-
-然后编译、运行即可。
-
-## 兼容性
-
-要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
-
-请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[<@react-native-oh-library/datetimepicker> Releases](https://github.com/react-native-oh-library/datetimepicker/releases/tag/7.6.2-0.0.2)
-
-## 属性
-
-| 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
-| ----------- | ------------------------------------------------------------------------- | -------- | -------- | ------------------------ | --------------------------------------------------- |
-| mode | Defines the type of the picker | string | 否 | All | yes (仅支持 date/time 模式) |
-| style | Sets style directly on picker component. | object | 否 | IOS only | yes |
-| display | Defines the visual display of the picker. The default value is "default". | string | 否 | All | yes (支持"default","spinner","compact","inline") |
-| onChange | Date change handler. | function | 否 | All | yes (仅支持 type 为 set) |
-| value | Defines the date or time value used in the component. | Date | 是 | All | yes |
-| is24Hour | Allows changing of the time picker to a 24-hour format. | bool | 否 | Windows and Android only | yes |
-| maximumDate | Defines the maximum date that can be selected | Date | 否 | All | yes |
-| minimumDate | Defines the minimum date that can be selected. | Date | 否 | All | yes |
-| disabled | If true, the user won't be able to interact with the view. | bool | 否 | IOS only | yes |
-
-## 遗留问题
-
-- [ ] 部分接口,未适配
-
-## 其他
-
-## 开源协议
-
-本项目基于 [The MIT License (MIT)](https://github.com/react-native-oh-library/datetimepicker/blob/harmony/LICENSE) ,请自由地享受和参与开源。
--
Gitee
From 22ca58267a1bf96889c21a12f3d4aaa8b3342bb6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98bug123?= <1518171514@qq.com>
Date: Thu, 7 Dec 2023 11:24:05 +0000
Subject: [PATCH 11/15] =?UTF-8?q?[Issues:=20#I8M3G8]=20=E5=AE=8C=E5=96=84d?=
=?UTF-8?q?atetimepicker=E6=96=87=E6=A1=A3=E6=94=AF=E6=8C=81=E5=B1=9E?=
=?UTF-8?q?=E6=80=A7=E6=8F=8F=E8=BF=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zh-cn/datetimepicker.md | 262 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 262 insertions(+)
create mode 100644 zh-cn/datetimepicker.md
diff --git a/zh-cn/datetimepicker.md b/zh-cn/datetimepicker.md
new file mode 100644
index 000000000..521e7ffbf
--- /dev/null
+++ b/zh-cn/datetimepicker.md
@@ -0,0 +1,262 @@
+> 模板版本:v0.0.1
+
+
+
@react-native-community/datetimepicker
+
+
+
+
+
+
+
+
+
+
+## 安装与使用
+
+进入到工程目录并输入以下命令:
+
+
+
+**正在 npm 发布中,当前请先从仓库[Release](https://github.com/react-native-oh-library/datetimepicker/releases)中获取库 tgz,通过使用本地依赖来安装本库。**
+
+#### **yarn**
+
+```bash
+yarn add xxx
+```
+
+#### **npm**
+
+```bash
+npm install xxx
+```
+
+
+
+下面的代码展示了这个库的基本使用场景:
+
+```js
+import DateTimePicker from '@react-native-community/datetimepicker';
+
+export const App = () => {
+ const [date, setDate] = useState(new Date(1598051730000));
+ const [mode, setMode] = useState('date');
+ const [show, setShow] = useState(false);
+
+ const onChange = (event, selectedDate) => {
+ const currentDate = selectedDate;
+ setShow(false);
+ setDate(currentDate);
+ };
+
+ const showMode = (currentMode) => {
+ setShow(true);
+ setMode(currentMode);
+ };
+
+ const showDatepicker = () => {
+ showMode('date');
+ };
+
+ const showTimepicker = () => {
+ showMode('time');
+ };
+
+ return (
+
+
+
+ selected: {date.toLocaleString()}
+ {show && (
+
+ )}
+
+ );
+};
+```
+
+## Link
+
+目前鸿蒙暂不支持 AutoLink,所以 Link 步骤需要手动配置。
+
+首先需要使用 DevEco Studio 打开项目里的鸿蒙工程 `harmony`
+
+### 引入原生端代码
+
+目前有两种方法:
+
+1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
+2. 直接链接源码。
+
+方法一:通过 har 包引入
+打开 `entry/oh-package.json5`,添加以下依赖
+
+```json
+"dependencies": {
+ "rnoh": "file:../rnoh",
+ "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker.har"
+ }
+```
+
+点击右上角的 `sync` 按钮
+
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+方法二:直接链接源码
+打开 `entry/oh-package.json5`,添加以下依赖
+
+```json
+"dependencies": {
+ "rnoh": "file:../rnoh",
+ "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker"
+ }
+```
+
+打开终端,执行:
+
+```bash
+cd entry
+ohpm install --no-link
+```
+
+### 配置 CMakeLists 和引入 datetimepicker
+
+打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
+
+```diff
+project(rnapp)
+cmake_minimum_required(VERSION 3.4.1)
+set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
+set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
+
+add_subdirectory("${RNOH_CPP_DIR}" ./rn)
+
+# RNOH_BEGIN: add_package_subdirectories
+add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
++ add_subdirectory("${OH_MODULE_DIR}/rnoh-datetimepicker/src/main/cpp" ./datetimepicker)
+# RNOH_END: add_package_subdirectories
+
+add_library(rnoh_app SHARED
+ "./PackageProvider.cpp"
+ "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
+)
+
+target_link_libraries(rnoh_app PUBLIC rnoh)
+
+# RNOH_BEGIN: link_packages
+target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
++ target_link_libraries(rnoh_app PUBLIC rnoh_datetime_picker)
+# RNOH_END: link_packages
+```
+
+打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
+
+```diff
+#include "RNOH/PackageProvider.h"
+#include "SamplePackage.h"
++ #include "DateTimePickerPackage.h"
+
+using namespace rnoh;
+
+std::vector> PackageProvider::getPackages(Package::Context ctx) {
+ return {
+ std::make_shared(ctx),
++ std::make_shared(ctx)
+ };
+}
+```
+
+### 在 ArkTs 侧引入 DateTimePicker 组件
+
+打开 `entry/src/main/ets/pages/index.ets`,添加:
+
+```diff
+import {
+ RNApp,
+ ComponentBuilderContext,
+ RNAbility,
+ AnyJSBundleProvider,
+ MetroJSBundleProvider,
+ ResourceJSBundleProvider,
+} from 'rnoh'
+import { SampleView, SAMPLE_VIEW_TYPE, PropsDisplayer } from "rnoh-sample-package"
+import { createRNPackages } from '../RNPackagesFactory'
++ import { RNDateTimePicker, DATETIME_PICKER_VIEW_TYPE } from "rnoh-datetimepicker"
+
+@Builder
+function CustomComponentBuilder(ctx: ComponentBuilderContext) {
+ if (ctx.componentName === SAMPLE_VIEW_TYPE) {
+ SampleView({
+ ctx: ctx.rnohContext,
+ tag: ctx.descriptor.tag,
+ buildCustomComponent: CustomComponentBuilder
+ })
+ }
++ else if (ctx.componentName === DATETIME_PICKER_VIEW_TYPE) {
++ RNDateTimePicker({
++ ctx: ctx.rnohContext,
++ tag: ctx.descriptor.tag,
++ buildCustomComponent: CustomComponentBuilder
++ })
++ }
+ ...
+}
+...
+```
+
+### 运行
+
+点击右上角的 `sync` 按钮
+
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+然后编译、运行即可。
+
+## 兼容性
+
+要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
+
+请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[<@react-native-oh-library/datetimepicker> Releases](https://github.com/react-native-oh-library/datetimepicker/releases/tag/7.6.2-0.0.2)
+
+## 属性
+
+| 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
+| ----------- | ------------------------------------------------------------------------- | -------- | -------- | ------------------------ | ---------------------------------------------------- |
+| mode | Defines the type of the picker | string | 否 | All | yes (仅支持 date/time 模式) |
+| style | Sets style directly on picker component. | object | 否 | IOS only | yes |
+| display | Defines the visual display of the picker. The default value is "default". | string | 否 | All | yes (支持"default","spinner","compact","inline") |
+| onChange | Date change handler. | function | 否 | All | yes (仅支持 type 为 set 类型) |
+| value | Defines the date or time value used in the component. | Date | 是 | All | yes (仅 mode=date 且 display=spinner 时支持动态设置) |
+| is24Hour | Allows changing of the time picker to a 24-hour format. | bool | 否 | Windows and Android only | yes |
+| maximumDate | Defines the maximum date that can be selected | Date | 否 | All | yes (仅支持在 mode=date 且 display=spinner 时设置) |
+| minimumDate | Defines the minimum date that can be selected. | Date | 否 | All | yes (仅支持在 mode=date 且 display=spinner 时设置) |
+| disabled | If true, the user won't be able to interact with the view. | bool | 否 | IOS only | yes |
+| textColor | Allows changing of the textColor of the date picker. | string | 否 | IOS only | yes (仅支持在 mode=date 且 display=compact 时设置) |
+
+## 遗留问题
+
+- [ ] 部分接口,未适配
+
+## 其他
+
+## 开源协议
+
+本项目基于 [The MIT License (MIT)](https://github.com/react-native-oh-library/datetimepicker/blob/harmony/LICENSE) ,请自由地享受和参与开源。
--
Gitee
From ac406f33d933831738354aa5736c687005dc12b7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98bug123?= <1518171514@qq.com>
Date: Thu, 7 Dec 2023 12:02:20 +0000
Subject: [PATCH 12/15] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20zh?=
=?UTF-8?q?-cn/datetimepicker.md?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zh-cn/datetimepicker.md | 262 ----------------------------------------
1 file changed, 262 deletions(-)
delete mode 100644 zh-cn/datetimepicker.md
diff --git a/zh-cn/datetimepicker.md b/zh-cn/datetimepicker.md
deleted file mode 100644
index 521e7ffbf..000000000
--- a/zh-cn/datetimepicker.md
+++ /dev/null
@@ -1,262 +0,0 @@
-> 模板版本:v0.0.1
-
-
-
@react-native-community/datetimepicker
-
-
-
-
-
-
-
-
-
-
-## 安装与使用
-
-进入到工程目录并输入以下命令:
-
-
-
-**正在 npm 发布中,当前请先从仓库[Release](https://github.com/react-native-oh-library/datetimepicker/releases)中获取库 tgz,通过使用本地依赖来安装本库。**
-
-#### **yarn**
-
-```bash
-yarn add xxx
-```
-
-#### **npm**
-
-```bash
-npm install xxx
-```
-
-
-
-下面的代码展示了这个库的基本使用场景:
-
-```js
-import DateTimePicker from '@react-native-community/datetimepicker';
-
-export const App = () => {
- const [date, setDate] = useState(new Date(1598051730000));
- const [mode, setMode] = useState('date');
- const [show, setShow] = useState(false);
-
- const onChange = (event, selectedDate) => {
- const currentDate = selectedDate;
- setShow(false);
- setDate(currentDate);
- };
-
- const showMode = (currentMode) => {
- setShow(true);
- setMode(currentMode);
- };
-
- const showDatepicker = () => {
- showMode('date');
- };
-
- const showTimepicker = () => {
- showMode('time');
- };
-
- return (
-
-
-
- selected: {date.toLocaleString()}
- {show && (
-
- )}
-
- );
-};
-```
-
-## Link
-
-目前鸿蒙暂不支持 AutoLink,所以 Link 步骤需要手动配置。
-
-首先需要使用 DevEco Studio 打开项目里的鸿蒙工程 `harmony`
-
-### 引入原生端代码
-
-目前有两种方法:
-
-1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
-2. 直接链接源码。
-
-方法一:通过 har 包引入
-打开 `entry/oh-package.json5`,添加以下依赖
-
-```json
-"dependencies": {
- "rnoh": "file:../rnoh",
- "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker.har"
- }
-```
-
-点击右上角的 `sync` 按钮
-
-或者在终端执行:
-
-```bash
-cd entry
-ohpm install
-```
-
-方法二:直接链接源码
-打开 `entry/oh-package.json5`,添加以下依赖
-
-```json
-"dependencies": {
- "rnoh": "file:../rnoh",
- "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker"
- }
-```
-
-打开终端,执行:
-
-```bash
-cd entry
-ohpm install --no-link
-```
-
-### 配置 CMakeLists 和引入 datetimepicker
-
-打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
-
-```diff
-project(rnapp)
-cmake_minimum_required(VERSION 3.4.1)
-set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
-set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
-
-add_subdirectory("${RNOH_CPP_DIR}" ./rn)
-
-# RNOH_BEGIN: add_package_subdirectories
-add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
-+ add_subdirectory("${OH_MODULE_DIR}/rnoh-datetimepicker/src/main/cpp" ./datetimepicker)
-# RNOH_END: add_package_subdirectories
-
-add_library(rnoh_app SHARED
- "./PackageProvider.cpp"
- "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
-)
-
-target_link_libraries(rnoh_app PUBLIC rnoh)
-
-# RNOH_BEGIN: link_packages
-target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
-+ target_link_libraries(rnoh_app PUBLIC rnoh_datetime_picker)
-# RNOH_END: link_packages
-```
-
-打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
-
-```diff
-#include "RNOH/PackageProvider.h"
-#include "SamplePackage.h"
-+ #include "DateTimePickerPackage.h"
-
-using namespace rnoh;
-
-std::vector> PackageProvider::getPackages(Package::Context ctx) {
- return {
- std::make_shared(ctx),
-+ std::make_shared(ctx)
- };
-}
-```
-
-### 在 ArkTs 侧引入 DateTimePicker 组件
-
-打开 `entry/src/main/ets/pages/index.ets`,添加:
-
-```diff
-import {
- RNApp,
- ComponentBuilderContext,
- RNAbility,
- AnyJSBundleProvider,
- MetroJSBundleProvider,
- ResourceJSBundleProvider,
-} from 'rnoh'
-import { SampleView, SAMPLE_VIEW_TYPE, PropsDisplayer } from "rnoh-sample-package"
-import { createRNPackages } from '../RNPackagesFactory'
-+ import { RNDateTimePicker, DATETIME_PICKER_VIEW_TYPE } from "rnoh-datetimepicker"
-
-@Builder
-function CustomComponentBuilder(ctx: ComponentBuilderContext) {
- if (ctx.componentName === SAMPLE_VIEW_TYPE) {
- SampleView({
- ctx: ctx.rnohContext,
- tag: ctx.descriptor.tag,
- buildCustomComponent: CustomComponentBuilder
- })
- }
-+ else if (ctx.componentName === DATETIME_PICKER_VIEW_TYPE) {
-+ RNDateTimePicker({
-+ ctx: ctx.rnohContext,
-+ tag: ctx.descriptor.tag,
-+ buildCustomComponent: CustomComponentBuilder
-+ })
-+ }
- ...
-}
-...
-```
-
-### 运行
-
-点击右上角的 `sync` 按钮
-
-或者在终端执行:
-
-```bash
-cd entry
-ohpm install
-```
-
-然后编译、运行即可。
-
-## 兼容性
-
-要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
-
-请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[<@react-native-oh-library/datetimepicker> Releases](https://github.com/react-native-oh-library/datetimepicker/releases/tag/7.6.2-0.0.2)
-
-## 属性
-
-| 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
-| ----------- | ------------------------------------------------------------------------- | -------- | -------- | ------------------------ | ---------------------------------------------------- |
-| mode | Defines the type of the picker | string | 否 | All | yes (仅支持 date/time 模式) |
-| style | Sets style directly on picker component. | object | 否 | IOS only | yes |
-| display | Defines the visual display of the picker. The default value is "default". | string | 否 | All | yes (支持"default","spinner","compact","inline") |
-| onChange | Date change handler. | function | 否 | All | yes (仅支持 type 为 set 类型) |
-| value | Defines the date or time value used in the component. | Date | 是 | All | yes (仅 mode=date 且 display=spinner 时支持动态设置) |
-| is24Hour | Allows changing of the time picker to a 24-hour format. | bool | 否 | Windows and Android only | yes |
-| maximumDate | Defines the maximum date that can be selected | Date | 否 | All | yes (仅支持在 mode=date 且 display=spinner 时设置) |
-| minimumDate | Defines the minimum date that can be selected. | Date | 否 | All | yes (仅支持在 mode=date 且 display=spinner 时设置) |
-| disabled | If true, the user won't be able to interact with the view. | bool | 否 | IOS only | yes |
-| textColor | Allows changing of the textColor of the date picker. | string | 否 | IOS only | yes (仅支持在 mode=date 且 display=compact 时设置) |
-
-## 遗留问题
-
-- [ ] 部分接口,未适配
-
-## 其他
-
-## 开源协议
-
-本项目基于 [The MIT License (MIT)](https://github.com/react-native-oh-library/datetimepicker/blob/harmony/LICENSE) ,请自由地享受和参与开源。
--
Gitee
From 82b64fbe28a679332b3458601b247de945b33ed2 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98bug123?= <1518171514@qq.com>
Date: Thu, 7 Dec 2023 12:04:20 +0000
Subject: [PATCH 13/15] =?UTF-8?q?[Issues:=20#I8M3G8]=20=E4=BF=AE=E6=94=B9d?=
=?UTF-8?q?atetimepicker=E6=96=87=E6=A1=A3ctx.descriptor.type?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zh-cn/datetimepicker.md | 262 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 262 insertions(+)
create mode 100644 zh-cn/datetimepicker.md
diff --git a/zh-cn/datetimepicker.md b/zh-cn/datetimepicker.md
new file mode 100644
index 000000000..787c25067
--- /dev/null
+++ b/zh-cn/datetimepicker.md
@@ -0,0 +1,262 @@
+> 模板版本:v0.0.1
+
+
+
@react-native-community/datetimepicker
+
+
+
+
+
+
+
+
+
+
+## 安装与使用
+
+进入到工程目录并输入以下命令:
+
+
+
+**正在 npm 发布中,当前请先从仓库[Release](https://github.com/react-native-oh-library/datetimepicker/releases)中获取库 tgz,通过使用本地依赖来安装本库。**
+
+#### **yarn**
+
+```bash
+yarn add xxx
+```
+
+#### **npm**
+
+```bash
+npm install xxx
+```
+
+
+
+下面的代码展示了这个库的基本使用场景:
+
+```js
+import DateTimePicker from '@react-native-community/datetimepicker';
+
+export const App = () => {
+ const [date, setDate] = useState(new Date(1598051730000));
+ const [mode, setMode] = useState('date');
+ const [show, setShow] = useState(false);
+
+ const onChange = (event, selectedDate) => {
+ const currentDate = selectedDate;
+ setShow(false);
+ setDate(currentDate);
+ };
+
+ const showMode = (currentMode) => {
+ setShow(true);
+ setMode(currentMode);
+ };
+
+ const showDatepicker = () => {
+ showMode('date');
+ };
+
+ const showTimepicker = () => {
+ showMode('time');
+ };
+
+ return (
+
+
+
+ selected: {date.toLocaleString()}
+ {show && (
+
+ )}
+
+ );
+};
+```
+
+## Link
+
+目前鸿蒙暂不支持 AutoLink,所以 Link 步骤需要手动配置。
+
+首先需要使用 DevEco Studio 打开项目里的鸿蒙工程 `harmony`
+
+### 引入原生端代码
+
+目前有两种方法:
+
+1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
+2. 直接链接源码。
+
+方法一:通过 har 包引入
+打开 `entry/oh-package.json5`,添加以下依赖
+
+```json
+"dependencies": {
+ "rnoh": "file:../rnoh",
+ "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker.har"
+ }
+```
+
+点击右上角的 `sync` 按钮
+
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+方法二:直接链接源码
+打开 `entry/oh-package.json5`,添加以下依赖
+
+```json
+"dependencies": {
+ "rnoh": "file:../rnoh",
+ "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker"
+ }
+```
+
+打开终端,执行:
+
+```bash
+cd entry
+ohpm install --no-link
+```
+
+### 配置 CMakeLists 和引入 datetimepicker
+
+打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
+
+```diff
+project(rnapp)
+cmake_minimum_required(VERSION 3.4.1)
+set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
+set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
+
+add_subdirectory("${RNOH_CPP_DIR}" ./rn)
+
+# RNOH_BEGIN: add_package_subdirectories
+add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
++ add_subdirectory("${OH_MODULE_DIR}/rnoh-datetimepicker/src/main/cpp" ./datetimepicker)
+# RNOH_END: add_package_subdirectories
+
+add_library(rnoh_app SHARED
+ "./PackageProvider.cpp"
+ "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
+)
+
+target_link_libraries(rnoh_app PUBLIC rnoh)
+
+# RNOH_BEGIN: link_packages
+target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
++ target_link_libraries(rnoh_app PUBLIC rnoh_datetime_picker)
+# RNOH_END: link_packages
+```
+
+打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
+
+```diff
+#include "RNOH/PackageProvider.h"
+#include "SamplePackage.h"
++ #include "DateTimePickerPackage.h"
+
+using namespace rnoh;
+
+std::vector> PackageProvider::getPackages(Package::Context ctx) {
+ return {
+ std::make_shared(ctx),
++ std::make_shared(ctx)
+ };
+}
+```
+
+### 在 ArkTs 侧引入 DateTimePicker 组件
+
+打开 `entry/src/main/ets/pages/index.ets`,添加:
+
+```diff
+import {
+ RNApp,
+ ComponentBuilderContext,
+ RNAbility,
+ AnyJSBundleProvider,
+ MetroJSBundleProvider,
+ ResourceJSBundleProvider,
+} from 'rnoh'
+import { SampleView, SAMPLE_VIEW_TYPE, PropsDisplayer } from "rnoh-sample-package"
+import { createRNPackages } from '../RNPackagesFactory'
++ import { RNDateTimePicker, DATETIME_PICKER_VIEW_TYPE } from "rnoh-datetimepicker"
+
+@Builder
+function CustomComponentBuilder(ctx: ComponentBuilderContext) {
+ if (ctx.descriptor.type === SAMPLE_VIEW_TYPE) {
+ SampleView({
+ ctx: ctx.rnohContext,
+ tag: ctx.descriptor.tag,
+ buildCustomComponent: CustomComponentBuilder
+ })
+ }
++ else if (ctx.descriptor.type === DATETIME_PICKER_VIEW_TYPE) {
++ RNDateTimePicker({
++ ctx: ctx.rnohContext,
++ tag: ctx.descriptor.tag,
++ buildCustomComponent: CustomComponentBuilder
++ })
++ }
+ ...
+}
+...
+```
+
+### 运行
+
+点击右上角的 `sync` 按钮
+
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+然后编译、运行即可。
+
+## 兼容性
+
+要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
+
+请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[<@react-native-oh-library/datetimepicker> Releases](https://github.com/react-native-oh-library/datetimepicker/releases/tag/7.6.2-0.0.2)
+
+## 属性
+
+| 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
+| ----------- | ------------------------------------------------------------------------- | -------- | -------- | ------------------------ | ---------------------------------------------------- |
+| mode | Defines the type of the picker | string | 否 | All | yes (仅支持 date/time 模式) |
+| style | Sets style directly on picker component. | object | 否 | IOS only | yes |
+| display | Defines the visual display of the picker. The default value is "default". | string | 否 | All | yes (支持"default","spinner","compact","inline") |
+| onChange | Date change handler. | function | 否 | All | yes (仅支持 type 为 set 类型) |
+| value | Defines the date or time value used in the component. | Date | 是 | All | yes (仅 mode=date 且 display=spinner 时支持动态设置) |
+| is24Hour | Allows changing of the time picker to a 24-hour format. | bool | 否 | Windows and Android only | yes |
+| maximumDate | Defines the maximum date that can be selected | Date | 否 | All | yes (仅支持在 mode=date 且 display=spinner 时设置) |
+| minimumDate | Defines the minimum date that can be selected. | Date | 否 | All | yes (仅支持在 mode=date 且 display=spinner 时设置) |
+| disabled | If true, the user won't be able to interact with the view. | bool | 否 | IOS only | yes |
+| textColor | Allows changing of the textColor of the date picker. | string | 否 | IOS only | yes (仅支持在 mode=date 且 display=compact 时设置) |
+
+## 遗留问题
+
+- [ ] 部分接口,未适配
+
+## 其他
+
+## 开源协议
+
+本项目基于 [The MIT License (MIT)](https://github.com/react-native-oh-library/datetimepicker/blob/harmony/LICENSE) ,请自由地享受和参与开源。
--
Gitee
From e0131592525f46950c039f49f8ccf7fa07955e66 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98bug123?= <1518171514@qq.com>
Date: Fri, 8 Dec 2023 04:22:31 +0000
Subject: [PATCH 14/15] =?UTF-8?q?=E5=88=A0=E9=99=A4=E6=96=87=E4=BB=B6=20zh?=
=?UTF-8?q?-cn/datetimepicker.md?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zh-cn/datetimepicker.md | 262 ----------------------------------------
1 file changed, 262 deletions(-)
delete mode 100644 zh-cn/datetimepicker.md
diff --git a/zh-cn/datetimepicker.md b/zh-cn/datetimepicker.md
deleted file mode 100644
index 787c25067..000000000
--- a/zh-cn/datetimepicker.md
+++ /dev/null
@@ -1,262 +0,0 @@
-> 模板版本:v0.0.1
-
-
-
@react-native-community/datetimepicker
-
-
-
-
-
-
-
-
-
-
-## 安装与使用
-
-进入到工程目录并输入以下命令:
-
-
-
-**正在 npm 发布中,当前请先从仓库[Release](https://github.com/react-native-oh-library/datetimepicker/releases)中获取库 tgz,通过使用本地依赖来安装本库。**
-
-#### **yarn**
-
-```bash
-yarn add xxx
-```
-
-#### **npm**
-
-```bash
-npm install xxx
-```
-
-
-
-下面的代码展示了这个库的基本使用场景:
-
-```js
-import DateTimePicker from '@react-native-community/datetimepicker';
-
-export const App = () => {
- const [date, setDate] = useState(new Date(1598051730000));
- const [mode, setMode] = useState('date');
- const [show, setShow] = useState(false);
-
- const onChange = (event, selectedDate) => {
- const currentDate = selectedDate;
- setShow(false);
- setDate(currentDate);
- };
-
- const showMode = (currentMode) => {
- setShow(true);
- setMode(currentMode);
- };
-
- const showDatepicker = () => {
- showMode('date');
- };
-
- const showTimepicker = () => {
- showMode('time');
- };
-
- return (
-
-
-
- selected: {date.toLocaleString()}
- {show && (
-
- )}
-
- );
-};
-```
-
-## Link
-
-目前鸿蒙暂不支持 AutoLink,所以 Link 步骤需要手动配置。
-
-首先需要使用 DevEco Studio 打开项目里的鸿蒙工程 `harmony`
-
-### 引入原生端代码
-
-目前有两种方法:
-
-1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
-2. 直接链接源码。
-
-方法一:通过 har 包引入
-打开 `entry/oh-package.json5`,添加以下依赖
-
-```json
-"dependencies": {
- "rnoh": "file:../rnoh",
- "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker.har"
- }
-```
-
-点击右上角的 `sync` 按钮
-
-或者在终端执行:
-
-```bash
-cd entry
-ohpm install
-```
-
-方法二:直接链接源码
-打开 `entry/oh-package.json5`,添加以下依赖
-
-```json
-"dependencies": {
- "rnoh": "file:../rnoh",
- "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker"
- }
-```
-
-打开终端,执行:
-
-```bash
-cd entry
-ohpm install --no-link
-```
-
-### 配置 CMakeLists 和引入 datetimepicker
-
-打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
-
-```diff
-project(rnapp)
-cmake_minimum_required(VERSION 3.4.1)
-set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
-set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
-set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
-
-add_subdirectory("${RNOH_CPP_DIR}" ./rn)
-
-# RNOH_BEGIN: add_package_subdirectories
-add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
-+ add_subdirectory("${OH_MODULE_DIR}/rnoh-datetimepicker/src/main/cpp" ./datetimepicker)
-# RNOH_END: add_package_subdirectories
-
-add_library(rnoh_app SHARED
- "./PackageProvider.cpp"
- "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
-)
-
-target_link_libraries(rnoh_app PUBLIC rnoh)
-
-# RNOH_BEGIN: link_packages
-target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
-+ target_link_libraries(rnoh_app PUBLIC rnoh_datetime_picker)
-# RNOH_END: link_packages
-```
-
-打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
-
-```diff
-#include "RNOH/PackageProvider.h"
-#include "SamplePackage.h"
-+ #include "DateTimePickerPackage.h"
-
-using namespace rnoh;
-
-std::vector> PackageProvider::getPackages(Package::Context ctx) {
- return {
- std::make_shared(ctx),
-+ std::make_shared(ctx)
- };
-}
-```
-
-### 在 ArkTs 侧引入 DateTimePicker 组件
-
-打开 `entry/src/main/ets/pages/index.ets`,添加:
-
-```diff
-import {
- RNApp,
- ComponentBuilderContext,
- RNAbility,
- AnyJSBundleProvider,
- MetroJSBundleProvider,
- ResourceJSBundleProvider,
-} from 'rnoh'
-import { SampleView, SAMPLE_VIEW_TYPE, PropsDisplayer } from "rnoh-sample-package"
-import { createRNPackages } from '../RNPackagesFactory'
-+ import { RNDateTimePicker, DATETIME_PICKER_VIEW_TYPE } from "rnoh-datetimepicker"
-
-@Builder
-function CustomComponentBuilder(ctx: ComponentBuilderContext) {
- if (ctx.descriptor.type === SAMPLE_VIEW_TYPE) {
- SampleView({
- ctx: ctx.rnohContext,
- tag: ctx.descriptor.tag,
- buildCustomComponent: CustomComponentBuilder
- })
- }
-+ else if (ctx.descriptor.type === DATETIME_PICKER_VIEW_TYPE) {
-+ RNDateTimePicker({
-+ ctx: ctx.rnohContext,
-+ tag: ctx.descriptor.tag,
-+ buildCustomComponent: CustomComponentBuilder
-+ })
-+ }
- ...
-}
-...
-```
-
-### 运行
-
-点击右上角的 `sync` 按钮
-
-或者在终端执行:
-
-```bash
-cd entry
-ohpm install
-```
-
-然后编译、运行即可。
-
-## 兼容性
-
-要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
-
-请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[<@react-native-oh-library/datetimepicker> Releases](https://github.com/react-native-oh-library/datetimepicker/releases/tag/7.6.2-0.0.2)
-
-## 属性
-
-| 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
-| ----------- | ------------------------------------------------------------------------- | -------- | -------- | ------------------------ | ---------------------------------------------------- |
-| mode | Defines the type of the picker | string | 否 | All | yes (仅支持 date/time 模式) |
-| style | Sets style directly on picker component. | object | 否 | IOS only | yes |
-| display | Defines the visual display of the picker. The default value is "default". | string | 否 | All | yes (支持"default","spinner","compact","inline") |
-| onChange | Date change handler. | function | 否 | All | yes (仅支持 type 为 set 类型) |
-| value | Defines the date or time value used in the component. | Date | 是 | All | yes (仅 mode=date 且 display=spinner 时支持动态设置) |
-| is24Hour | Allows changing of the time picker to a 24-hour format. | bool | 否 | Windows and Android only | yes |
-| maximumDate | Defines the maximum date that can be selected | Date | 否 | All | yes (仅支持在 mode=date 且 display=spinner 时设置) |
-| minimumDate | Defines the minimum date that can be selected. | Date | 否 | All | yes (仅支持在 mode=date 且 display=spinner 时设置) |
-| disabled | If true, the user won't be able to interact with the view. | bool | 否 | IOS only | yes |
-| textColor | Allows changing of the textColor of the date picker. | string | 否 | IOS only | yes (仅支持在 mode=date 且 display=compact 时设置) |
-
-## 遗留问题
-
-- [ ] 部分接口,未适配
-
-## 其他
-
-## 开源协议
-
-本项目基于 [The MIT License (MIT)](https://github.com/react-native-oh-library/datetimepicker/blob/harmony/LICENSE) ,请自由地享受和参与开源。
--
Gitee
From 82f0b30cf580431b62ab74961ef881784daa88a7 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?=E5=88=98bug123?= <1518171514@qq.com>
Date: Fri, 8 Dec 2023 04:22:55 +0000
Subject: [PATCH 15/15] =?UTF-8?q?[Issues:=20#I8M3G8]=20=E6=B7=BB=E5=8A=A0d?=
=?UTF-8?q?atetimepicker=E6=96=87=E6=A1=A3partially?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
zh-cn/datetimepicker.md | 262 ++++++++++++++++++++++++++++++++++++++++
1 file changed, 262 insertions(+)
create mode 100644 zh-cn/datetimepicker.md
diff --git a/zh-cn/datetimepicker.md b/zh-cn/datetimepicker.md
new file mode 100644
index 000000000..32196fe2f
--- /dev/null
+++ b/zh-cn/datetimepicker.md
@@ -0,0 +1,262 @@
+> 模板版本:v0.0.1
+
+
+
@react-native-community/datetimepicker
+
+
+
+
+
+
+
+
+
+
+## 安装与使用
+
+进入到工程目录并输入以下命令:
+
+
+
+**正在 npm 发布中,当前请先从仓库[Release](https://github.com/react-native-oh-library/datetimepicker/releases)中获取库 tgz,通过使用本地依赖来安装本库。**
+
+#### **yarn**
+
+```bash
+yarn add xxx
+```
+
+#### **npm**
+
+```bash
+npm install xxx
+```
+
+
+
+下面的代码展示了这个库的基本使用场景:
+
+```js
+import DateTimePicker from '@react-native-community/datetimepicker';
+
+export const App = () => {
+ const [date, setDate] = useState(new Date(1598051730000));
+ const [mode, setMode] = useState('date');
+ const [show, setShow] = useState(false);
+
+ const onChange = (event, selectedDate) => {
+ const currentDate = selectedDate;
+ setShow(false);
+ setDate(currentDate);
+ };
+
+ const showMode = (currentMode) => {
+ setShow(true);
+ setMode(currentMode);
+ };
+
+ const showDatepicker = () => {
+ showMode('date');
+ };
+
+ const showTimepicker = () => {
+ showMode('time');
+ };
+
+ return (
+
+
+
+ selected: {date.toLocaleString()}
+ {show && (
+
+ )}
+
+ );
+};
+```
+
+## Link
+
+目前鸿蒙暂不支持 AutoLink,所以 Link 步骤需要手动配置。
+
+首先需要使用 DevEco Studio 打开项目里的鸿蒙工程 `harmony`
+
+### 引入原生端代码
+
+目前有两种方法:
+
+1. 通过 har 包引入(在 IDE 完善相关功能后该方法会被遗弃,目前首选此方法);
+2. 直接链接源码。
+
+方法一:通过 har 包引入
+打开 `entry/oh-package.json5`,添加以下依赖
+
+```json
+"dependencies": {
+ "rnoh": "file:../rnoh",
+ "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker.har"
+ }
+```
+
+点击右上角的 `sync` 按钮
+
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+方法二:直接链接源码
+打开 `entry/oh-package.json5`,添加以下依赖
+
+```json
+"dependencies": {
+ "rnoh": "file:../rnoh",
+ "rnoh-datetimepicker": "file:../../node_modules/@react-native-community/datetimepicker/harmony/datetimepicker"
+ }
+```
+
+打开终端,执行:
+
+```bash
+cd entry
+ohpm install --no-link
+```
+
+### 配置 CMakeLists 和引入 datetimepicker
+
+打开 `entry/src/main/cpp/CMakeLists.txt`,添加:
+
+```diff
+project(rnapp)
+cmake_minimum_required(VERSION 3.4.1)
+set(RNOH_APP_DIR "${CMAKE_CURRENT_SOURCE_DIR}")
+set(OH_MODULE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../oh_modules")
+set(RNOH_CPP_DIR "${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../react-native-harmony/harmony/cpp")
+
+add_subdirectory("${RNOH_CPP_DIR}" ./rn)
+
+# RNOH_BEGIN: add_package_subdirectories
+add_subdirectory("../../../../sample_package/src/main/cpp" ./sample-package)
++ add_subdirectory("${OH_MODULE_DIR}/rnoh-datetimepicker/src/main/cpp" ./datetimepicker)
+# RNOH_END: add_package_subdirectories
+
+add_library(rnoh_app SHARED
+ "./PackageProvider.cpp"
+ "${RNOH_CPP_DIR}/RNOHAppNapiBridge.cpp"
+)
+
+target_link_libraries(rnoh_app PUBLIC rnoh)
+
+# RNOH_BEGIN: link_packages
+target_link_libraries(rnoh_app PUBLIC rnoh_sample_package)
++ target_link_libraries(rnoh_app PUBLIC rnoh_datetime_picker)
+# RNOH_END: link_packages
+```
+
+打开 `entry/src/main/cpp/PackageProvider.cpp`,添加:
+
+```diff
+#include "RNOH/PackageProvider.h"
+#include "SamplePackage.h"
++ #include "DateTimePickerPackage.h"
+
+using namespace rnoh;
+
+std::vector> PackageProvider::getPackages(Package::Context ctx) {
+ return {
+ std::make_shared(ctx),
++ std::make_shared(ctx)
+ };
+}
+```
+
+### 在 ArkTs 侧引入 DateTimePicker 组件
+
+打开 `entry/src/main/ets/pages/index.ets`,添加:
+
+```diff
+import {
+ RNApp,
+ ComponentBuilderContext,
+ RNAbility,
+ AnyJSBundleProvider,
+ MetroJSBundleProvider,
+ ResourceJSBundleProvider,
+} from 'rnoh'
+import { SampleView, SAMPLE_VIEW_TYPE, PropsDisplayer } from "rnoh-sample-package"
+import { createRNPackages } from '../RNPackagesFactory'
++ import { RNDateTimePicker, DATETIME_PICKER_VIEW_TYPE } from "rnoh-datetimepicker"
+
+@Builder
+function CustomComponentBuilder(ctx: ComponentBuilderContext) {
+ if (ctx.descriptor.type === SAMPLE_VIEW_TYPE) {
+ SampleView({
+ ctx: ctx.rnohContext,
+ tag: ctx.descriptor.tag,
+ buildCustomComponent: CustomComponentBuilder
+ })
+ }
++ else if (ctx.descriptor.type === DATETIME_PICKER_VIEW_TYPE) {
++ RNDateTimePicker({
++ ctx: ctx.rnohContext,
++ tag: ctx.descriptor.tag,
++ buildCustomComponent: CustomComponentBuilder
++ })
++ }
+ ...
+}
+...
+```
+
+### 运行
+
+点击右上角的 `sync` 按钮
+
+或者在终端执行:
+
+```bash
+cd entry
+ohpm install
+```
+
+然后编译、运行即可。
+
+## 兼容性
+
+要使用此库,需要使用正确的 React-Native 和 RNOH 版本。另外,还需要使用配套的 DevEco Studio 和 手机 ROM。
+
+请到三方库相应的 Releases 发布地址查看 Release 配套的版本信息:[<@react-native-oh-library/datetimepicker> Releases](https://github.com/react-native-oh-library/datetimepicker/releases/tag/7.6.2-0.0.2)
+
+## 属性
+
+| 名称 | 说明 | 类型 | 是否必填 | 原库平台 | 鸿蒙支持 |
+| ----------- | ------------------------------------------------------------------------- | -------- | -------- | ------------------------ | ---------------------------------------------------------- |
+| mode | Defines the type of the picker | string | 否 | All | partially (仅支持 date/time 模式) |
+| style | Sets style directly on picker component. | object | 否 | IOS only | yes |
+| display | Defines the visual display of the picker. The default value is "default". | string | 否 | All | partially (支持"default","spinner","compact","inline") |
+| onChange | Date change handler. | function | 否 | All | partially (仅支持 type 为 set 类型) |
+| value | Defines the date or time value used in the component. | Date | 是 | All | partially (仅 mode=date 且 display=spinner 时支持动态设置) |
+| is24Hour | Allows changing of the time picker to a 24-hour format. | bool | 否 | Windows and Android only | yes |
+| maximumDate | Defines the maximum date that can be selected | Date | 否 | All | partially (仅支持在 mode=date 且 display=spinner 时设置) |
+| minimumDate | Defines the minimum date that can be selected. | Date | 否 | All | partially (仅支持在 mode=date 且 display=spinner 时设置) |
+| disabled | If true, the user won't be able to interact with the view. | bool | 否 | IOS only | yes |
+| textColor | Allows changing of the textColor of the date picker. | string | 否 | IOS only | partially (仅支持在 mode=date 且 display=compact 时设置) |
+
+## 遗留问题
+
+- [ ] 部分接口,未适配
+
+## 其他
+
+## 开源协议
+
+本项目基于 [The MIT License (MIT)](https://github.com/react-native-oh-library/datetimepicker/blob/harmony/LICENSE) ,请自由地享受和参与开源。
--
Gitee