@react-native-ohos/react-native-safe-area-context 5.1.1-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 +10 -0
- package/harmony/safe_area/LICENSE +21 -0
- package/harmony/safe_area/NOTICE +33 -0
- package/harmony/safe_area/README.md +270 -0
- package/harmony/safe_area/build-profile.json5 +9 -0
- package/harmony/safe_area/hvigorfile.ts +6 -0
- package/harmony/safe_area/index.ets +26 -0
- package/harmony/safe_area/oh-package.json5 +22 -0
- package/harmony/safe_area/src/main/cpp/CMakeLists.txt +9 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaBeanData.h +56 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaColumnNode.cpp +45 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaColumnNode.h +38 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaManagerMap.cpp +66 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaManagerMap.h +57 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaProviderComponentInstance.cpp +75 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaProviderComponentInstance.h +49 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaStackNode.cpp +94 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaStackNode.h +53 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaViewComponentInstance.cpp +94 -0
- package/harmony/safe_area/src/main/cpp/SafeAreaViewComponentInstance.h +64 -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 +33 -0
- package/harmony/safe_area/src/main/cpp/generated/RNOH/generated/BaseReactNativeSafeAreaContextPackage.h +72 -0
- package/harmony/safe_area/src/main/cpp/generated/RNOH/generated/components/BaseRNCSafeAreaProviderComponentInstance.h +18 -0
- package/harmony/safe_area/src/main/cpp/generated/RNOH/generated/components/BaseRNCSafeAreaViewComponentInstance.h +18 -0
- package/harmony/safe_area/src/main/cpp/generated/RNOH/generated/components/RNCSafeAreaProviderJSIBinder.h +27 -0
- package/harmony/safe_area/src/main/cpp/generated/RNOH/generated/components/RNCSafeAreaViewJSIBinder.h +30 -0
- package/harmony/safe_area/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCSafeAreaContext.cpp +16 -0
- package/harmony/safe_area/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCSafeAreaContext.h +16 -0
- package/harmony/safe_area/src/main/cpp/generated/react/renderer/components/react_native_safe_area_context/ComponentDescriptors.h +25 -0
- package/harmony/safe_area/src/main/cpp/generated/react/renderer/components/react_native_safe_area_context/EventEmitters.cpp +56 -0
- package/harmony/safe_area/src/main/cpp/generated/react/renderer/components/react_native_safe_area_context/EventEmitters.h +59 -0
- package/harmony/safe_area/src/main/cpp/generated/react/renderer/components/react_native_safe_area_context/Props.cpp +36 -0
- package/harmony/safe_area/src/main/cpp/generated/react/renderer/components/react_native_safe_area_context/Props.h +88 -0
- package/harmony/safe_area/src/main/cpp/generated/react/renderer/components/react_native_safe_area_context/ShadowNodes.cpp +20 -0
- package/harmony/safe_area/src/main/cpp/generated/react/renderer/components/react_native_safe_area_context/ShadowNodes.h +39 -0
- package/harmony/safe_area/src/main/cpp/generated/react/renderer/components/react_native_safe_area_context/States.cpp +18 -0
- package/harmony/safe_area/src/main/cpp/generated/react/renderer/components/react_native_safe_area_context/States.h +23 -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.ts +46 -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.ts +26 -0
- package/harmony/safe_area.har +0 -0
- package/lib/commonjs/SafeArea.types.js +6 -0
- package/lib/commonjs/SafeArea.types.js.map +1 -0
- package/lib/commonjs/SafeAreaView.js +184 -0
- package/lib/commonjs/SafeAreaView.js.map +1 -0
- package/lib/commonjs/index.js +51 -0
- package/lib/commonjs/index.js.map +1 -0
- package/lib/commonjs/specs/NativeSafeAreaContext.js +9 -0
- package/lib/commonjs/specs/NativeSafeAreaContext.js.map +1 -0
- package/lib/commonjs/specs/NativeSafeAreaProvider.js +10 -0
- package/lib/commonjs/specs/NativeSafeAreaProvider.js.map +1 -0
- package/lib/commonjs/specs/NativeSafeAreaView.js +12 -0
- package/lib/commonjs/specs/NativeSafeAreaView.js.map +1 -0
- package/lib/module/SafeArea.types.js +2 -0
- package/lib/module/SafeArea.types.js.map +1 -0
- package/lib/module/SafeAreaView.js +176 -0
- package/lib/module/SafeAreaView.js.map +1 -0
- package/lib/module/index.js +7 -0
- package/lib/module/index.js.map +1 -0
- package/lib/module/specs/NativeSafeAreaContext.js +3 -0
- package/lib/module/specs/NativeSafeAreaContext.js.map +1 -0
- package/lib/module/specs/NativeSafeAreaProvider.js +3 -0
- package/lib/module/specs/NativeSafeAreaProvider.js.map +1 -0
- package/lib/module/specs/NativeSafeAreaView.js +5 -0
- package/lib/module/specs/NativeSafeAreaView.js.map +1 -0
- package/lib/typescript/SafeArea.types.d.ts +36 -0
- package/lib/typescript/SafeArea.types.d.ts.map +1 -0
- package/lib/typescript/SafeAreaView.d.ts +6 -0
- package/lib/typescript/SafeAreaView.d.ts.map +1 -0
- package/lib/typescript/index.d.ts +5 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/specs/NativeSafeAreaContext.d.ts +23 -0
- package/lib/typescript/specs/NativeSafeAreaContext.d.ts.map +1 -0
- package/lib/typescript/specs/NativeSafeAreaProvider.d.ts +22 -0
- package/lib/typescript/specs/NativeSafeAreaProvider.d.ts.map +1 -0
- package/lib/typescript/specs/NativeSafeAreaView.d.ts +24 -0
- package/lib/typescript/specs/NativeSafeAreaView.d.ts.map +1 -0
- package/package.json +139 -0
- package/src/SafeArea.types.ts +47 -0
- package/src/SafeAreaView.tsx +201 -0
- package/src/index.tsx +6 -0
- package/src/specs/NativeSafeAreaContext.ts +23 -0
- package/src/specs/NativeSafeAreaProvider.ts +29 -0
- package/src/specs/NativeSafeAreaView.ts +28 -0
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
|
|
7
|
+
#include <react/renderer/components/react_native_safe_area_context/ComponentDescriptors.h>
|
|
8
|
+
#include "RNOH/Package.h"
|
|
9
|
+
#include "RNOH/ArkTSTurboModule.h"
|
|
10
|
+
#include "RNOH/generated/turbo_modules/RNCSafeAreaContext.h"
|
|
11
|
+
#include "RNOH/generated/components/RNCSafeAreaViewJSIBinder.h"
|
|
12
|
+
#include "RNOH/generated/components/RNCSafeAreaProviderJSIBinder.h"
|
|
13
|
+
|
|
14
|
+
namespace rnoh {
|
|
15
|
+
|
|
16
|
+
class BaseReactNativeSafeAreaContextPackageTurboModuleFactoryDelegate : public TurboModuleFactoryDelegate {
|
|
17
|
+
public:
|
|
18
|
+
SharedTurboModule createTurboModule(Context ctx, const std::string &name) const override {
|
|
19
|
+
if (name == "RNCSafeAreaContext") {
|
|
20
|
+
return std::make_shared<RNCSafeAreaContext>(ctx, name);
|
|
21
|
+
}
|
|
22
|
+
return nullptr;
|
|
23
|
+
};
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
class BaseReactNativeSafeAreaContextPackageEventEmitRequestHandler : public EventEmitRequestHandler {
|
|
27
|
+
public:
|
|
28
|
+
void handleEvent(Context const &ctx) override {
|
|
29
|
+
auto eventEmitter = ctx.shadowViewRegistry->getEventEmitter<facebook::react::EventEmitter>(ctx.tag);
|
|
30
|
+
if (eventEmitter == nullptr) {
|
|
31
|
+
return;
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
std::vector<std::string> supportedEventNames = {
|
|
35
|
+
};
|
|
36
|
+
if (std::find(supportedEventNames.begin(), supportedEventNames.end(), ctx.eventName) != supportedEventNames.end()) {
|
|
37
|
+
eventEmitter->dispatchEvent(ctx.eventName, ArkJS(ctx.env).getDynamic(ctx.payload));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
|
|
43
|
+
class BaseReactNativeSafeAreaContextPackage : public Package {
|
|
44
|
+
public:
|
|
45
|
+
BaseReactNativeSafeAreaContextPackage(Package::Context ctx) : Package(ctx){};
|
|
46
|
+
|
|
47
|
+
std::unique_ptr<TurboModuleFactoryDelegate> createTurboModuleFactoryDelegate() override {
|
|
48
|
+
return std::make_unique<BaseReactNativeSafeAreaContextPackageTurboModuleFactoryDelegate>();
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
std::vector<facebook::react::ComponentDescriptorProvider> createComponentDescriptorProviders() override {
|
|
52
|
+
return {
|
|
53
|
+
facebook::react::concreteComponentDescriptorProvider<facebook::react::RNCSafeAreaViewComponentDescriptor>(),
|
|
54
|
+
facebook::react::concreteComponentDescriptorProvider<facebook::react::RNCSafeAreaProviderComponentDescriptor>(),
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
ComponentJSIBinderByString createComponentJSIBinderByName() override {
|
|
59
|
+
return {
|
|
60
|
+
{"RNCSafeAreaView", std::make_shared<RNCSafeAreaViewJSIBinder>()},
|
|
61
|
+
{"RNCSafeAreaProvider", std::make_shared<RNCSafeAreaProviderJSIBinder>()},
|
|
62
|
+
};
|
|
63
|
+
};
|
|
64
|
+
|
|
65
|
+
EventEmitRequestHandlers createEventEmitRequestHandlers() override {
|
|
66
|
+
return {
|
|
67
|
+
std::make_shared<BaseReactNativeSafeAreaContextPackageEventEmitRequestHandler>(),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
};
|
|
71
|
+
|
|
72
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include "RNOH/CppComponentInstance.h"
|
|
9
|
+
#include <react/renderer/components/react_native_safe_area_context/ShadowNodes.h>
|
|
10
|
+
|
|
11
|
+
namespace rnoh {
|
|
12
|
+
class BaseRNCSafeAreaProviderComponentInstance
|
|
13
|
+
: public CppComponentInstance<facebook::react::RNCSafeAreaProviderShadowNode> {
|
|
14
|
+
public:
|
|
15
|
+
using CppComponentInstance::CppComponentInstance;
|
|
16
|
+
|
|
17
|
+
};
|
|
18
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
#pragma once
|
|
7
|
+
|
|
8
|
+
#include "RNOH/CppComponentInstance.h"
|
|
9
|
+
#include <react/renderer/components/react_native_safe_area_context/ShadowNodes.h>
|
|
10
|
+
|
|
11
|
+
namespace rnoh {
|
|
12
|
+
class BaseRNCSafeAreaViewComponentInstance
|
|
13
|
+
: public CppComponentInstance<facebook::react::RNCSafeAreaViewShadowNode> {
|
|
14
|
+
public:
|
|
15
|
+
using CppComponentInstance::CppComponentInstance;
|
|
16
|
+
|
|
17
|
+
};
|
|
18
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
#include "RNOHCorePackage/ComponentBinders/ViewComponentJSIBinder.h"
|
|
7
|
+
|
|
8
|
+
namespace rnoh {
|
|
9
|
+
class RNCSafeAreaProviderJSIBinder : public ViewComponentJSIBinder {
|
|
10
|
+
protected:
|
|
11
|
+
facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override {
|
|
12
|
+
auto object = ViewComponentJSIBinder::createNativeProps(rt);
|
|
13
|
+
return object;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override {
|
|
17
|
+
facebook::jsi::Object events(rt);
|
|
18
|
+
return events;
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override {
|
|
22
|
+
facebook::jsi::Object events(rt);
|
|
23
|
+
events.setProperty(rt, "topInsetsChange", createDirectEvent(rt, "onInsetsChange"));
|
|
24
|
+
return events;
|
|
25
|
+
}
|
|
26
|
+
};
|
|
27
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
#include "RNOHCorePackage/ComponentBinders/ViewComponentJSIBinder.h"
|
|
7
|
+
|
|
8
|
+
namespace rnoh {
|
|
9
|
+
class RNCSafeAreaViewJSIBinder : public ViewComponentJSIBinder {
|
|
10
|
+
protected:
|
|
11
|
+
facebook::jsi::Object createNativeProps(facebook::jsi::Runtime &rt) override {
|
|
12
|
+
auto object = ViewComponentJSIBinder::createNativeProps(rt);
|
|
13
|
+
object.setProperty(rt, "mode", true);
|
|
14
|
+
object.setProperty(rt, "edges", "Object");
|
|
15
|
+
object.setProperty(rt, "isFirstRefresh", true);
|
|
16
|
+
return object;
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
facebook::jsi::Object createBubblingEventTypes(facebook::jsi::Runtime &rt) override {
|
|
20
|
+
facebook::jsi::Object events(rt);
|
|
21
|
+
return events;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
facebook::jsi::Object createDirectEventTypes(facebook::jsi::Runtime &rt) override {
|
|
25
|
+
facebook::jsi::Object events(rt);
|
|
26
|
+
events.setProperty(rt, "topSafeAreaValueChange", createDirectEvent(rt, "onSafeAreaValueChange"));
|
|
27
|
+
return events;
|
|
28
|
+
}
|
|
29
|
+
};
|
|
30
|
+
} // namespace rnoh
|
package/harmony/safe_area/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCSafeAreaContext.cpp
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#include "RNCSafeAreaContext.h"
|
|
6
|
+
|
|
7
|
+
namespace rnoh {
|
|
8
|
+
using namespace facebook;
|
|
9
|
+
|
|
10
|
+
RNCSafeAreaContext::RNCSafeAreaContext(const ArkTSTurboModule::Context ctx, const std::string name) : ArkTSTurboModule(ctx, name) {
|
|
11
|
+
methodMap_ = {
|
|
12
|
+
ARK_METHOD_METADATA(getConstants, 0),
|
|
13
|
+
};
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
} // namespace rnoh
|
package/harmony/safe_area/src/main/cpp/generated/RNOH/generated/turbo_modules/RNCSafeAreaContext.h
ADDED
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by "react-native codegen-lib-harmony"
|
|
3
|
+
*/
|
|
4
|
+
|
|
5
|
+
#pragma once
|
|
6
|
+
|
|
7
|
+
#include "RNOH/ArkTSTurboModule.h"
|
|
8
|
+
|
|
9
|
+
namespace rnoh {
|
|
10
|
+
|
|
11
|
+
class JSI_EXPORT RNCSafeAreaContext : public ArkTSTurboModule {
|
|
12
|
+
public:
|
|
13
|
+
RNCSafeAreaContext(const ArkTSTurboModule::Context ctx, const std::string name);
|
|
14
|
+
};
|
|
15
|
+
|
|
16
|
+
} // namespace rnoh
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateComponentDescriptorH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <react/renderer/components/react_native_safe_area_context/ShadowNodes.h>
|
|
14
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
|
+
|
|
16
|
+
namespace facebook {
|
|
17
|
+
namespace react {
|
|
18
|
+
|
|
19
|
+
using RNCSafeAreaProviderComponentDescriptor = ConcreteComponentDescriptor<RNCSafeAreaProviderShadowNode>;
|
|
20
|
+
|
|
21
|
+
using RNCSafeAreaViewComponentDescriptor = ConcreteComponentDescriptor<RNCSafeAreaViewShadowNode>;
|
|
22
|
+
|
|
23
|
+
|
|
24
|
+
} // namespace react
|
|
25
|
+
} // namespace facebook
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateEventEmitterCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include <react/renderer/components/react_native_safe_area_context/EventEmitters.h>
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
namespace facebook {
|
|
15
|
+
namespace react {
|
|
16
|
+
|
|
17
|
+
void RNCSafeAreaViewEventEmitter::onSafeAreaValueChange(OnSafeAreaValueChange $event) const {
|
|
18
|
+
dispatchEvent("safeAreaValueChange", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
19
|
+
auto $payload = jsi::Object(runtime);
|
|
20
|
+
{
|
|
21
|
+
auto safeAreaViewInsetsValue = jsi::Object(runtime);
|
|
22
|
+
safeAreaViewInsetsValue.setProperty(runtime, "top", $event.safeAreaViewInsetsValue.top);
|
|
23
|
+
safeAreaViewInsetsValue.setProperty(runtime, "left", $event.safeAreaViewInsetsValue.left);
|
|
24
|
+
safeAreaViewInsetsValue.setProperty(runtime, "bottom", $event.safeAreaViewInsetsValue.bottom);
|
|
25
|
+
safeAreaViewInsetsValue.setProperty(runtime, "right", $event.safeAreaViewInsetsValue.right);
|
|
26
|
+
$payload.setProperty(runtime, "safeAreaViewInsetsValue", safeAreaViewInsetsValue);
|
|
27
|
+
}
|
|
28
|
+
return $payload;
|
|
29
|
+
});
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
void RNCSafeAreaProviderEventEmitter::onInsetsChange(OnInsetsChange $event) const {
|
|
33
|
+
dispatchEvent("insetsChange", [$event=std::move($event)](jsi::Runtime &runtime) {
|
|
34
|
+
auto $payload = jsi::Object(runtime);
|
|
35
|
+
{
|
|
36
|
+
auto insets = jsi::Object(runtime);
|
|
37
|
+
insets.setProperty(runtime, "top", $event.insets.top);
|
|
38
|
+
insets.setProperty(runtime, "right", $event.insets.right);
|
|
39
|
+
insets.setProperty(runtime, "bottom", $event.insets.bottom);
|
|
40
|
+
insets.setProperty(runtime, "left", $event.insets.left);
|
|
41
|
+
$payload.setProperty(runtime, "insets", insets);
|
|
42
|
+
}
|
|
43
|
+
{
|
|
44
|
+
auto frame = jsi::Object(runtime);
|
|
45
|
+
frame.setProperty(runtime, "x", $event.frame.x);
|
|
46
|
+
frame.setProperty(runtime, "y", $event.frame.y);
|
|
47
|
+
frame.setProperty(runtime, "width", $event.frame.width);
|
|
48
|
+
frame.setProperty(runtime, "height", $event.frame.height);
|
|
49
|
+
$payload.setProperty(runtime, "frame", frame);
|
|
50
|
+
}
|
|
51
|
+
return $payload;
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
} // namespace react
|
|
56
|
+
} // namespace facebook
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateEventEmitterH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <react/renderer/components/view/ViewEventEmitter.h>
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
namespace facebook {
|
|
16
|
+
namespace react {
|
|
17
|
+
class RNCSafeAreaViewEventEmitter : public ViewEventEmitter {
|
|
18
|
+
public:
|
|
19
|
+
using ViewEventEmitter::ViewEventEmitter;
|
|
20
|
+
|
|
21
|
+
struct OnSafeAreaValueChangeSafeAreaViewInsetsValue {
|
|
22
|
+
Float top;
|
|
23
|
+
Float left;
|
|
24
|
+
Float bottom;
|
|
25
|
+
Float right;
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
struct OnSafeAreaValueChange {
|
|
29
|
+
OnSafeAreaValueChangeSafeAreaViewInsetsValue safeAreaViewInsetsValue;
|
|
30
|
+
};
|
|
31
|
+
void onSafeAreaValueChange(OnSafeAreaValueChange value) const;
|
|
32
|
+
};
|
|
33
|
+
|
|
34
|
+
class RNCSafeAreaProviderEventEmitter : public ViewEventEmitter {
|
|
35
|
+
public:
|
|
36
|
+
using ViewEventEmitter::ViewEventEmitter;
|
|
37
|
+
|
|
38
|
+
struct OnInsetsChangeInsets {
|
|
39
|
+
double top;
|
|
40
|
+
double right;
|
|
41
|
+
double bottom;
|
|
42
|
+
double left;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
struct OnInsetsChangeFrame {
|
|
46
|
+
double x;
|
|
47
|
+
double y;
|
|
48
|
+
double width;
|
|
49
|
+
double height;
|
|
50
|
+
};
|
|
51
|
+
|
|
52
|
+
struct OnInsetsChange {
|
|
53
|
+
OnInsetsChangeInsets insets;
|
|
54
|
+
OnInsetsChangeFrame frame;
|
|
55
|
+
};
|
|
56
|
+
void onInsetsChange(OnInsetsChange value) const;
|
|
57
|
+
};
|
|
58
|
+
} // namespace react
|
|
59
|
+
} // namespace facebook
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GeneratePropsCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include <react/renderer/components/react_native_safe_area_context/Props.h>
|
|
12
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
13
|
+
#include <react/renderer/core/propsConversions.h>
|
|
14
|
+
|
|
15
|
+
namespace facebook {
|
|
16
|
+
namespace react {
|
|
17
|
+
|
|
18
|
+
RNCSafeAreaViewProps::RNCSafeAreaViewProps(
|
|
19
|
+
const PropsParserContext &context,
|
|
20
|
+
const RNCSafeAreaViewProps &sourceProps,
|
|
21
|
+
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps),
|
|
22
|
+
|
|
23
|
+
mode(convertRawProp(context, rawProps, "mode", sourceProps.mode, {RNCSafeAreaViewMode::Padding})),
|
|
24
|
+
edges(convertRawProp(context, rawProps, "edges", sourceProps.edges, {})),
|
|
25
|
+
isFirstRefresh(convertRawProp(context, rawProps, "isFirstRefresh", sourceProps.isFirstRefresh, {false}))
|
|
26
|
+
{}
|
|
27
|
+
|
|
28
|
+
|
|
29
|
+
RNCSafeAreaProviderProps::RNCSafeAreaProviderProps(
|
|
30
|
+
const PropsParserContext &context,
|
|
31
|
+
const RNCSafeAreaProviderProps &sourceProps,
|
|
32
|
+
const RawProps &rawProps): ViewProps(context, sourceProps, rawProps)
|
|
33
|
+
{}
|
|
34
|
+
|
|
35
|
+
} // namespace react
|
|
36
|
+
} // namespace facebook
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GeneratePropsH.js
|
|
9
|
+
*/
|
|
10
|
+
#pragma once
|
|
11
|
+
|
|
12
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
13
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
14
|
+
#include <react/renderer/core/propsConversions.h>
|
|
15
|
+
|
|
16
|
+
namespace facebook {
|
|
17
|
+
namespace react {
|
|
18
|
+
|
|
19
|
+
enum class RNCSafeAreaViewMode { Padding, Margin };
|
|
20
|
+
|
|
21
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNCSafeAreaViewMode &result) {
|
|
22
|
+
auto string = (std::string)value;
|
|
23
|
+
if (string == "padding") { result = RNCSafeAreaViewMode::Padding; return; }
|
|
24
|
+
if (string == "margin") { result = RNCSafeAreaViewMode::Margin; return; }
|
|
25
|
+
abort();
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
static inline std::string toString(const RNCSafeAreaViewMode &value) {
|
|
29
|
+
switch (value) {
|
|
30
|
+
case RNCSafeAreaViewMode::Padding: return "padding";
|
|
31
|
+
case RNCSafeAreaViewMode::Margin: return "margin";
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
struct RNCSafeAreaViewEdgesStruct {
|
|
35
|
+
std::string top;
|
|
36
|
+
std::string right;
|
|
37
|
+
std::string bottom;
|
|
38
|
+
std::string left;
|
|
39
|
+
};
|
|
40
|
+
|
|
41
|
+
static inline void fromRawValue(const PropsParserContext& context, const RawValue &value, RNCSafeAreaViewEdgesStruct &result) {
|
|
42
|
+
auto map = (std::unordered_map<std::string, RawValue>)value;
|
|
43
|
+
auto tmp_top = map.find("top");
|
|
44
|
+
if (tmp_top != map.end()) {
|
|
45
|
+
fromRawValue(context, tmp_top->second, result.top);
|
|
46
|
+
}
|
|
47
|
+
auto tmp_right = map.find("right");
|
|
48
|
+
if (tmp_right != map.end()) {
|
|
49
|
+
fromRawValue(context, tmp_right->second, result.right);
|
|
50
|
+
}
|
|
51
|
+
auto tmp_bottom = map.find("bottom");
|
|
52
|
+
if (tmp_bottom != map.end()) {
|
|
53
|
+
fromRawValue(context, tmp_bottom->second, result.bottom);
|
|
54
|
+
}
|
|
55
|
+
auto tmp_left = map.find("left");
|
|
56
|
+
if (tmp_left != map.end()) {
|
|
57
|
+
fromRawValue(context, tmp_left->second, result.left);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
static inline std::string toString(const RNCSafeAreaViewEdgesStruct &value) {
|
|
62
|
+
return "[Object RNCSafeAreaViewEdgesStruct]";
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
class RNCSafeAreaViewProps final : public ViewProps {
|
|
66
|
+
public:
|
|
67
|
+
RNCSafeAreaViewProps() = default;
|
|
68
|
+
RNCSafeAreaViewProps(const PropsParserContext& context, const RNCSafeAreaViewProps &sourceProps, const RawProps &rawProps);
|
|
69
|
+
|
|
70
|
+
#pragma mark - Props
|
|
71
|
+
|
|
72
|
+
RNCSafeAreaViewMode mode{RNCSafeAreaViewMode::Padding};
|
|
73
|
+
RNCSafeAreaViewEdgesStruct edges{};
|
|
74
|
+
bool isFirstRefresh{false};
|
|
75
|
+
};
|
|
76
|
+
|
|
77
|
+
class RNCSafeAreaProviderProps final : public ViewProps {
|
|
78
|
+
public:
|
|
79
|
+
RNCSafeAreaProviderProps() = default;
|
|
80
|
+
RNCSafeAreaProviderProps(const PropsParserContext& context, const RNCSafeAreaProviderProps &sourceProps, const RawProps &rawProps);
|
|
81
|
+
|
|
82
|
+
#pragma mark - Props
|
|
83
|
+
|
|
84
|
+
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
} // namespace react
|
|
88
|
+
} // namespace facebook
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateShadowNodeCpp.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#include <react/renderer/components/react_native_safe_area_context/ShadowNodes.h>
|
|
12
|
+
|
|
13
|
+
namespace facebook {
|
|
14
|
+
namespace react {
|
|
15
|
+
|
|
16
|
+
extern const char RNCSafeAreaProviderComponentName[] = "RNCSafeAreaProvider";
|
|
17
|
+
extern const char RNCSafeAreaViewComponentName[] = "RNCSafeAreaView";
|
|
18
|
+
|
|
19
|
+
} // namespace react
|
|
20
|
+
} // namespace facebook
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateShadowNodeH.js
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
#pragma once
|
|
12
|
+
|
|
13
|
+
#include <react/renderer/components/react_native_safe_area_context/EventEmitters.h>
|
|
14
|
+
#include <react/renderer/components/react_native_safe_area_context/Props.h>
|
|
15
|
+
#include <react/renderer/components/react_native_safe_area_context/States.h>
|
|
16
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
|
+
#include <jsi/jsi.h>
|
|
18
|
+
|
|
19
|
+
namespace facebook {
|
|
20
|
+
namespace react {
|
|
21
|
+
|
|
22
|
+
|
|
23
|
+
JSI_EXPORT extern const char RNCSafeAreaProviderComponentName[];
|
|
24
|
+
JSI_EXPORT extern const char RNCSafeAreaViewComponentName[];
|
|
25
|
+
|
|
26
|
+
/*
|
|
27
|
+
* `ShadowNode` for <RNCSafeAreaProvider> component.
|
|
28
|
+
*/
|
|
29
|
+
using RNCSafeAreaProviderShadowNode =
|
|
30
|
+
ConcreteViewShadowNode<RNCSafeAreaProviderComponentName, RNCSafeAreaProviderProps, RNCSafeAreaProviderEventEmitter>;
|
|
31
|
+
|
|
32
|
+
/*
|
|
33
|
+
* `ShadowNode` for <RNCSafeAreaView> component.
|
|
34
|
+
*/
|
|
35
|
+
using RNCSafeAreaViewShadowNode = ConcreteViewShadowNode<RNCSafeAreaViewComponentName, RNCSafeAreaViewProps,
|
|
36
|
+
RNCSafeAreaViewEventEmitter>;
|
|
37
|
+
|
|
38
|
+
} // namespace react
|
|
39
|
+
} // namespace facebook
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
|
|
2
|
+
/**
|
|
3
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
4
|
+
*
|
|
5
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
6
|
+
* once the code is regenerated.
|
|
7
|
+
*
|
|
8
|
+
* @generated by codegen project: GenerateStateCpp.js
|
|
9
|
+
*/
|
|
10
|
+
#include <react/renderer/components/react_native_safe_area_context/States.h>
|
|
11
|
+
|
|
12
|
+
namespace facebook {
|
|
13
|
+
namespace react {
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
17
|
+
} // namespace react
|
|
18
|
+
} // namespace facebook
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
|
|
3
|
+
*
|
|
4
|
+
* Do not edit this file as changes may cause incorrect behavior and will be lost
|
|
5
|
+
* once the code is regenerated.
|
|
6
|
+
*
|
|
7
|
+
* @generated by codegen project: GenerateStateH.js
|
|
8
|
+
*/
|
|
9
|
+
#pragma once
|
|
10
|
+
|
|
11
|
+
#ifdef ANDROID
|
|
12
|
+
#include <folly/dynamic.h>
|
|
13
|
+
#include <react/renderer/mapbuffer/MapBuffer.h>
|
|
14
|
+
#include <react/renderer/mapbuffer/MapBufferBuilder.h>
|
|
15
|
+
#endif
|
|
16
|
+
|
|
17
|
+
namespace facebook {
|
|
18
|
+
namespace react {
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
|
|
22
|
+
} // namespace react
|
|
23
|
+
} // namespace facebook
|
|
@@ -0,0 +1,64 @@
|
|
|
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
|
+
import hilog from '@ohos.hilog';
|
|
26
|
+
|
|
27
|
+
class Logger {
|
|
28
|
+
private domain: number;
|
|
29
|
+
private prefix: string;
|
|
30
|
+
private format: string = '%{public}s, %{public}s';
|
|
31
|
+
private isDebug: boolean;
|
|
32
|
+
|
|
33
|
+
/**
|
|
34
|
+
* constructor.
|
|
35
|
+
*
|
|
36
|
+
* @param Prefix Identifies the log tag.
|
|
37
|
+
* @param domain Domain Indicates the service domain, which is a hexadecimal integer ranging from 0x0 to 0xFFFFF.
|
|
38
|
+
*/
|
|
39
|
+
constructor(prefix: string = 'MyApp', domain: number = 0xFF00, isDebug = false) {
|
|
40
|
+
this.prefix = prefix;
|
|
41
|
+
this.domain = domain;
|
|
42
|
+
this.isDebug = isDebug;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
debug(...args: string[]): void {
|
|
46
|
+
if (this.isDebug) {
|
|
47
|
+
hilog.debug(this.domain, this.prefix, this.format, args);
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
info(...args: string[]): void {
|
|
52
|
+
hilog.info(this.domain, this.prefix, this.format, args);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
warn(...args: string[]): void {
|
|
56
|
+
hilog.warn(this.domain, this.prefix, this.format, args);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
error(...args: string[]): void {
|
|
60
|
+
hilog.error(this.domain, this.prefix, this.format, args);
|
|
61
|
+
}
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
export default new Logger('[RNOH]SafeAreaProvider', 0xFF00, true)
|