aix 0.6.0 → 0.6.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/ios/EditMenuDefaultActions.swift +70 -0
- package/ios/HybridAix.swift +28 -3
- package/ios/HybridAixCellView.swift +0 -1
- package/ios/HybridAixComposer.swift +82 -0
- package/ios/HybridAixDropzone.swift +104 -0
- package/ios/HybridAixInputWrapper.swift +447 -0
- package/ios/InputType.swift +40 -0
- package/ios/PasteFileManager.swift +92 -0
- package/nitro.json +8 -0
- package/nitrogen/generated/android/Aix+autolinking.cmake +8 -0
- package/nitrogen/generated/android/AixOnLoad.cpp +26 -0
- package/nitrogen/generated/android/c++/JAixInputWrapperOnPasteEvent.hpp +70 -0
- package/nitrogen/generated/android/c++/JFunc_void_std__vector_AixInputWrapperOnPasteEvent_.hpp +98 -0
- package/nitrogen/generated/android/c++/JHybridAixComposerSpec.cpp +9 -0
- package/nitrogen/generated/android/c++/JHybridAixComposerSpec.hpp +2 -0
- package/nitrogen/generated/android/c++/JHybridAixDropzoneSpec.cpp +72 -0
- package/nitrogen/generated/android/c++/JHybridAixDropzoneSpec.hpp +66 -0
- package/nitrogen/generated/android/c++/JHybridAixInputWrapperSpec.cpp +144 -0
- package/nitrogen/generated/android/c++/JHybridAixInputWrapperSpec.hpp +74 -0
- package/nitrogen/generated/android/c++/views/JHybridAixComposerStateUpdater.cpp +4 -0
- package/nitrogen/generated/android/c++/views/JHybridAixDropzoneStateUpdater.cpp +56 -0
- package/nitrogen/generated/android/c++/views/JHybridAixDropzoneStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/c++/views/JHybridAixInputWrapperStateUpdater.cpp +72 -0
- package/nitrogen/generated/android/c++/views/JHybridAixInputWrapperStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/AixInputWrapperOnPasteEvent.kt +47 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/Func_void_std__vector_AixInputWrapperOnPasteEvent_.kt +80 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/HybridAixComposerSpec.kt +6 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/HybridAixDropzoneSpec.kt +67 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/HybridAixInputWrapperSpec.kt +91 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/views/HybridAixDropzoneManager.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/views/HybridAixDropzoneStateUpdater.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/views/HybridAixInputWrapperManager.kt +50 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/aix/views/HybridAixInputWrapperStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/Aix-Swift-Cxx-Bridge.cpp +42 -0
- package/nitrogen/generated/ios/Aix-Swift-Cxx-Bridge.hpp +112 -0
- package/nitrogen/generated/ios/Aix-Swift-Cxx-Umbrella.hpp +14 -0
- package/nitrogen/generated/ios/AixAutolinking.mm +16 -0
- package/nitrogen/generated/ios/AixAutolinking.swift +30 -0
- package/nitrogen/generated/ios/c++/HybridAixComposerSpecSwift.hpp +7 -0
- package/nitrogen/generated/ios/c++/HybridAixDropzoneSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridAixDropzoneSpecSwift.hpp +80 -0
- package/nitrogen/generated/ios/c++/HybridAixInputWrapperSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridAixInputWrapperSpecSwift.hpp +108 -0
- package/nitrogen/generated/ios/c++/views/HybridAixComposerComponent.mm +5 -0
- package/nitrogen/generated/ios/c++/views/HybridAixDropzoneComponent.mm +96 -0
- package/nitrogen/generated/ios/c++/views/HybridAixInputWrapperComponent.mm +116 -0
- package/nitrogen/generated/ios/swift/AixInputWrapperOnPasteEvent.swift +107 -0
- package/nitrogen/generated/ios/swift/Func_void_std__vector_AixInputWrapperOnPasteEvent_.swift +47 -0
- package/nitrogen/generated/ios/swift/HybridAixComposerSpec.swift +1 -0
- package/nitrogen/generated/ios/swift/HybridAixComposerSpec_cxx.swift +24 -0
- package/nitrogen/generated/ios/swift/HybridAixDropzoneSpec.swift +56 -0
- package/nitrogen/generated/ios/swift/HybridAixDropzoneSpec_cxx.swift +167 -0
- package/nitrogen/generated/ios/swift/HybridAixInputWrapperSpec.swift +60 -0
- package/nitrogen/generated/ios/swift/HybridAixInputWrapperSpec_cxx.swift +261 -0
- package/nitrogen/generated/shared/c++/AixInputWrapperOnPasteEvent.hpp +88 -0
- package/nitrogen/generated/shared/c++/HybridAixComposerSpec.cpp +2 -0
- package/nitrogen/generated/shared/c++/HybridAixComposerSpec.hpp +2 -0
- package/nitrogen/generated/shared/c++/HybridAixDropzoneSpec.cpp +22 -0
- package/nitrogen/generated/shared/c++/HybridAixDropzoneSpec.hpp +67 -0
- package/nitrogen/generated/shared/c++/HybridAixInputWrapperSpec.cpp +30 -0
- package/nitrogen/generated/shared/c++/HybridAixInputWrapperSpec.hpp +76 -0
- package/nitrogen/generated/shared/c++/views/HybridAixComposerComponent.cpp +12 -0
- package/nitrogen/generated/shared/c++/views/HybridAixComposerComponent.hpp +1 -0
- package/nitrogen/generated/shared/c++/views/HybridAixDropzoneComponent.cpp +87 -0
- package/nitrogen/generated/shared/c++/views/HybridAixDropzoneComponent.hpp +109 -0
- package/nitrogen/generated/shared/c++/views/HybridAixInputWrapperComponent.cpp +135 -0
- package/nitrogen/generated/shared/c++/views/HybridAixInputWrapperComponent.hpp +114 -0
- package/nitrogen/generated/shared/json/AixComposerConfig.json +1 -0
- package/nitrogen/generated/shared/json/AixDropzoneConfig.json +10 -0
- package/nitrogen/generated/shared/json/AixInputWrapperConfig.json +14 -0
- package/package.json +1 -1
- package/src/dropzone.ios.tsx +27 -0
- package/src/dropzone.tsx +10 -0
- package/src/index.ts +3 -0
- package/src/input-wrapper.ios.tsx +30 -0
- package/src/input-wrapper.tsx +17 -0
- package/src/views/aix.nitro.ts +33 -19
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridAixDropzoneComponent.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridAixDropzoneComponent.hpp"
|
|
9
|
+
|
|
10
|
+
#include <string>
|
|
11
|
+
#include <exception>
|
|
12
|
+
#include <utility>
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
15
|
+
#include <react/renderer/core/RawValue.h>
|
|
16
|
+
#include <react/renderer/core/ShadowNode.h>
|
|
17
|
+
#include <react/renderer/core/ComponentDescriptor.h>
|
|
18
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
19
|
+
|
|
20
|
+
namespace margelo::nitro::aix::views {
|
|
21
|
+
|
|
22
|
+
extern const char HybridAixDropzoneComponentName[] = "AixDropzone";
|
|
23
|
+
|
|
24
|
+
HybridAixDropzoneProps::HybridAixDropzoneProps(const react::PropsParserContext& context,
|
|
25
|
+
const HybridAixDropzoneProps& sourceProps,
|
|
26
|
+
const react::RawProps& rawProps):
|
|
27
|
+
react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
|
|
28
|
+
onDrop([&]() -> CachedProp<std::optional<std::function<void(const std::vector<AixInputWrapperOnPasteEvent>& /* events */)>>> {
|
|
29
|
+
try {
|
|
30
|
+
const react::RawValue* rawValue = rawProps.at("onDrop", nullptr, nullptr);
|
|
31
|
+
if (rawValue == nullptr) return sourceProps.onDrop;
|
|
32
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
33
|
+
return CachedProp<std::optional<std::function<void(const std::vector<AixInputWrapperOnPasteEvent>& /* events */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onDrop);
|
|
34
|
+
} catch (const std::exception& exc) {
|
|
35
|
+
throw std::runtime_error(std::string("AixDropzone.onDrop: ") + exc.what());
|
|
36
|
+
}
|
|
37
|
+
}()),
|
|
38
|
+
hybridRef([&]() -> CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridAixDropzoneSpec>& /* ref */)>>> {
|
|
39
|
+
try {
|
|
40
|
+
const react::RawValue* rawValue = rawProps.at("hybridRef", nullptr, nullptr);
|
|
41
|
+
if (rawValue == nullptr) return sourceProps.hybridRef;
|
|
42
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
43
|
+
return CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridAixDropzoneSpec>& /* ref */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.hybridRef);
|
|
44
|
+
} catch (const std::exception& exc) {
|
|
45
|
+
throw std::runtime_error(std::string("AixDropzone.hybridRef: ") + exc.what());
|
|
46
|
+
}
|
|
47
|
+
}()) { }
|
|
48
|
+
|
|
49
|
+
HybridAixDropzoneProps::HybridAixDropzoneProps(const HybridAixDropzoneProps& other):
|
|
50
|
+
react::ViewProps(),
|
|
51
|
+
onDrop(other.onDrop),
|
|
52
|
+
hybridRef(other.hybridRef) { }
|
|
53
|
+
|
|
54
|
+
bool HybridAixDropzoneProps::filterObjectKeys(const std::string& propName) {
|
|
55
|
+
switch (hashString(propName)) {
|
|
56
|
+
case hashString("onDrop"): return true;
|
|
57
|
+
case hashString("hybridRef"): return true;
|
|
58
|
+
default: return false;
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
HybridAixDropzoneComponentDescriptor::HybridAixDropzoneComponentDescriptor(const react::ComponentDescriptorParameters& parameters)
|
|
63
|
+
: ConcreteComponentDescriptor(parameters,
|
|
64
|
+
react::RawPropsParser(/* enableJsiParser */ true)) {}
|
|
65
|
+
|
|
66
|
+
std::shared_ptr<const react::Props> HybridAixDropzoneComponentDescriptor::cloneProps(const react::PropsParserContext& context,
|
|
67
|
+
const std::shared_ptr<const react::Props>& props,
|
|
68
|
+
react::RawProps rawProps) const {
|
|
69
|
+
// 1. Prepare raw props parser
|
|
70
|
+
rawProps.parse(rawPropsParser_);
|
|
71
|
+
// 2. Copy props with Nitro's cached copy constructor
|
|
72
|
+
return HybridAixDropzoneShadowNode::Props(context, /* & */ rawProps, props);
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
#ifdef ANDROID
|
|
76
|
+
void HybridAixDropzoneComponentDescriptor::adopt(react::ShadowNode& shadowNode) const {
|
|
77
|
+
// This is called immediately after `ShadowNode` is created, cloned or in progress.
|
|
78
|
+
// On Android, we need to wrap props in our state, which gets routed through Java and later unwrapped in JNI/C++.
|
|
79
|
+
auto& concreteShadowNode = dynamic_cast<HybridAixDropzoneShadowNode&>(shadowNode);
|
|
80
|
+
const HybridAixDropzoneProps& props = concreteShadowNode.getConcreteProps();
|
|
81
|
+
HybridAixDropzoneState state;
|
|
82
|
+
state.setProps(props);
|
|
83
|
+
concreteShadowNode.setStateData(std::move(state));
|
|
84
|
+
}
|
|
85
|
+
#endif
|
|
86
|
+
|
|
87
|
+
} // namespace margelo::nitro::aix::views
|
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridAixDropzoneComponent.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <optional>
|
|
11
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
12
|
+
#include <NitroModules/NitroHash.hpp>
|
|
13
|
+
#include <NitroModules/CachedProp.hpp>
|
|
14
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
16
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
18
|
+
|
|
19
|
+
#include "AixInputWrapperOnPasteEvent.hpp"
|
|
20
|
+
#include <vector>
|
|
21
|
+
#include <functional>
|
|
22
|
+
#include <optional>
|
|
23
|
+
#include <memory>
|
|
24
|
+
#include "HybridAixDropzoneSpec.hpp"
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::aix::views {
|
|
27
|
+
|
|
28
|
+
using namespace facebook;
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* The name of the actual native View.
|
|
32
|
+
*/
|
|
33
|
+
extern const char HybridAixDropzoneComponentName[];
|
|
34
|
+
|
|
35
|
+
/**
|
|
36
|
+
* Props for the "AixDropzone" View.
|
|
37
|
+
*/
|
|
38
|
+
class HybridAixDropzoneProps final: public react::ViewProps {
|
|
39
|
+
public:
|
|
40
|
+
HybridAixDropzoneProps() = default;
|
|
41
|
+
HybridAixDropzoneProps(const HybridAixDropzoneProps&);
|
|
42
|
+
HybridAixDropzoneProps(const react::PropsParserContext& context,
|
|
43
|
+
const HybridAixDropzoneProps& sourceProps,
|
|
44
|
+
const react::RawProps& rawProps);
|
|
45
|
+
|
|
46
|
+
public:
|
|
47
|
+
CachedProp<std::optional<std::function<void(const std::vector<AixInputWrapperOnPasteEvent>& /* events */)>>> onDrop;
|
|
48
|
+
CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridAixDropzoneSpec>& /* ref */)>>> hybridRef;
|
|
49
|
+
|
|
50
|
+
private:
|
|
51
|
+
static bool filterObjectKeys(const std::string& propName);
|
|
52
|
+
};
|
|
53
|
+
|
|
54
|
+
/**
|
|
55
|
+
* State for the "AixDropzone" View.
|
|
56
|
+
*/
|
|
57
|
+
class HybridAixDropzoneState final {
|
|
58
|
+
public:
|
|
59
|
+
HybridAixDropzoneState() = default;
|
|
60
|
+
|
|
61
|
+
public:
|
|
62
|
+
void setProps(const HybridAixDropzoneProps& props) { _props.emplace(props); }
|
|
63
|
+
const std::optional<HybridAixDropzoneProps>& getProps() const { return _props; }
|
|
64
|
+
|
|
65
|
+
public:
|
|
66
|
+
#ifdef ANDROID
|
|
67
|
+
HybridAixDropzoneState(const HybridAixDropzoneState& /* previousState */, folly::dynamic /* data */) {}
|
|
68
|
+
folly::dynamic getDynamic() const {
|
|
69
|
+
throw std::runtime_error("HybridAixDropzoneState does not support folly!");
|
|
70
|
+
}
|
|
71
|
+
react::MapBuffer getMapBuffer() const {
|
|
72
|
+
throw std::runtime_error("HybridAixDropzoneState does not support MapBuffer!");
|
|
73
|
+
};
|
|
74
|
+
#endif
|
|
75
|
+
|
|
76
|
+
private:
|
|
77
|
+
std::optional<HybridAixDropzoneProps> _props;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
/**
|
|
81
|
+
* The Shadow Node for the "AixDropzone" View.
|
|
82
|
+
*/
|
|
83
|
+
using HybridAixDropzoneShadowNode = react::ConcreteViewShadowNode<HybridAixDropzoneComponentName /* "HybridAixDropzone" */,
|
|
84
|
+
HybridAixDropzoneProps /* custom props */,
|
|
85
|
+
react::ViewEventEmitter /* default */,
|
|
86
|
+
HybridAixDropzoneState /* custom state */>;
|
|
87
|
+
|
|
88
|
+
/**
|
|
89
|
+
* The Component Descriptor for the "AixDropzone" View.
|
|
90
|
+
*/
|
|
91
|
+
class HybridAixDropzoneComponentDescriptor final: public react::ConcreteComponentDescriptor<HybridAixDropzoneShadowNode> {
|
|
92
|
+
public:
|
|
93
|
+
HybridAixDropzoneComponentDescriptor(const react::ComponentDescriptorParameters& parameters);
|
|
94
|
+
|
|
95
|
+
public:
|
|
96
|
+
/**
|
|
97
|
+
* A faster path for cloning props - reuses the caching logic from `HybridAixDropzoneProps`.
|
|
98
|
+
*/
|
|
99
|
+
std::shared_ptr<const react::Props> cloneProps(const react::PropsParserContext& context,
|
|
100
|
+
const std::shared_ptr<const react::Props>& props,
|
|
101
|
+
react::RawProps rawProps) const override;
|
|
102
|
+
#ifdef ANDROID
|
|
103
|
+
void adopt(react::ShadowNode& shadowNode) const override;
|
|
104
|
+
#endif
|
|
105
|
+
};
|
|
106
|
+
|
|
107
|
+
/* The actual view for "AixDropzone" needs to be implemented in platform-specific code. */
|
|
108
|
+
|
|
109
|
+
} // namespace margelo::nitro::aix::views
|
|
@@ -0,0 +1,135 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridAixInputWrapperComponent.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridAixInputWrapperComponent.hpp"
|
|
9
|
+
|
|
10
|
+
#include <string>
|
|
11
|
+
#include <exception>
|
|
12
|
+
#include <utility>
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
15
|
+
#include <react/renderer/core/RawValue.h>
|
|
16
|
+
#include <react/renderer/core/ShadowNode.h>
|
|
17
|
+
#include <react/renderer/core/ComponentDescriptor.h>
|
|
18
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
19
|
+
|
|
20
|
+
namespace margelo::nitro::aix::views {
|
|
21
|
+
|
|
22
|
+
extern const char HybridAixInputWrapperComponentName[] = "AixInputWrapper";
|
|
23
|
+
|
|
24
|
+
HybridAixInputWrapperProps::HybridAixInputWrapperProps(const react::PropsParserContext& context,
|
|
25
|
+
const HybridAixInputWrapperProps& sourceProps,
|
|
26
|
+
const react::RawProps& rawProps):
|
|
27
|
+
react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
|
|
28
|
+
pasteConfiguration([&]() -> CachedProp<std::optional<std::vector<std::string>>> {
|
|
29
|
+
try {
|
|
30
|
+
const react::RawValue* rawValue = rawProps.at("pasteConfiguration", nullptr, nullptr);
|
|
31
|
+
if (rawValue == nullptr) return sourceProps.pasteConfiguration;
|
|
32
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
33
|
+
return CachedProp<std::optional<std::vector<std::string>>>::fromRawValue(*runtime, value, sourceProps.pasteConfiguration);
|
|
34
|
+
} catch (const std::exception& exc) {
|
|
35
|
+
throw std::runtime_error(std::string("AixInputWrapper.pasteConfiguration: ") + exc.what());
|
|
36
|
+
}
|
|
37
|
+
}()),
|
|
38
|
+
editMenuDefaultActions([&]() -> CachedProp<std::optional<std::vector<std::string>>> {
|
|
39
|
+
try {
|
|
40
|
+
const react::RawValue* rawValue = rawProps.at("editMenuDefaultActions", nullptr, nullptr);
|
|
41
|
+
if (rawValue == nullptr) return sourceProps.editMenuDefaultActions;
|
|
42
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
43
|
+
return CachedProp<std::optional<std::vector<std::string>>>::fromRawValue(*runtime, value, sourceProps.editMenuDefaultActions);
|
|
44
|
+
} catch (const std::exception& exc) {
|
|
45
|
+
throw std::runtime_error(std::string("AixInputWrapper.editMenuDefaultActions: ") + exc.what());
|
|
46
|
+
}
|
|
47
|
+
}()),
|
|
48
|
+
maxLines([&]() -> CachedProp<std::optional<double>> {
|
|
49
|
+
try {
|
|
50
|
+
const react::RawValue* rawValue = rawProps.at("maxLines", nullptr, nullptr);
|
|
51
|
+
if (rawValue == nullptr) return sourceProps.maxLines;
|
|
52
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
53
|
+
return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.maxLines);
|
|
54
|
+
} catch (const std::exception& exc) {
|
|
55
|
+
throw std::runtime_error(std::string("AixInputWrapper.maxLines: ") + exc.what());
|
|
56
|
+
}
|
|
57
|
+
}()),
|
|
58
|
+
maxChars([&]() -> CachedProp<std::optional<double>> {
|
|
59
|
+
try {
|
|
60
|
+
const react::RawValue* rawValue = rawProps.at("maxChars", nullptr, nullptr);
|
|
61
|
+
if (rawValue == nullptr) return sourceProps.maxChars;
|
|
62
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
63
|
+
return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.maxChars);
|
|
64
|
+
} catch (const std::exception& exc) {
|
|
65
|
+
throw std::runtime_error(std::string("AixInputWrapper.maxChars: ") + exc.what());
|
|
66
|
+
}
|
|
67
|
+
}()),
|
|
68
|
+
onPaste([&]() -> CachedProp<std::optional<std::function<void(const std::vector<AixInputWrapperOnPasteEvent>& /* events */)>>> {
|
|
69
|
+
try {
|
|
70
|
+
const react::RawValue* rawValue = rawProps.at("onPaste", nullptr, nullptr);
|
|
71
|
+
if (rawValue == nullptr) return sourceProps.onPaste;
|
|
72
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
73
|
+
return CachedProp<std::optional<std::function<void(const std::vector<AixInputWrapperOnPasteEvent>& /* events */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.onPaste);
|
|
74
|
+
} catch (const std::exception& exc) {
|
|
75
|
+
throw std::runtime_error(std::string("AixInputWrapper.onPaste: ") + exc.what());
|
|
76
|
+
}
|
|
77
|
+
}()),
|
|
78
|
+
hybridRef([&]() -> CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridAixInputWrapperSpec>& /* ref */)>>> {
|
|
79
|
+
try {
|
|
80
|
+
const react::RawValue* rawValue = rawProps.at("hybridRef", nullptr, nullptr);
|
|
81
|
+
if (rawValue == nullptr) return sourceProps.hybridRef;
|
|
82
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
83
|
+
return CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridAixInputWrapperSpec>& /* ref */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, "f"), sourceProps.hybridRef);
|
|
84
|
+
} catch (const std::exception& exc) {
|
|
85
|
+
throw std::runtime_error(std::string("AixInputWrapper.hybridRef: ") + exc.what());
|
|
86
|
+
}
|
|
87
|
+
}()) { }
|
|
88
|
+
|
|
89
|
+
HybridAixInputWrapperProps::HybridAixInputWrapperProps(const HybridAixInputWrapperProps& other):
|
|
90
|
+
react::ViewProps(),
|
|
91
|
+
pasteConfiguration(other.pasteConfiguration),
|
|
92
|
+
editMenuDefaultActions(other.editMenuDefaultActions),
|
|
93
|
+
maxLines(other.maxLines),
|
|
94
|
+
maxChars(other.maxChars),
|
|
95
|
+
onPaste(other.onPaste),
|
|
96
|
+
hybridRef(other.hybridRef) { }
|
|
97
|
+
|
|
98
|
+
bool HybridAixInputWrapperProps::filterObjectKeys(const std::string& propName) {
|
|
99
|
+
switch (hashString(propName)) {
|
|
100
|
+
case hashString("pasteConfiguration"): return true;
|
|
101
|
+
case hashString("editMenuDefaultActions"): return true;
|
|
102
|
+
case hashString("maxLines"): return true;
|
|
103
|
+
case hashString("maxChars"): return true;
|
|
104
|
+
case hashString("onPaste"): return true;
|
|
105
|
+
case hashString("hybridRef"): return true;
|
|
106
|
+
default: return false;
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
HybridAixInputWrapperComponentDescriptor::HybridAixInputWrapperComponentDescriptor(const react::ComponentDescriptorParameters& parameters)
|
|
111
|
+
: ConcreteComponentDescriptor(parameters,
|
|
112
|
+
react::RawPropsParser(/* enableJsiParser */ true)) {}
|
|
113
|
+
|
|
114
|
+
std::shared_ptr<const react::Props> HybridAixInputWrapperComponentDescriptor::cloneProps(const react::PropsParserContext& context,
|
|
115
|
+
const std::shared_ptr<const react::Props>& props,
|
|
116
|
+
react::RawProps rawProps) const {
|
|
117
|
+
// 1. Prepare raw props parser
|
|
118
|
+
rawProps.parse(rawPropsParser_);
|
|
119
|
+
// 2. Copy props with Nitro's cached copy constructor
|
|
120
|
+
return HybridAixInputWrapperShadowNode::Props(context, /* & */ rawProps, props);
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
#ifdef ANDROID
|
|
124
|
+
void HybridAixInputWrapperComponentDescriptor::adopt(react::ShadowNode& shadowNode) const {
|
|
125
|
+
// This is called immediately after `ShadowNode` is created, cloned or in progress.
|
|
126
|
+
// On Android, we need to wrap props in our state, which gets routed through Java and later unwrapped in JNI/C++.
|
|
127
|
+
auto& concreteShadowNode = dynamic_cast<HybridAixInputWrapperShadowNode&>(shadowNode);
|
|
128
|
+
const HybridAixInputWrapperProps& props = concreteShadowNode.getConcreteProps();
|
|
129
|
+
HybridAixInputWrapperState state;
|
|
130
|
+
state.setProps(props);
|
|
131
|
+
concreteShadowNode.setStateData(std::move(state));
|
|
132
|
+
}
|
|
133
|
+
#endif
|
|
134
|
+
|
|
135
|
+
} // namespace margelo::nitro::aix::views
|
|
@@ -0,0 +1,114 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridAixInputWrapperComponent.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 2026 Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#include <optional>
|
|
11
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
12
|
+
#include <NitroModules/NitroHash.hpp>
|
|
13
|
+
#include <NitroModules/CachedProp.hpp>
|
|
14
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
15
|
+
#include <react/renderer/core/PropsParserContext.h>
|
|
16
|
+
#include <react/renderer/components/view/ConcreteViewShadowNode.h>
|
|
17
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
18
|
+
|
|
19
|
+
#include <string>
|
|
20
|
+
#include <vector>
|
|
21
|
+
#include <optional>
|
|
22
|
+
#include "AixInputWrapperOnPasteEvent.hpp"
|
|
23
|
+
#include <functional>
|
|
24
|
+
#include <memory>
|
|
25
|
+
#include "HybridAixInputWrapperSpec.hpp"
|
|
26
|
+
|
|
27
|
+
namespace margelo::nitro::aix::views {
|
|
28
|
+
|
|
29
|
+
using namespace facebook;
|
|
30
|
+
|
|
31
|
+
/**
|
|
32
|
+
* The name of the actual native View.
|
|
33
|
+
*/
|
|
34
|
+
extern const char HybridAixInputWrapperComponentName[];
|
|
35
|
+
|
|
36
|
+
/**
|
|
37
|
+
* Props for the "AixInputWrapper" View.
|
|
38
|
+
*/
|
|
39
|
+
class HybridAixInputWrapperProps final: public react::ViewProps {
|
|
40
|
+
public:
|
|
41
|
+
HybridAixInputWrapperProps() = default;
|
|
42
|
+
HybridAixInputWrapperProps(const HybridAixInputWrapperProps&);
|
|
43
|
+
HybridAixInputWrapperProps(const react::PropsParserContext& context,
|
|
44
|
+
const HybridAixInputWrapperProps& sourceProps,
|
|
45
|
+
const react::RawProps& rawProps);
|
|
46
|
+
|
|
47
|
+
public:
|
|
48
|
+
CachedProp<std::optional<std::vector<std::string>>> pasteConfiguration;
|
|
49
|
+
CachedProp<std::optional<std::vector<std::string>>> editMenuDefaultActions;
|
|
50
|
+
CachedProp<std::optional<double>> maxLines;
|
|
51
|
+
CachedProp<std::optional<double>> maxChars;
|
|
52
|
+
CachedProp<std::optional<std::function<void(const std::vector<AixInputWrapperOnPasteEvent>& /* events */)>>> onPaste;
|
|
53
|
+
CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridAixInputWrapperSpec>& /* ref */)>>> hybridRef;
|
|
54
|
+
|
|
55
|
+
private:
|
|
56
|
+
static bool filterObjectKeys(const std::string& propName);
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
/**
|
|
60
|
+
* State for the "AixInputWrapper" View.
|
|
61
|
+
*/
|
|
62
|
+
class HybridAixInputWrapperState final {
|
|
63
|
+
public:
|
|
64
|
+
HybridAixInputWrapperState() = default;
|
|
65
|
+
|
|
66
|
+
public:
|
|
67
|
+
void setProps(const HybridAixInputWrapperProps& props) { _props.emplace(props); }
|
|
68
|
+
const std::optional<HybridAixInputWrapperProps>& getProps() const { return _props; }
|
|
69
|
+
|
|
70
|
+
public:
|
|
71
|
+
#ifdef ANDROID
|
|
72
|
+
HybridAixInputWrapperState(const HybridAixInputWrapperState& /* previousState */, folly::dynamic /* data */) {}
|
|
73
|
+
folly::dynamic getDynamic() const {
|
|
74
|
+
throw std::runtime_error("HybridAixInputWrapperState does not support folly!");
|
|
75
|
+
}
|
|
76
|
+
react::MapBuffer getMapBuffer() const {
|
|
77
|
+
throw std::runtime_error("HybridAixInputWrapperState does not support MapBuffer!");
|
|
78
|
+
};
|
|
79
|
+
#endif
|
|
80
|
+
|
|
81
|
+
private:
|
|
82
|
+
std::optional<HybridAixInputWrapperProps> _props;
|
|
83
|
+
};
|
|
84
|
+
|
|
85
|
+
/**
|
|
86
|
+
* The Shadow Node for the "AixInputWrapper" View.
|
|
87
|
+
*/
|
|
88
|
+
using HybridAixInputWrapperShadowNode = react::ConcreteViewShadowNode<HybridAixInputWrapperComponentName /* "HybridAixInputWrapper" */,
|
|
89
|
+
HybridAixInputWrapperProps /* custom props */,
|
|
90
|
+
react::ViewEventEmitter /* default */,
|
|
91
|
+
HybridAixInputWrapperState /* custom state */>;
|
|
92
|
+
|
|
93
|
+
/**
|
|
94
|
+
* The Component Descriptor for the "AixInputWrapper" View.
|
|
95
|
+
*/
|
|
96
|
+
class HybridAixInputWrapperComponentDescriptor final: public react::ConcreteComponentDescriptor<HybridAixInputWrapperShadowNode> {
|
|
97
|
+
public:
|
|
98
|
+
HybridAixInputWrapperComponentDescriptor(const react::ComponentDescriptorParameters& parameters);
|
|
99
|
+
|
|
100
|
+
public:
|
|
101
|
+
/**
|
|
102
|
+
* A faster path for cloning props - reuses the caching logic from `HybridAixInputWrapperProps`.
|
|
103
|
+
*/
|
|
104
|
+
std::shared_ptr<const react::Props> cloneProps(const react::PropsParserContext& context,
|
|
105
|
+
const std::shared_ptr<const react::Props>& props,
|
|
106
|
+
react::RawProps rawProps) const override;
|
|
107
|
+
#ifdef ANDROID
|
|
108
|
+
void adopt(react::ShadowNode& shadowNode) const override;
|
|
109
|
+
#endif
|
|
110
|
+
};
|
|
111
|
+
|
|
112
|
+
/* The actual view for "AixInputWrapper" needs to be implemented in platform-specific code. */
|
|
113
|
+
|
|
114
|
+
} // namespace margelo::nitro::aix::views
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"uiViewClassName": "AixInputWrapper",
|
|
3
|
+
"supportsRawText": false,
|
|
4
|
+
"bubblingEventTypes": {},
|
|
5
|
+
"directEventTypes": {},
|
|
6
|
+
"validAttributes": {
|
|
7
|
+
"pasteConfiguration": true,
|
|
8
|
+
"editMenuDefaultActions": true,
|
|
9
|
+
"maxLines": true,
|
|
10
|
+
"maxChars": true,
|
|
11
|
+
"onPaste": true,
|
|
12
|
+
"hybridRef": true
|
|
13
|
+
}
|
|
14
|
+
}
|
package/package.json
CHANGED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { callback, getHostComponent } from 'react-native-nitro-modules'
|
|
2
|
+
import AixDropzoneConfig from '../nitrogen/generated/shared/json/AixDropzoneConfig.json'
|
|
3
|
+
import type { AixDropzoneProps, AixInputWrapperOnPasteEvent } from './views/aix.nitro'
|
|
4
|
+
import type { ComponentProps } from 'react'
|
|
5
|
+
|
|
6
|
+
const AixDropzoneInternal = getHostComponent<AixDropzoneProps, {}>(
|
|
7
|
+
'AixDropzone',
|
|
8
|
+
() => AixDropzoneConfig,
|
|
9
|
+
)
|
|
10
|
+
|
|
11
|
+
type AixDropzoneComponentProps = Omit<
|
|
12
|
+
ComponentProps<typeof AixDropzoneInternal>,
|
|
13
|
+
'onDrop' | 'hybridRef'
|
|
14
|
+
> & {
|
|
15
|
+
onDrop?: (events: AixInputWrapperOnPasteEvent[]) => void
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export function AixDropzone(props: AixDropzoneComponentProps) {
|
|
19
|
+
return (
|
|
20
|
+
<AixDropzoneInternal
|
|
21
|
+
{...props}
|
|
22
|
+
onDrop={props.onDrop ? callback(props.onDrop) : undefined}
|
|
23
|
+
>
|
|
24
|
+
{props.children}
|
|
25
|
+
</AixDropzoneInternal>
|
|
26
|
+
)
|
|
27
|
+
}
|
package/src/dropzone.tsx
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react'
|
|
2
|
+
import type { AixInputWrapperOnPasteEvent } from './views/aix.nitro'
|
|
3
|
+
|
|
4
|
+
export type AixDropzoneComponentProps = PropsWithChildren<{
|
|
5
|
+
onDrop?: (events: AixInputWrapperOnPasteEvent[]) => void
|
|
6
|
+
}>
|
|
7
|
+
|
|
8
|
+
export function AixDropzone(props: AixDropzoneComponentProps) {
|
|
9
|
+
return <>{props.children}</>
|
|
10
|
+
}
|
package/src/index.ts
CHANGED
|
@@ -7,6 +7,9 @@ export * from './fade-in'
|
|
|
7
7
|
|
|
8
8
|
export { Aix, type AixRef } from './aix'
|
|
9
9
|
export { AixFooter } from './footer'
|
|
10
|
+
export { AixInputWrapper } from './input-wrapper'
|
|
11
|
+
export { AixDropzone } from './dropzone'
|
|
12
|
+
export type { AixInputWrapperOnPasteEvent } from './views/aix.nitro'
|
|
10
13
|
export { useContentInsetHandler } from './hooks/useContentInsetHandler'
|
|
11
14
|
export type { AixContentInsets } from './views/aix.nitro'
|
|
12
15
|
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { callback, getHostComponent } from 'react-native-nitro-modules'
|
|
2
|
+
import AixInputWrapperConfig from '../nitrogen/generated/shared/json/AixInputWrapperConfig.json'
|
|
3
|
+
import type {
|
|
4
|
+
AixInputWrapperProps,
|
|
5
|
+
AixInputWrapperOnPasteEvent,
|
|
6
|
+
} from './views/aix.nitro'
|
|
7
|
+
import type { ComponentProps } from 'react'
|
|
8
|
+
|
|
9
|
+
const AixInputWrapperInternal = getHostComponent<AixInputWrapperProps, {}>(
|
|
10
|
+
'AixInputWrapper',
|
|
11
|
+
() => AixInputWrapperConfig
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
type AixInputWrapperComponentProps = Omit<
|
|
15
|
+
ComponentProps<typeof AixInputWrapperInternal>,
|
|
16
|
+
'onPaste' | 'hybridRef'
|
|
17
|
+
> & {
|
|
18
|
+
onPaste?: (events: AixInputWrapperOnPasteEvent[]) => void
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
export function AixInputWrapper(props: AixInputWrapperComponentProps) {
|
|
22
|
+
return (
|
|
23
|
+
<AixInputWrapperInternal
|
|
24
|
+
{...props}
|
|
25
|
+
onPaste={props.onPaste ? callback(props.onPaste) : undefined}
|
|
26
|
+
>
|
|
27
|
+
{props.children}
|
|
28
|
+
</AixInputWrapperInternal>
|
|
29
|
+
)
|
|
30
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react'
|
|
2
|
+
import type { ViewProps } from 'react-native'
|
|
3
|
+
import type {
|
|
4
|
+
AixInputWrapperOnPasteEvent,
|
|
5
|
+
AixInputWrapperProps,
|
|
6
|
+
} from './views/aix.nitro'
|
|
7
|
+
|
|
8
|
+
type AixInputWrapperComponentProps = PropsWithChildren<
|
|
9
|
+
ViewProps &
|
|
10
|
+
Omit<AixInputWrapperProps, 'onPaste'> & {
|
|
11
|
+
onPaste?: (events: AixInputWrapperOnPasteEvent[]) => void
|
|
12
|
+
}
|
|
13
|
+
>
|
|
14
|
+
|
|
15
|
+
export function AixInputWrapper(props: AixInputWrapperComponentProps) {
|
|
16
|
+
return <>{props.children}</>
|
|
17
|
+
}
|