@react-native-ohos/react-native-safe-area-context 4.7.5-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.OpenSource +11 -0
- package/README.md +11 -0
- package/harmony/safe_area/LICENSE +21 -0
- package/harmony/safe_area/NOTICE +33 -0
- package/harmony/safe_area/build-profile.json5 +9 -0
- package/harmony/safe_area/hvigorfile.ts +6 -0
- package/harmony/safe_area/index.ets +28 -0
- package/harmony/safe_area/oh-package.json5 +15 -0
- package/harmony/safe_area/src/main/cpp/CMakeLists.txt +9 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaBeanData.h +55 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaColumnNode.cpp +46 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaColumnNode.h +39 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaManagerMap.cpp +65 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaManagerMap.h +42 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaProviderComponentInstance.cpp +81 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaProviderComponentInstance.h +47 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaStackNode.cpp +78 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaStackNode.h +29 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaViewComponentInstance.cpp +103 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaViewComponentInstance.h +58 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaViewPackage.h +60 -0
- package/harmony/safe_area/src/main/cpp/TurboModuleRequest.cpp +63 -0
- package/harmony/safe_area/src/main/cpp/TurboModuleRequest.h +32 -0
- package/harmony/safe_area/src/main/cpp/generated/RNOH/generated/BaseReactNativeSafeAreaContextPackage.h +75 -0
- package/harmony/safe_area/src/main/cpp/generated/RNOH/generated/components/BaseRNCSafeAreaProviderComponentInstance.h +19 -0
- package/harmony/safe_area/src/main/cpp/generated/RNOH/generated/components/BaseRNCSafeAreaViewComponentInstance.h +19 -0
- package/harmony/safe_area/src/main/cpp/generated/RNOH/generated/components/RNCSafeAreaProviderJSIBinder.h +28 -0
- package/harmony/safe_area/src/main/cpp/generated/RNOH/generated/components/RNCSafeAreaViewJSIBinder.h +33 -0
- package/harmony/safe_area/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCSafeAreaContext.cpp +17 -0
- package/harmony/safe_area/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCSafeAreaContext.h +15 -0
- package/harmony/safe_area/src/main/cpp/generated/react/renderer/components/react_native_safe_area_context/ComponentDescriptors.h +21 -0
- package/harmony/safe_area/src/main/cpp/generated/react/renderer/components/react_native_safe_area_context/EventEmitters.cpp +57 -0
- package/harmony/safe_area/src/main/cpp/generated/react/renderer/components/react_native_safe_area_context/EventEmitters.h +62 -0
- package/harmony/safe_area/src/main/cpp/generated/react/renderer/components/react_native_safe_area_context/Props.cpp +33 -0
- package/harmony/safe_area/src/main/cpp/generated/react/renderer/components/react_native_safe_area_context/Props.h +99 -0
- package/harmony/safe_area/src/main/cpp/generated/react/renderer/components/react_native_safe_area_context/ShadowNodes.cpp +18 -0
- package/harmony/safe_area/src/main/cpp/generated/react/renderer/components/react_native_safe_area_context/ShadowNodes.h +29 -0
- package/harmony/safe_area/src/main/cpp/generated/react/renderer/components/react_native_safe_area_context/States.cpp +15 -0
- package/harmony/safe_area/src/main/cpp/generated/react/renderer/components/react_native_safe_area_context/States.h +20 -0
- package/harmony/safe_area/src/main/ets/Logger.ts +64 -0
- package/harmony/safe_area/src/main/ets/SafeAreaProvider.ets +128 -0
- package/harmony/safe_area/src/main/ets/SafeAreaProviderModifier.ets +121 -0
- package/harmony/safe_area/src/main/ets/SafeAreaView.ets +242 -0
- package/harmony/safe_area/src/main/ets/SafeAreaViewModifier.ets +140 -0
- package/harmony/safe_area/src/main/ets/SafeAreaViewPackage.ets +47 -0
- package/harmony/safe_area/src/main/ets/SafeViewTurboModule.ts +131 -0
- package/harmony/safe_area/src/main/ets/common/SafeAreaType.ts +70 -0
- package/harmony/safe_area/src/main/module.json5 +7 -0
- package/harmony/safe_area/src/main/resources/base/element/string.json +8 -0
- package/harmony/safe_area/src/main/resources/en_US/element/string.json +8 -0
- package/harmony/safe_area/src/main/resources/zh_CN/element/string.json +8 -0
- package/harmony/safe_area/ts.ets +26 -0
- package/harmony/safe_area.har +0 -0
- package/package.json +139 -0
- package/src/SafeArea.types.ts +47 -0
- package/src/SafeAreaView.tsx +201 -0
- package/src/index.tsx +4 -0
- package/src/specs/NativeSafeAreaContext.ts +23 -0
- package/src/specs/NativeSafeAreaProvider.ts +29 -0
- package/src/specs/NativeSafeAreaView.ts +28 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Th3rd Wave
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
[
|
|
2
|
+
{
|
|
3
|
+
"Name": "react-native-safe-area-context",
|
|
4
|
+
"License": "MIT License",
|
|
5
|
+
"License File": "LICENSE",
|
|
6
|
+
"Version Number": "4.7.4",
|
|
7
|
+
"Owner" : "xiafeng@huawei.com",
|
|
8
|
+
"Upstream URL": "https://github.com/th3rdwave/react-native-safe-area-context",
|
|
9
|
+
"Description": "A flexible way to handle safe area insets in JS. Also works on Android and Web!"
|
|
10
|
+
}
|
|
11
|
+
]
|
package/README.md
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
# @react-native-ohos/react-native-safe-area-context
|
|
2
|
+
This project is based on [react-native-safe-area-context@5.6.2](https://github.com/AppAndFlow/react-native-safe-area-context/tree/v5.6.2)
|
|
3
|
+
|
|
4
|
+
## Documentation
|
|
5
|
+
[中文](https://gitee.com/react-native-oh-library/usage-docs/blob/master/zh-cn/react-native-safe-area-context.md)
|
|
6
|
+
|
|
7
|
+
[English](https://gitee.com/react-native-oh-library/usage-docs/blob/master/en/react-native-safe-area-context.md)
|
|
8
|
+
|
|
9
|
+
## License
|
|
10
|
+
This library is licensed under [The MIT License (MIT)](https://github.com/th3rdwave/react-native-safe-area-context/blob/main/LICENSE).
|
|
11
|
+
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2019 Th3rd Wave
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
OPEN SOURCE SOFTWARE NOTICE
|
|
2
|
+
|
|
3
|
+
Please note we provide an open source software notice for the third party open source software along with this software and/or this software component (in the following just “this SOFTWARE”). The open source software licenses are granted by the respective right holders.
|
|
4
|
+
|
|
5
|
+
Warranty Disclaimer
|
|
6
|
+
THE OPEN SOURCE SOFTWARE IN THIS PRODUCT IS DISTRIBUTED IN THE HOPE THAT IT WILL BE USEFUL, BUT WITHOUT ANY WARRANTY, WITHOUT EVEN THE IMPLIED WARRANTY OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. SEE THE APPLICABLE LICENSES FOR MORE DETAILS.
|
|
7
|
+
|
|
8
|
+
Copyright Notice and License Texts
|
|
9
|
+
|
|
10
|
+
----------------------------------------------------------------------
|
|
11
|
+
Software: react-native-safe-area-context V4.7.4
|
|
12
|
+
|
|
13
|
+
MIT License
|
|
14
|
+
|
|
15
|
+
Copyright (c) 2019 Th3rd Wave
|
|
16
|
+
|
|
17
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
18
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
19
|
+
in the Software without restriction, including without limitation the rights
|
|
20
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
21
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
22
|
+
furnished to do so, subject to the following conditions:
|
|
23
|
+
|
|
24
|
+
The above copyright notice and this permission notice shall be included in all
|
|
25
|
+
copies or substantial portions of the Software.
|
|
26
|
+
|
|
27
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
28
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
29
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
30
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
31
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
32
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
33
|
+
SOFTWARE.
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
import { SafeAreaViewPackage } from './src/main/ets/SafeAreaViewPackage'
|
|
25
|
+
export default SafeAreaViewPackage
|
|
26
|
+
export * from "./ts"
|
|
27
|
+
export * from "./src/main/ets/SafeAreaView"
|
|
28
|
+
export * from "./src/main/ets/SafeAreaProvider"
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
{
|
|
2
|
+
"license": "ISC",
|
|
3
|
+
"types": "",
|
|
4
|
+
"devDependencies": {
|
|
5
|
+
|
|
6
|
+
},
|
|
7
|
+
"author": "",
|
|
8
|
+
"name": "@react-native-ohos/react-native-safe-area-context",
|
|
9
|
+
"description": "Please describe the basic information.",
|
|
10
|
+
"main": "index.ets",
|
|
11
|
+
"version": "4.7.5-rc.1",
|
|
12
|
+
"dependencies": {
|
|
13
|
+
"@rnoh/react-native-openharmony": "file:../react_native_openharmony"
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
cmake_minimum_required(VERSION 3.13)
|
|
2
|
+
set(CMAKE_VERBOSE_MAKEFILE on)
|
|
3
|
+
|
|
4
|
+
set(rnoh_safe_area_generated_dir "${CMAKE_CURRENT_SOURCE_DIR}/generated")
|
|
5
|
+
file(GLOB_RECURSE rnoh_safe_area_generated_SRC "${rnoh_safe_area_generated_dir}/**/*.cpp")
|
|
6
|
+
file(GLOB rnoh_safe_area_SRC CONFIGURE_DEPENDS *.cpp)
|
|
7
|
+
add_library(rnoh_safe_area SHARED ${rnoh_safe_area_generated_SRC} ${rnoh_safe_area_SRC})
|
|
8
|
+
target_include_directories(rnoh_safe_area PUBLIC ${CMAKE_CURRENT_SOURCE_DIR} ${rnoh_safe_area_generated_dir})
|
|
9
|
+
target_link_libraries(rnoh_safe_area PUBLIC rnoh)
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
#ifndef HARMONY_SAFEAREABEANDATA_H
|
|
26
|
+
#define HARMONY_SAFEAREABEANDATA_H
|
|
27
|
+
#include <string>
|
|
28
|
+
namespace safeArea {
|
|
29
|
+
struct EdgeInsets {
|
|
30
|
+
double_t top;
|
|
31
|
+
double_t right;
|
|
32
|
+
double_t bottom;
|
|
33
|
+
double_t left;
|
|
34
|
+
};
|
|
35
|
+
|
|
36
|
+
struct Edge {
|
|
37
|
+
std::string top;
|
|
38
|
+
std::string right;
|
|
39
|
+
std::string bottom;
|
|
40
|
+
std::string left;
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
struct Frame {
|
|
44
|
+
double_t x;
|
|
45
|
+
double_t y;
|
|
46
|
+
double_t width;
|
|
47
|
+
double_t height;
|
|
48
|
+
};
|
|
49
|
+
|
|
50
|
+
struct Event {
|
|
51
|
+
EdgeInsets insets;
|
|
52
|
+
Frame frame;
|
|
53
|
+
};
|
|
54
|
+
} // namespace safeArea
|
|
55
|
+
#endif // HARMONY_SAFEAREABEANDATA_H
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
#include "SafeAreaColumnNode.h"
|
|
25
|
+
|
|
26
|
+
#include <glog/logging.h>
|
|
27
|
+
#include <memory>
|
|
28
|
+
#include "RNOH/arkui/NativeNodeApi.h"
|
|
29
|
+
|
|
30
|
+
namespace rnoh {
|
|
31
|
+
SafeAreaColumnNode::SafeAreaColumnNode()
|
|
32
|
+
: ArkUINode(NativeNodeApi::getInstance()->createNode(ArkUI_NodeType::ARKUI_NODE_COLUMN)) {}
|
|
33
|
+
|
|
34
|
+
SafeAreaColumnNode::~SafeAreaColumnNode() {}
|
|
35
|
+
|
|
36
|
+
void SafeAreaColumnNode::insertChild(ArkUINode &child, std::size_t index)
|
|
37
|
+
{
|
|
38
|
+
maybeThrow(NativeNodeApi::getInstance()->insertChildAt(m_nodeHandle, child.getArkUINodeHandle(),
|
|
39
|
+
static_cast<int32_t>(index)));
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
void SafeAreaColumnNode::removeChild(ArkUINode &child)
|
|
43
|
+
{
|
|
44
|
+
maybeThrow(NativeNodeApi::getInstance()->removeChild(m_nodeHandle, child.getArkUINodeHandle()));
|
|
45
|
+
}
|
|
46
|
+
}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
#ifndef SAFEAREACOLUMNNODE_H
|
|
25
|
+
#define SAFEAREACOLUMNNODE_H
|
|
26
|
+
#pragma once
|
|
27
|
+
|
|
28
|
+
#include "RNOH/arkui/ArkUINode.h"
|
|
29
|
+
|
|
30
|
+
namespace rnoh {
|
|
31
|
+
class SafeAreaColumnNode : public ArkUINode {
|
|
32
|
+
public:
|
|
33
|
+
SafeAreaColumnNode();
|
|
34
|
+
~SafeAreaColumnNode() override;
|
|
35
|
+
void insertChild(ArkUINode &child, std::size_t index);
|
|
36
|
+
void removeChild(ArkUINode &child);
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
#endif
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
#include "SafeAreaManagerMap.h"
|
|
26
|
+
|
|
27
|
+
SafeAreaManagerMap::SafeAreaManagerMap()
|
|
28
|
+
{
|
|
29
|
+
}
|
|
30
|
+
SafeAreaManagerMap &SafeAreaManagerMap::getInstance()
|
|
31
|
+
{
|
|
32
|
+
static SafeAreaManagerMap instance;
|
|
33
|
+
return instance;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
void SafeAreaManagerMap::SetHasSafeAreaProviderByNodeHandle(ArkUI_NodeHandle nodeHandle, bool isHasSafeAreaProvider)
|
|
37
|
+
{
|
|
38
|
+
if (!nodeHandle) {
|
|
39
|
+
return;
|
|
40
|
+
}
|
|
41
|
+
hasSafeAreaProviderMap_[nodeHandle] = isHasSafeAreaProvider;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
bool SafeAreaManagerMap::GetHasSafeAreaProviderByNodeHandle(ArkUI_NodeHandle nodeHandle)
|
|
45
|
+
{
|
|
46
|
+
if (!nodeHandle) {
|
|
47
|
+
return false;
|
|
48
|
+
}
|
|
49
|
+
auto it = hasSafeAreaProviderMap_.find(nodeHandle);
|
|
50
|
+
if (it != hasSafeAreaProviderMap_.end()) {
|
|
51
|
+
return hasSafeAreaProviderMap_.at(nodeHandle);
|
|
52
|
+
}
|
|
53
|
+
return false;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
void SafeAreaManagerMap::RemoveSafeAreaProviderByNodeHandle(ArkUI_NodeHandle nodeHandle)
|
|
57
|
+
{
|
|
58
|
+
if (!nodeHandle) {
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
auto it = hasSafeAreaProviderMap_.find(nodeHandle);
|
|
62
|
+
if (it != hasSafeAreaProviderMap_.end()) {
|
|
63
|
+
hasSafeAreaProviderMap_.erase(nodeHandle);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2025 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
#ifndef HARMONY_SAFEAREAMANAGERMAP_H
|
|
25
|
+
#define HARMONY_SAFEAREAMANAGERMAP_H
|
|
26
|
+
#include <arkui/native_type.h>
|
|
27
|
+
#include <unordered_map>
|
|
28
|
+
class SafeAreaManagerMap {
|
|
29
|
+
private:
|
|
30
|
+
SafeAreaManagerMap();
|
|
31
|
+
SafeAreaManagerMap(const SafeAreaManagerMap &) = delete;
|
|
32
|
+
SafeAreaManagerMap &operator=(const SafeAreaManagerMap &) = delete;
|
|
33
|
+
SafeAreaManagerMap(SafeAreaManagerMap &&) = delete;
|
|
34
|
+
SafeAreaManagerMap &operator=(SafeAreaManagerMap &&) = delete;
|
|
35
|
+
std::unordered_map<ArkUI_NodeHandle, bool> hasSafeAreaProviderMap_;
|
|
36
|
+
public:
|
|
37
|
+
static SafeAreaManagerMap &getInstance();
|
|
38
|
+
void SetHasSafeAreaProviderByNodeHandle(ArkUI_NodeHandle nodeHandle, bool isHasSafeAreaProvider);
|
|
39
|
+
bool GetHasSafeAreaProviderByNodeHandle(ArkUI_NodeHandle nodeHandle);
|
|
40
|
+
void RemoveSafeAreaProviderByNodeHandle(ArkUI_NodeHandle nodeHandle);
|
|
41
|
+
};
|
|
42
|
+
#endif //HARMONY_SAFEAREAMANAGERMAP_H
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
#include <sys/param.h>
|
|
26
|
+
#include "SafeAreaProviderComponentInstance.h"
|
|
27
|
+
#include "TurboModuleRequest.h"
|
|
28
|
+
#include "SafeAreaManagerMap.h"
|
|
29
|
+
|
|
30
|
+
namespace rnoh {
|
|
31
|
+
|
|
32
|
+
SafeAreaProviderComponentInstance::SafeAreaProviderComponentInstance(Context context)
|
|
33
|
+
: BaseRNCSafeAreaProviderComponentInstance(std::move(context))
|
|
34
|
+
{
|
|
35
|
+
SafeAreaManagerMap::getInstance().SetHasSafeAreaProviderByNodeHandle(m_stackNode.getArkUINodeHandle(),
|
|
36
|
+
true);
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
void SafeAreaProviderComponentInstance::onChildInserted(ComponentInstance::Shared const &childComponentInstance,
|
|
40
|
+
std::size_t index)
|
|
41
|
+
{
|
|
42
|
+
super::onChildInserted(childComponentInstance, index);
|
|
43
|
+
m_stackNode.insertChild(childComponentInstance->getLocalRootArkUINode(), index);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
void SafeAreaProviderComponentInstance::onChildRemoved(ComponentInstance::Shared const &childComponentInstance)
|
|
47
|
+
{
|
|
48
|
+
super::onChildRemoved(childComponentInstance);
|
|
49
|
+
m_stackNode.removeChild(childComponentInstance->getLocalRootArkUINode());
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
SafeAreaStackNode &SafeAreaProviderComponentInstance::getLocalRootArkUINode() { return m_stackNode; }
|
|
53
|
+
|
|
54
|
+
void SafeAreaProviderComponentInstance::onPropsChanged(SharedConcreteProps const &props)
|
|
55
|
+
{
|
|
56
|
+
super::onPropsChanged(props);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
void SafeAreaProviderComponentInstance::onEventEmitterChanged(SharedConcreteEventEmitter const &eventEmitter)
|
|
60
|
+
{
|
|
61
|
+
auto newEventEmitter = std::dynamic_pointer_cast<const ConcreteEventEmitter>(eventEmitter);
|
|
62
|
+
if (!newEventEmitter) {
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
TurboModuleRequest request;
|
|
66
|
+
safeArea::Event data = request.getTurboModuleData(this->m_deps);
|
|
67
|
+
double x = getLayoutMetrics().frame.origin.x;
|
|
68
|
+
double y = getLayoutMetrics().frame.origin.y;
|
|
69
|
+
double width = getLayoutMetrics().frame.size.width;
|
|
70
|
+
double height = getLayoutMetrics().frame.size.height;
|
|
71
|
+
double providerTop = MAX(data.insets.top - y, 0);
|
|
72
|
+
double providerRight = MAX(MIN(x + width - data.frame.width, 0) + data.insets.right, 0);
|
|
73
|
+
double providerBottom = MAX(MIN(y + height - data.frame.height, 0) + data.insets.bottom, 0);
|
|
74
|
+
double providerLeft = MAX(data.insets.left - x, 0);
|
|
75
|
+
facebook::react::RNCSafeAreaProviderEventEmitter::OnInsetsChangeInsets insets = {providerTop, providerRight,
|
|
76
|
+
providerBottom, providerLeft};
|
|
77
|
+
facebook::react::RNCSafeAreaProviderEventEmitter::OnInsetsChangeFrame frame = {x, y, width, height};
|
|
78
|
+
facebook::react::RNCSafeAreaProviderEventEmitter::OnInsetsChange insetsChange = {insets, frame};
|
|
79
|
+
newEventEmitter->onInsetsChange(insetsChange);
|
|
80
|
+
}
|
|
81
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* MIT License
|
|
3
|
+
*
|
|
4
|
+
* Copyright (C) 2023 Huawei Device Co., Ltd.
|
|
5
|
+
*
|
|
6
|
+
* Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
7
|
+
* of this software and associated documentation files (the "Software"), to deal
|
|
8
|
+
* in the Software without restriction, including without limitation the rights
|
|
9
|
+
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
10
|
+
* copies of the Software, and to permit persons to whom the Software is
|
|
11
|
+
* furnished to do so, subject to the following conditions:
|
|
12
|
+
*
|
|
13
|
+
* The above copyright notice and this permission notice shall be included in all
|
|
14
|
+
* copies or substantial portions of the Software.
|
|
15
|
+
*
|
|
16
|
+
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
17
|
+
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
18
|
+
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
19
|
+
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
20
|
+
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
21
|
+
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
22
|
+
* SOFTWARE.
|
|
23
|
+
*/
|
|
24
|
+
#ifndef SAFEAREAPROVIDERCOMPONENTINSTANCE_H
|
|
25
|
+
#define SAFEAREAPROVIDERCOMPONENTINSTANCE_H
|
|
26
|
+
#pragma once
|
|
27
|
+
#include "RNOH/CppComponentInstance.h"
|
|
28
|
+
#include "SafeAreaStackNode.h"
|
|
29
|
+
#include "generated/RNOH/generated/components/BaseRNCSafeAreaProviderComponentInstance.h"
|
|
30
|
+
#include "generated/react/renderer/components/react_native_safe_area_context/EventEmitters.h"
|
|
31
|
+
namespace rnoh {
|
|
32
|
+
class SafeAreaProviderComponentInstance : public BaseRNCSafeAreaProviderComponentInstance {
|
|
33
|
+
using super = BaseRNCSafeAreaProviderComponentInstance;
|
|
34
|
+
private:
|
|
35
|
+
SafeAreaStackNode m_stackNode;
|
|
36
|
+
public:
|
|
37
|
+
explicit SafeAreaProviderComponentInstance(Context context);
|
|
38
|
+
|
|
39
|
+
void onChildInserted(ComponentInstance::Shared
|
|
40
|
+
const &childComponentInstance, std::size_t index) override;
|
|
41
|
+
void onChildRemoved(ComponentInstance::Shared const &childComponentInstance) override;
|
|
42
|
+
SafeAreaStackNode &getLocalRootArkUINode() override;
|
|
43
|
+
void onPropsChanged(SharedConcreteProps const &props) override;
|
|
44
|
+
void onEventEmitterChanged(SharedConcreteEventEmitter const &eventEmitter) override;
|
|
45
|
+
};
|
|
46
|
+
}
|
|
47
|
+
#endif
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
#include "SafeAreaStackNode.h"
|
|
2
|
+
|
|
3
|
+
#include <glog/logging.h>
|
|
4
|
+
#include <memory>
|
|
5
|
+
#include "RNOH/arkui/NativeNodeApi.h"
|
|
6
|
+
#include "SafeAreaManagerMap.h"
|
|
7
|
+
#define CLICK_EVENT 2
|
|
8
|
+
#define THREE_INDEX 3
|
|
9
|
+
|
|
10
|
+
namespace rnoh {
|
|
11
|
+
|
|
12
|
+
SafeAreaStackNode::SafeAreaStackNode()
|
|
13
|
+
: ArkUINode(NativeNodeApi::getInstance()->createNode(
|
|
14
|
+
ArkUI_NodeType::ARKUI_NODE_STACK)),
|
|
15
|
+
m_stackNodeDelegate(nullptr)
|
|
16
|
+
{
|
|
17
|
+
maybeThrow(NativeNodeApi::getInstance()->registerNodeEvent(
|
|
18
|
+
m_nodeHandle, NODE_ON_CLICK, NODE_ON_CLICK, this));
|
|
19
|
+
maybeThrow(NativeNodeApi::getInstance()->registerNodeEvent(
|
|
20
|
+
m_nodeHandle, NODE_EVENT_ON_APPEAR, NODE_EVENT_ON_APPEAR, this));
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
void SafeAreaStackNode::insertChild(ArkUINode& child, std::size_t index)
|
|
24
|
+
{
|
|
25
|
+
maybeThrow(NativeNodeApi::getInstance()->insertChildAt(
|
|
26
|
+
m_nodeHandle, child.getArkUINodeHandle(), static_cast<int32_t>(index)));
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
void SafeAreaStackNode::removeChild(ArkUINode& child)
|
|
30
|
+
{
|
|
31
|
+
maybeThrow(NativeNodeApi::getInstance()->removeChild(
|
|
32
|
+
m_nodeHandle, child.getArkUINodeHandle()));
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
void SafeAreaStackNode::setStackNodeDelegate(SafeAreaStackNodeDelegate* SafeAreaStackNodeDelegate)
|
|
36
|
+
{
|
|
37
|
+
m_stackNodeDelegate = SafeAreaStackNodeDelegate;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
void SafeAreaStackNode::onNodeEvent(
|
|
41
|
+
ArkUI_NodeEventType eventType,
|
|
42
|
+
EventArgs& eventArgs)
|
|
43
|
+
{
|
|
44
|
+
if (eventType == ArkUI_NodeEventType::NODE_ON_CLICK && eventArgs[THREE_INDEX].i32 != CLICK_EVENT) {
|
|
45
|
+
onClick();
|
|
46
|
+
}
|
|
47
|
+
if (eventType == ArkUI_NodeEventType::NODE_EVENT_ON_APPEAR) {
|
|
48
|
+
if (m_stackNodeDelegate != nullptr) {
|
|
49
|
+
m_stackNodeDelegate->onAppear();
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
void SafeAreaStackNode::onClick()
|
|
55
|
+
{
|
|
56
|
+
if (m_stackNodeDelegate != nullptr) {
|
|
57
|
+
m_stackNodeDelegate->onClick();
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
SafeAreaStackNode::~SafeAreaStackNode()
|
|
62
|
+
{
|
|
63
|
+
NativeNodeApi::getInstance()->unregisterNodeEvent(
|
|
64
|
+
m_nodeHandle, NODE_ON_CLICK);
|
|
65
|
+
NativeNodeApi::getInstance()->unregisterNodeEvent(
|
|
66
|
+
m_nodeHandle, NODE_EVENT_ON_APPEAR);
|
|
67
|
+
SafeAreaManagerMap::getInstance().RemoveSafeAreaProviderByNodeHandle(m_nodeHandle);
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
SafeAreaStackNode& SafeAreaStackNode::setAlign(int32_t align)
|
|
71
|
+
{
|
|
72
|
+
ArkUI_NumberValue value[] = {{.i32 = align}};
|
|
73
|
+
ArkUI_AttributeItem item = {.value = value, .size = 1};
|
|
74
|
+
maybeThrow(NativeNodeApi::getInstance()->setAttribute(
|
|
75
|
+
m_nodeHandle, NODE_STACK_ALIGN_CONTENT, &item));
|
|
76
|
+
return *this;
|
|
77
|
+
}
|
|
78
|
+
}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
#ifndef SAFEAREASTACKNODE_H
|
|
2
|
+
#define SAFEAREASTACKNODE_H
|
|
3
|
+
#pragma once
|
|
4
|
+
|
|
5
|
+
#include "RNOH/arkui/ArkUINode.h"
|
|
6
|
+
|
|
7
|
+
namespace rnoh {
|
|
8
|
+
class SafeAreaStackNodeDelegate {
|
|
9
|
+
public:
|
|
10
|
+
virtual ~SafeAreaStackNodeDelegate() = default;
|
|
11
|
+
virtual void onClick() {};
|
|
12
|
+
virtual void onAppear() {};
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
class SafeAreaStackNode : public ArkUINode {
|
|
16
|
+
protected:
|
|
17
|
+
SafeAreaStackNodeDelegate* m_stackNodeDelegate;
|
|
18
|
+
public:
|
|
19
|
+
SafeAreaStackNode();
|
|
20
|
+
~SafeAreaStackNode() override;
|
|
21
|
+
void insertChild(ArkUINode& child, std::size_t index);
|
|
22
|
+
void removeChild(ArkUINode& child);
|
|
23
|
+
void onNodeEvent(ArkUI_NodeEventType eventType, EventArgs& eventArgs) override;
|
|
24
|
+
void onClick();
|
|
25
|
+
void setStackNodeDelegate(SafeAreaStackNodeDelegate* safeAreaStackNodeDelegate);
|
|
26
|
+
SafeAreaStackNode& setAlign(int32_t align);
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
#endif
|