Skip to content

OpenHarmony support #1

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Nov 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
module.exports = {extends: ['@react-native-community']};
31 changes: 0 additions & 31 deletions AnyHeader.js

This file was deleted.

18 changes: 0 additions & 18 deletions ClassicsHeader.js

This file was deleted.

18 changes: 0 additions & 18 deletions DefaultHeader.js

This file was deleted.

30 changes: 0 additions & 30 deletions MaterialHeader.js

This file was deleted.

21 changes: 0 additions & 21 deletions StoreHouseHeader.js

This file was deleted.

9 changes: 0 additions & 9 deletions Util.js

This file was deleted.

Binary file added harmony/smart_refresh_layout.har
Binary file not shown.
6 changes: 6 additions & 0 deletions harmony/smart_refresh_layout/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
/node_modules
/oh_modules
/.preview
/build
/.cxx
/.test
17 changes: 17 additions & 0 deletions harmony/smart_refresh_layout/Index.ets
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
/*
* Copyright (C) 2023 Huawei Device Co., Ltd.
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
export * from "./src/main/ets/SmartRefreshControl"
export * from "./src/main/ets/RNCAnyHeader"
export * from "./src/main/ets/RNCDefaultHeader"
3 changes: 3 additions & 0 deletions harmony/smart_refresh_layout/ResourceTable.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
string page_show 0x02000000
media icon_load 0x02000001
media icon_up 0x02000002
11 changes: 11 additions & 0 deletions harmony/smart_refresh_layout/build-profile.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"apiType": "stageMode",
"buildOption": {
},
"targets": [
{
"name": "default",
"runtimeOS": "HarmonyOS"
}
]
}
Empty file.
6 changes: 6 additions & 0 deletions harmony/smart_refresh_layout/hvigorfile.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import { harTasks } from '@ohos/hvigor-ohos-plugin';

export default {
system: harTasks, /* Built-in plugin of Hvigor. It cannot be modified. */
plugins:[] /* Custom plugin to extend the functionality of Hvigor. */
}
18 changes: 18 additions & 0 deletions harmony/smart_refresh_layout/obfuscation-rules.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# Define project specific obfuscation rules here.
# You can include the obfuscation configuration files in the current module's build-profile.json5.
#
# For more details, see
# https://gitee.com/openharmony/arkcompiler_ets_frontend/blob/master/arkguard/README.md

# Obfuscation options:
# -disable-obfuscation: disable all obfuscations
# -enable-property-obfuscation: obfuscate the property names
# -enable-toplevel-obfuscation: obfuscate the names in the global scope
# -compact: remove unnecessary blank spaces and all line feeds
# -remove-log: remove all console.* statements
# -print-namecache: print the name cache that contains the mapping from the old names to new names
# -apply-namecache: reuse the given cache file

# Keep options:
# -keep-property-name: specifies property names that you want to keep
# -keep-global-name: specifies names that you want to keep in the global scope
6 changes: 6 additions & 0 deletions harmony/smart_refresh_layout/oh-package-lock.json5

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 13 additions & 0 deletions harmony/smart_refresh_layout/oh-package.json5
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"license": "Apache-2.0",
"devDependencies": {
"rnoh": "file:../rnoh"
},
"author": "",
"name": "smart_refresh_layout",
"description": "Please describe the basic information.",
"main": "Index.ets",
"version": "1.0.0",
"dependencies": {},
"compileOnlyDependencies": {}
}
7 changes: 7 additions & 0 deletions harmony/smart_refresh_layout/src/main/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
cmake_minimum_required(VERSION 3.13)
set(CMAKE_VERBOSE_MAKEFILE on)

file(GLOB rnoh_smart_refresh_layout_SRC CONFIGURE_DEPENDS *.cpp)
add_library(rnoh_smart_refresh_layout SHARED ${rnoh_smart_refresh_layout_SRC})
target_include_directories(rnoh_smart_refresh_layout PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_link_libraries(rnoh_smart_refresh_layout PUBLIC rnoh)
27 changes: 27 additions & 0 deletions harmony/smart_refresh_layout/src/main/cpp/ComponentDescriptors.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@

/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateComponentDescriptorH.js
*/

#pragma once

#include "ShadowNodes.h"
#include <react/renderer/core/ConcreteComponentDescriptor.h>

namespace facebook {
namespace react {

using RNCAnyHeaderComponentDescriptor = ConcreteComponentDescriptor<RNCAnyHeaderShadowNode>;
using RNCClassicsHeaderComponentDescriptor = ConcreteComponentDescriptor<RNCClassicsHeaderShadowNode>;
using RNCDefaultHeaderComponentDescriptor = ConcreteComponentDescriptor<RNCDefaultHeaderShadowNode>;
using RNCMaterialHeaderComponentDescriptor = ConcreteComponentDescriptor<RNCMaterialHeaderShadowNode>;
using SmartRefreshLayoutComponentDescriptor = ConcreteComponentDescriptor<SmartRefreshLayoutShadowNode>;
using RNCStoreHouseHeaderComponentDescriptor = ConcreteComponentDescriptor<RNCStoreHouseHeaderShadowNode>;

} // namespace react
} // namespace facebook
65 changes: 65 additions & 0 deletions harmony/smart_refresh_layout/src/main/cpp/EventEmitters.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@

/**
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
*
* Do not edit this file as changes may cause incorrect behavior and will be lost
* once the code is regenerated.
*
* @generated by codegen project: GenerateEventEmitterCpp.js
*/

#include "EventEmitters.h"

namespace facebook {
namespace react {

void SmartRefreshLayoutEventEmitter::onRefresh(OnRefresh event) const {
dispatchEvent("refresh", [event=std::move(event)](jsi::Runtime &runtime) {
auto payload = jsi::Object(runtime);

return payload;
});
}
void SmartRefreshLayoutEventEmitter::onHeaderPulling(OnHeaderPulling event) const {
dispatchEvent("headerPulling", [event=std::move(event)](jsi::Runtime &runtime) {
auto payload = jsi::Object(runtime);
payload.setProperty(runtime, "percent", event.percent);
payload.setProperty(runtime, "offset", event.offset);
payload.setProperty(runtime, "headerHeight", event.headerHeight);
return payload;
});
}
void SmartRefreshLayoutEventEmitter::onHeaderReleasing(OnHeaderReleasing event) const {
dispatchEvent("headerReleasing", [event=std::move(event)](jsi::Runtime &runtime) {
auto payload = jsi::Object(runtime);
payload.setProperty(runtime, "percent", event.percent);
payload.setProperty(runtime, "offset", event.offset);
payload.setProperty(runtime, "headerHeight", event.headerHeight);
return payload;
});
}
void SmartRefreshLayoutEventEmitter::onPullDownToRefresh(OnPullDownToRefresh event) const {
dispatchEvent("pullDownToRefresh", [event=std::move(event)](jsi::Runtime &runtime) {
auto payload = jsi::Object(runtime);

return payload;
});
}
void SmartRefreshLayoutEventEmitter::onReleaseToRefresh(OnReleaseToRefresh event) const {
dispatchEvent("releaseToRefresh", [event=std::move(event)](jsi::Runtime &runtime) {
auto payload = jsi::Object(runtime);

return payload;
});
}
void SmartRefreshLayoutEventEmitter::onHeaderReleased(OnHeaderReleased event) const {
dispatchEvent("headerReleased", [event=std::move(event)](jsi::Runtime &runtime) {
auto payload = jsi::Object(runtime);

return payload;
});
}


} // namespace react
} // namespace facebook
Loading