@whetware/react-native-stroke-text 0.0.2
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/CHANGELOG.md +7 -0
- package/LICENSE.md +21 -0
- package/NitroStrokeText.podspec +31 -0
- package/README.md +45 -0
- package/android/CMakeLists.txt +29 -0
- package/android/build.gradle +142 -0
- package/android/fix-prefab.gradle +51 -0
- package/android/gradle.properties +5 -0
- package/android/src/main/AndroidManifest.xml +2 -0
- package/android/src/main/cpp/cpp-adapter.cpp +6 -0
- package/android/src/main/java/com/margelo/nitro/stroketext/HybridStrokeTextView.kt +107 -0
- package/android/src/main/java/com/margelo/nitro/stroketext/NitroStrokeTextPackage.kt +39 -0
- package/android/src/main/java/com/margelo/nitro/stroketext/StrokeTextView.kt +429 -0
- package/ios/Bridge.h +8 -0
- package/ios/HybridStrokeTextView.swift +114 -0
- package/ios/StrokeTextColor.swift +120 -0
- package/ios/StrokeTextView.swift +326 -0
- package/ios/StrokedTextLabel.swift +72 -0
- package/lib/StrokeText.d.ts +3 -0
- package/lib/StrokeText.js +109 -0
- package/lib/StrokeText.web.d.ts +3 -0
- package/lib/StrokeText.web.js +106 -0
- package/lib/index.d.ts +2 -0
- package/lib/index.js +1 -0
- package/lib/index.web.d.ts +2 -0
- package/lib/index.web.js +1 -0
- package/lib/specs/StrokeTextView.nitro.d.ts +37 -0
- package/lib/specs/StrokeTextView.nitro.js +1 -0
- package/lib/types.d.ts +17 -0
- package/lib/types.js +1 -0
- package/nitro.json +24 -0
- package/nitrogen/generated/.gitattributes +1 -0
- package/nitrogen/generated/android/NitroStrokeText+autolinking.cmake +83 -0
- package/nitrogen/generated/android/NitroStrokeText+autolinking.gradle +27 -0
- package/nitrogen/generated/android/NitroStrokeTextOnLoad.cpp +46 -0
- package/nitrogen/generated/android/NitroStrokeTextOnLoad.hpp +25 -0
- package/nitrogen/generated/android/c++/JHybridStrokeTextViewSpec.cpp +308 -0
- package/nitrogen/generated/android/c++/JHybridStrokeTextViewSpec.hpp +117 -0
- package/nitrogen/generated/android/c++/JStrokeTextAlign.hpp +67 -0
- package/nitrogen/generated/android/c++/JStrokeTextDecorationLine.hpp +64 -0
- package/nitrogen/generated/android/c++/JStrokeTextEllipsizeMode.hpp +64 -0
- package/nitrogen/generated/android/c++/JStrokeTextFontStyle.hpp +58 -0
- package/nitrogen/generated/android/c++/JStrokeTextTransform.hpp +64 -0
- package/nitrogen/generated/android/c++/views/JHybridStrokeTextViewStateUpdater.cpp +156 -0
- package/nitrogen/generated/android/c++/views/JHybridStrokeTextViewStateUpdater.hpp +49 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/HybridStrokeTextViewSpec.kt +209 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/NitroStrokeTextOnLoad.kt +35 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/StrokeTextAlign.kt +26 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/StrokeTextDecorationLine.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/StrokeTextEllipsizeMode.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/StrokeTextFontStyle.kt +23 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/StrokeTextTransform.kt +25 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/views/HybridStrokeTextViewManager.kt +70 -0
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/views/HybridStrokeTextViewStateUpdater.kt +23 -0
- package/nitrogen/generated/ios/NitroStrokeText+autolinking.rb +60 -0
- package/nitrogen/generated/ios/NitroStrokeText-Swift-Cxx-Bridge.cpp +33 -0
- package/nitrogen/generated/ios/NitroStrokeText-Swift-Cxx-Bridge.hpp +177 -0
- package/nitrogen/generated/ios/NitroStrokeText-Swift-Cxx-Umbrella.hpp +58 -0
- package/nitrogen/generated/ios/NitroStrokeTextAutolinking.mm +33 -0
- package/nitrogen/generated/ios/NitroStrokeTextAutolinking.swift +26 -0
- package/nitrogen/generated/ios/c++/HybridStrokeTextViewSpecSwift.cpp +11 -0
- package/nitrogen/generated/ios/c++/HybridStrokeTextViewSpecSwift.hpp +271 -0
- package/nitrogen/generated/ios/c++/views/HybridStrokeTextViewComponent.mm +232 -0
- package/nitrogen/generated/ios/swift/HybridStrokeTextViewSpec.swift +81 -0
- package/nitrogen/generated/ios/swift/HybridStrokeTextViewSpec_cxx.swift +620 -0
- package/nitrogen/generated/ios/swift/StrokeTextAlign.swift +52 -0
- package/nitrogen/generated/ios/swift/StrokeTextDecorationLine.swift +48 -0
- package/nitrogen/generated/ios/swift/StrokeTextEllipsizeMode.swift +48 -0
- package/nitrogen/generated/ios/swift/StrokeTextFontStyle.swift +40 -0
- package/nitrogen/generated/ios/swift/StrokeTextTransform.swift +48 -0
- package/nitrogen/generated/shared/c++/HybridStrokeTextViewSpec.cpp +72 -0
- package/nitrogen/generated/shared/c++/HybridStrokeTextViewSpec.hpp +128 -0
- package/nitrogen/generated/shared/c++/StrokeTextAlign.hpp +88 -0
- package/nitrogen/generated/shared/c++/StrokeTextDecorationLine.hpp +84 -0
- package/nitrogen/generated/shared/c++/StrokeTextEllipsizeMode.hpp +84 -0
- package/nitrogen/generated/shared/c++/StrokeTextFontStyle.hpp +76 -0
- package/nitrogen/generated/shared/c++/StrokeTextTransform.hpp +84 -0
- package/nitrogen/generated/shared/c++/views/HybridStrokeTextViewComponent.cpp +388 -0
- package/nitrogen/generated/shared/c++/views/HybridStrokeTextViewComponent.hpp +138 -0
- package/nitrogen/generated/shared/json/StrokeTextViewConfig.json +35 -0
- package/package.json +124 -0
- package/react-native.config.js +16 -0
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// StrokeTextTransform.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#pragma once
|
|
9
|
+
|
|
10
|
+
#if __has_include(<NitroModules/NitroHash.hpp>)
|
|
11
|
+
#include <NitroModules/NitroHash.hpp>
|
|
12
|
+
#else
|
|
13
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
14
|
+
#endif
|
|
15
|
+
#if __has_include(<NitroModules/JSIConverter.hpp>)
|
|
16
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
17
|
+
#else
|
|
18
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
19
|
+
#endif
|
|
20
|
+
#if __has_include(<NitroModules/NitroDefines.hpp>)
|
|
21
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
22
|
+
#else
|
|
23
|
+
#error NitroModules cannot be found! Are you sure you installed NitroModules properly?
|
|
24
|
+
#endif
|
|
25
|
+
|
|
26
|
+
namespace margelo::nitro::stroketext {
|
|
27
|
+
|
|
28
|
+
/**
|
|
29
|
+
* An enum which can be represented as a JavaScript union (StrokeTextTransform).
|
|
30
|
+
*/
|
|
31
|
+
enum class StrokeTextTransform {
|
|
32
|
+
NONE SWIFT_NAME(none) = 0,
|
|
33
|
+
UPPERCASE SWIFT_NAME(uppercase) = 1,
|
|
34
|
+
LOWERCASE SWIFT_NAME(lowercase) = 2,
|
|
35
|
+
CAPITALIZE SWIFT_NAME(capitalize) = 3,
|
|
36
|
+
} CLOSED_ENUM;
|
|
37
|
+
|
|
38
|
+
} // namespace margelo::nitro::stroketext
|
|
39
|
+
|
|
40
|
+
namespace margelo::nitro {
|
|
41
|
+
|
|
42
|
+
// C++ StrokeTextTransform <> JS StrokeTextTransform (union)
|
|
43
|
+
template <>
|
|
44
|
+
struct JSIConverter<margelo::nitro::stroketext::StrokeTextTransform> final {
|
|
45
|
+
static inline margelo::nitro::stroketext::StrokeTextTransform fromJSI(jsi::Runtime& runtime, const jsi::Value& arg) {
|
|
46
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, arg);
|
|
47
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
48
|
+
case hashString("none"): return margelo::nitro::stroketext::StrokeTextTransform::NONE;
|
|
49
|
+
case hashString("uppercase"): return margelo::nitro::stroketext::StrokeTextTransform::UPPERCASE;
|
|
50
|
+
case hashString("lowercase"): return margelo::nitro::stroketext::StrokeTextTransform::LOWERCASE;
|
|
51
|
+
case hashString("capitalize"): return margelo::nitro::stroketext::StrokeTextTransform::CAPITALIZE;
|
|
52
|
+
default: [[unlikely]]
|
|
53
|
+
throw std::invalid_argument("Cannot convert \"" + unionValue + "\" to enum StrokeTextTransform - invalid value!");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
static inline jsi::Value toJSI(jsi::Runtime& runtime, margelo::nitro::stroketext::StrokeTextTransform arg) {
|
|
57
|
+
switch (arg) {
|
|
58
|
+
case margelo::nitro::stroketext::StrokeTextTransform::NONE: return JSIConverter<std::string>::toJSI(runtime, "none");
|
|
59
|
+
case margelo::nitro::stroketext::StrokeTextTransform::UPPERCASE: return JSIConverter<std::string>::toJSI(runtime, "uppercase");
|
|
60
|
+
case margelo::nitro::stroketext::StrokeTextTransform::LOWERCASE: return JSIConverter<std::string>::toJSI(runtime, "lowercase");
|
|
61
|
+
case margelo::nitro::stroketext::StrokeTextTransform::CAPITALIZE: return JSIConverter<std::string>::toJSI(runtime, "capitalize");
|
|
62
|
+
default: [[unlikely]]
|
|
63
|
+
throw std::invalid_argument("Cannot convert StrokeTextTransform to JS - invalid value: "
|
|
64
|
+
+ std::to_string(static_cast<int>(arg)) + "!");
|
|
65
|
+
}
|
|
66
|
+
}
|
|
67
|
+
static inline bool canConvert(jsi::Runtime& runtime, const jsi::Value& value) {
|
|
68
|
+
if (!value.isString()) {
|
|
69
|
+
return false;
|
|
70
|
+
}
|
|
71
|
+
std::string unionValue = JSIConverter<std::string>::fromJSI(runtime, value);
|
|
72
|
+
switch (hashString(unionValue.c_str(), unionValue.size())) {
|
|
73
|
+
case hashString("none"):
|
|
74
|
+
case hashString("uppercase"):
|
|
75
|
+
case hashString("lowercase"):
|
|
76
|
+
case hashString("capitalize"):
|
|
77
|
+
return true;
|
|
78
|
+
default:
|
|
79
|
+
return false;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
};
|
|
83
|
+
|
|
84
|
+
} // namespace margelo::nitro
|
|
@@ -0,0 +1,388 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridStrokeTextViewComponent.cpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © Marc Rousavy @ Margelo
|
|
6
|
+
///
|
|
7
|
+
|
|
8
|
+
#include "HybridStrokeTextViewComponent.hpp"
|
|
9
|
+
|
|
10
|
+
#include <string>
|
|
11
|
+
#include <exception>
|
|
12
|
+
#include <utility>
|
|
13
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
14
|
+
#include <NitroModules/JSIConverter.hpp>
|
|
15
|
+
#include <NitroModules/PropNameIDCache.hpp>
|
|
16
|
+
#include <react/renderer/core/RawValue.h>
|
|
17
|
+
#include <react/renderer/core/ShadowNode.h>
|
|
18
|
+
#include <react/renderer/core/ComponentDescriptor.h>
|
|
19
|
+
#include <react/renderer/components/view/ViewProps.h>
|
|
20
|
+
|
|
21
|
+
namespace margelo::nitro::stroketext::views {
|
|
22
|
+
|
|
23
|
+
extern const char HybridStrokeTextViewComponentName[] = "StrokeTextView";
|
|
24
|
+
|
|
25
|
+
HybridStrokeTextViewProps::HybridStrokeTextViewProps(const react::PropsParserContext& context,
|
|
26
|
+
const HybridStrokeTextViewProps& sourceProps,
|
|
27
|
+
const react::RawProps& rawProps):
|
|
28
|
+
react::ViewProps(context, sourceProps, rawProps, filterObjectKeys),
|
|
29
|
+
text([&]() -> CachedProp<std::string> {
|
|
30
|
+
try {
|
|
31
|
+
const react::RawValue* rawValue = rawProps.at("text", nullptr, nullptr);
|
|
32
|
+
if (rawValue == nullptr) return sourceProps.text;
|
|
33
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
34
|
+
return CachedProp<std::string>::fromRawValue(*runtime, value, sourceProps.text);
|
|
35
|
+
} catch (const std::exception& exc) {
|
|
36
|
+
throw std::runtime_error(std::string("StrokeTextView.text: ") + exc.what());
|
|
37
|
+
}
|
|
38
|
+
}()),
|
|
39
|
+
color([&]() -> CachedProp<std::optional<std::string>> {
|
|
40
|
+
try {
|
|
41
|
+
const react::RawValue* rawValue = rawProps.at("color", nullptr, nullptr);
|
|
42
|
+
if (rawValue == nullptr) return sourceProps.color;
|
|
43
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
44
|
+
return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.color);
|
|
45
|
+
} catch (const std::exception& exc) {
|
|
46
|
+
throw std::runtime_error(std::string("StrokeTextView.color: ") + exc.what());
|
|
47
|
+
}
|
|
48
|
+
}()),
|
|
49
|
+
strokeColor([&]() -> CachedProp<std::optional<std::string>> {
|
|
50
|
+
try {
|
|
51
|
+
const react::RawValue* rawValue = rawProps.at("strokeColor", nullptr, nullptr);
|
|
52
|
+
if (rawValue == nullptr) return sourceProps.strokeColor;
|
|
53
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
54
|
+
return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.strokeColor);
|
|
55
|
+
} catch (const std::exception& exc) {
|
|
56
|
+
throw std::runtime_error(std::string("StrokeTextView.strokeColor: ") + exc.what());
|
|
57
|
+
}
|
|
58
|
+
}()),
|
|
59
|
+
strokeWidth([&]() -> CachedProp<std::optional<double>> {
|
|
60
|
+
try {
|
|
61
|
+
const react::RawValue* rawValue = rawProps.at("strokeWidth", nullptr, nullptr);
|
|
62
|
+
if (rawValue == nullptr) return sourceProps.strokeWidth;
|
|
63
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
64
|
+
return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.strokeWidth);
|
|
65
|
+
} catch (const std::exception& exc) {
|
|
66
|
+
throw std::runtime_error(std::string("StrokeTextView.strokeWidth: ") + exc.what());
|
|
67
|
+
}
|
|
68
|
+
}()),
|
|
69
|
+
fontSize([&]() -> CachedProp<std::optional<double>> {
|
|
70
|
+
try {
|
|
71
|
+
const react::RawValue* rawValue = rawProps.at("fontSize", nullptr, nullptr);
|
|
72
|
+
if (rawValue == nullptr) return sourceProps.fontSize;
|
|
73
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
74
|
+
return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.fontSize);
|
|
75
|
+
} catch (const std::exception& exc) {
|
|
76
|
+
throw std::runtime_error(std::string("StrokeTextView.fontSize: ") + exc.what());
|
|
77
|
+
}
|
|
78
|
+
}()),
|
|
79
|
+
fontWeight([&]() -> CachedProp<std::optional<std::string>> {
|
|
80
|
+
try {
|
|
81
|
+
const react::RawValue* rawValue = rawProps.at("fontWeight", nullptr, nullptr);
|
|
82
|
+
if (rawValue == nullptr) return sourceProps.fontWeight;
|
|
83
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
84
|
+
return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.fontWeight);
|
|
85
|
+
} catch (const std::exception& exc) {
|
|
86
|
+
throw std::runtime_error(std::string("StrokeTextView.fontWeight: ") + exc.what());
|
|
87
|
+
}
|
|
88
|
+
}()),
|
|
89
|
+
fontFamily([&]() -> CachedProp<std::optional<std::string>> {
|
|
90
|
+
try {
|
|
91
|
+
const react::RawValue* rawValue = rawProps.at("fontFamily", nullptr, nullptr);
|
|
92
|
+
if (rawValue == nullptr) return sourceProps.fontFamily;
|
|
93
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
94
|
+
return CachedProp<std::optional<std::string>>::fromRawValue(*runtime, value, sourceProps.fontFamily);
|
|
95
|
+
} catch (const std::exception& exc) {
|
|
96
|
+
throw std::runtime_error(std::string("StrokeTextView.fontFamily: ") + exc.what());
|
|
97
|
+
}
|
|
98
|
+
}()),
|
|
99
|
+
fontStyle([&]() -> CachedProp<std::optional<StrokeTextFontStyle>> {
|
|
100
|
+
try {
|
|
101
|
+
const react::RawValue* rawValue = rawProps.at("fontStyle", nullptr, nullptr);
|
|
102
|
+
if (rawValue == nullptr) return sourceProps.fontStyle;
|
|
103
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
104
|
+
return CachedProp<std::optional<StrokeTextFontStyle>>::fromRawValue(*runtime, value, sourceProps.fontStyle);
|
|
105
|
+
} catch (const std::exception& exc) {
|
|
106
|
+
throw std::runtime_error(std::string("StrokeTextView.fontStyle: ") + exc.what());
|
|
107
|
+
}
|
|
108
|
+
}()),
|
|
109
|
+
lineHeight([&]() -> CachedProp<std::optional<double>> {
|
|
110
|
+
try {
|
|
111
|
+
const react::RawValue* rawValue = rawProps.at("lineHeight", nullptr, nullptr);
|
|
112
|
+
if (rawValue == nullptr) return sourceProps.lineHeight;
|
|
113
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
114
|
+
return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.lineHeight);
|
|
115
|
+
} catch (const std::exception& exc) {
|
|
116
|
+
throw std::runtime_error(std::string("StrokeTextView.lineHeight: ") + exc.what());
|
|
117
|
+
}
|
|
118
|
+
}()),
|
|
119
|
+
letterSpacing([&]() -> CachedProp<std::optional<double>> {
|
|
120
|
+
try {
|
|
121
|
+
const react::RawValue* rawValue = rawProps.at("letterSpacing", nullptr, nullptr);
|
|
122
|
+
if (rawValue == nullptr) return sourceProps.letterSpacing;
|
|
123
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
124
|
+
return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.letterSpacing);
|
|
125
|
+
} catch (const std::exception& exc) {
|
|
126
|
+
throw std::runtime_error(std::string("StrokeTextView.letterSpacing: ") + exc.what());
|
|
127
|
+
}
|
|
128
|
+
}()),
|
|
129
|
+
textAlign([&]() -> CachedProp<std::optional<StrokeTextAlign>> {
|
|
130
|
+
try {
|
|
131
|
+
const react::RawValue* rawValue = rawProps.at("textAlign", nullptr, nullptr);
|
|
132
|
+
if (rawValue == nullptr) return sourceProps.textAlign;
|
|
133
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
134
|
+
return CachedProp<std::optional<StrokeTextAlign>>::fromRawValue(*runtime, value, sourceProps.textAlign);
|
|
135
|
+
} catch (const std::exception& exc) {
|
|
136
|
+
throw std::runtime_error(std::string("StrokeTextView.textAlign: ") + exc.what());
|
|
137
|
+
}
|
|
138
|
+
}()),
|
|
139
|
+
textDecorationLine([&]() -> CachedProp<std::optional<StrokeTextDecorationLine>> {
|
|
140
|
+
try {
|
|
141
|
+
const react::RawValue* rawValue = rawProps.at("textDecorationLine", nullptr, nullptr);
|
|
142
|
+
if (rawValue == nullptr) return sourceProps.textDecorationLine;
|
|
143
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
144
|
+
return CachedProp<std::optional<StrokeTextDecorationLine>>::fromRawValue(*runtime, value, sourceProps.textDecorationLine);
|
|
145
|
+
} catch (const std::exception& exc) {
|
|
146
|
+
throw std::runtime_error(std::string("StrokeTextView.textDecorationLine: ") + exc.what());
|
|
147
|
+
}
|
|
148
|
+
}()),
|
|
149
|
+
textTransform([&]() -> CachedProp<std::optional<StrokeTextTransform>> {
|
|
150
|
+
try {
|
|
151
|
+
const react::RawValue* rawValue = rawProps.at("textTransform", nullptr, nullptr);
|
|
152
|
+
if (rawValue == nullptr) return sourceProps.textTransform;
|
|
153
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
154
|
+
return CachedProp<std::optional<StrokeTextTransform>>::fromRawValue(*runtime, value, sourceProps.textTransform);
|
|
155
|
+
} catch (const std::exception& exc) {
|
|
156
|
+
throw std::runtime_error(std::string("StrokeTextView.textTransform: ") + exc.what());
|
|
157
|
+
}
|
|
158
|
+
}()),
|
|
159
|
+
opacity([&]() -> CachedProp<std::optional<double>> {
|
|
160
|
+
try {
|
|
161
|
+
const react::RawValue* rawValue = rawProps.at("opacity", nullptr, nullptr);
|
|
162
|
+
if (rawValue == nullptr) return sourceProps.opacity;
|
|
163
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
164
|
+
return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.opacity);
|
|
165
|
+
} catch (const std::exception& exc) {
|
|
166
|
+
throw std::runtime_error(std::string("StrokeTextView.opacity: ") + exc.what());
|
|
167
|
+
}
|
|
168
|
+
}()),
|
|
169
|
+
allowFontScaling([&]() -> CachedProp<std::optional<bool>> {
|
|
170
|
+
try {
|
|
171
|
+
const react::RawValue* rawValue = rawProps.at("allowFontScaling", nullptr, nullptr);
|
|
172
|
+
if (rawValue == nullptr) return sourceProps.allowFontScaling;
|
|
173
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
174
|
+
return CachedProp<std::optional<bool>>::fromRawValue(*runtime, value, sourceProps.allowFontScaling);
|
|
175
|
+
} catch (const std::exception& exc) {
|
|
176
|
+
throw std::runtime_error(std::string("StrokeTextView.allowFontScaling: ") + exc.what());
|
|
177
|
+
}
|
|
178
|
+
}()),
|
|
179
|
+
maxFontSizeMultiplier([&]() -> CachedProp<std::optional<double>> {
|
|
180
|
+
try {
|
|
181
|
+
const react::RawValue* rawValue = rawProps.at("maxFontSizeMultiplier", nullptr, nullptr);
|
|
182
|
+
if (rawValue == nullptr) return sourceProps.maxFontSizeMultiplier;
|
|
183
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
184
|
+
return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.maxFontSizeMultiplier);
|
|
185
|
+
} catch (const std::exception& exc) {
|
|
186
|
+
throw std::runtime_error(std::string("StrokeTextView.maxFontSizeMultiplier: ") + exc.what());
|
|
187
|
+
}
|
|
188
|
+
}()),
|
|
189
|
+
includeFontPadding([&]() -> CachedProp<std::optional<bool>> {
|
|
190
|
+
try {
|
|
191
|
+
const react::RawValue* rawValue = rawProps.at("includeFontPadding", nullptr, nullptr);
|
|
192
|
+
if (rawValue == nullptr) return sourceProps.includeFontPadding;
|
|
193
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
194
|
+
return CachedProp<std::optional<bool>>::fromRawValue(*runtime, value, sourceProps.includeFontPadding);
|
|
195
|
+
} catch (const std::exception& exc) {
|
|
196
|
+
throw std::runtime_error(std::string("StrokeTextView.includeFontPadding: ") + exc.what());
|
|
197
|
+
}
|
|
198
|
+
}()),
|
|
199
|
+
numberOfLines([&]() -> CachedProp<std::optional<double>> {
|
|
200
|
+
try {
|
|
201
|
+
const react::RawValue* rawValue = rawProps.at("numberOfLines", nullptr, nullptr);
|
|
202
|
+
if (rawValue == nullptr) return sourceProps.numberOfLines;
|
|
203
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
204
|
+
return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.numberOfLines);
|
|
205
|
+
} catch (const std::exception& exc) {
|
|
206
|
+
throw std::runtime_error(std::string("StrokeTextView.numberOfLines: ") + exc.what());
|
|
207
|
+
}
|
|
208
|
+
}()),
|
|
209
|
+
ellipsizeMode([&]() -> CachedProp<std::optional<StrokeTextEllipsizeMode>> {
|
|
210
|
+
try {
|
|
211
|
+
const react::RawValue* rawValue = rawProps.at("ellipsizeMode", nullptr, nullptr);
|
|
212
|
+
if (rawValue == nullptr) return sourceProps.ellipsizeMode;
|
|
213
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
214
|
+
return CachedProp<std::optional<StrokeTextEllipsizeMode>>::fromRawValue(*runtime, value, sourceProps.ellipsizeMode);
|
|
215
|
+
} catch (const std::exception& exc) {
|
|
216
|
+
throw std::runtime_error(std::string("StrokeTextView.ellipsizeMode: ") + exc.what());
|
|
217
|
+
}
|
|
218
|
+
}()),
|
|
219
|
+
padding([&]() -> CachedProp<std::optional<double>> {
|
|
220
|
+
try {
|
|
221
|
+
const react::RawValue* rawValue = rawProps.at("padding", nullptr, nullptr);
|
|
222
|
+
if (rawValue == nullptr) return sourceProps.padding;
|
|
223
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
224
|
+
return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.padding);
|
|
225
|
+
} catch (const std::exception& exc) {
|
|
226
|
+
throw std::runtime_error(std::string("StrokeTextView.padding: ") + exc.what());
|
|
227
|
+
}
|
|
228
|
+
}()),
|
|
229
|
+
paddingVertical([&]() -> CachedProp<std::optional<double>> {
|
|
230
|
+
try {
|
|
231
|
+
const react::RawValue* rawValue = rawProps.at("paddingVertical", nullptr, nullptr);
|
|
232
|
+
if (rawValue == nullptr) return sourceProps.paddingVertical;
|
|
233
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
234
|
+
return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.paddingVertical);
|
|
235
|
+
} catch (const std::exception& exc) {
|
|
236
|
+
throw std::runtime_error(std::string("StrokeTextView.paddingVertical: ") + exc.what());
|
|
237
|
+
}
|
|
238
|
+
}()),
|
|
239
|
+
paddingHorizontal([&]() -> CachedProp<std::optional<double>> {
|
|
240
|
+
try {
|
|
241
|
+
const react::RawValue* rawValue = rawProps.at("paddingHorizontal", nullptr, nullptr);
|
|
242
|
+
if (rawValue == nullptr) return sourceProps.paddingHorizontal;
|
|
243
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
244
|
+
return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.paddingHorizontal);
|
|
245
|
+
} catch (const std::exception& exc) {
|
|
246
|
+
throw std::runtime_error(std::string("StrokeTextView.paddingHorizontal: ") + exc.what());
|
|
247
|
+
}
|
|
248
|
+
}()),
|
|
249
|
+
paddingTop([&]() -> CachedProp<std::optional<double>> {
|
|
250
|
+
try {
|
|
251
|
+
const react::RawValue* rawValue = rawProps.at("paddingTop", nullptr, nullptr);
|
|
252
|
+
if (rawValue == nullptr) return sourceProps.paddingTop;
|
|
253
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
254
|
+
return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.paddingTop);
|
|
255
|
+
} catch (const std::exception& exc) {
|
|
256
|
+
throw std::runtime_error(std::string("StrokeTextView.paddingTop: ") + exc.what());
|
|
257
|
+
}
|
|
258
|
+
}()),
|
|
259
|
+
paddingRight([&]() -> CachedProp<std::optional<double>> {
|
|
260
|
+
try {
|
|
261
|
+
const react::RawValue* rawValue = rawProps.at("paddingRight", nullptr, nullptr);
|
|
262
|
+
if (rawValue == nullptr) return sourceProps.paddingRight;
|
|
263
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
264
|
+
return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.paddingRight);
|
|
265
|
+
} catch (const std::exception& exc) {
|
|
266
|
+
throw std::runtime_error(std::string("StrokeTextView.paddingRight: ") + exc.what());
|
|
267
|
+
}
|
|
268
|
+
}()),
|
|
269
|
+
paddingBottom([&]() -> CachedProp<std::optional<double>> {
|
|
270
|
+
try {
|
|
271
|
+
const react::RawValue* rawValue = rawProps.at("paddingBottom", nullptr, nullptr);
|
|
272
|
+
if (rawValue == nullptr) return sourceProps.paddingBottom;
|
|
273
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
274
|
+
return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.paddingBottom);
|
|
275
|
+
} catch (const std::exception& exc) {
|
|
276
|
+
throw std::runtime_error(std::string("StrokeTextView.paddingBottom: ") + exc.what());
|
|
277
|
+
}
|
|
278
|
+
}()),
|
|
279
|
+
paddingLeft([&]() -> CachedProp<std::optional<double>> {
|
|
280
|
+
try {
|
|
281
|
+
const react::RawValue* rawValue = rawProps.at("paddingLeft", nullptr, nullptr);
|
|
282
|
+
if (rawValue == nullptr) return sourceProps.paddingLeft;
|
|
283
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
284
|
+
return CachedProp<std::optional<double>>::fromRawValue(*runtime, value, sourceProps.paddingLeft);
|
|
285
|
+
} catch (const std::exception& exc) {
|
|
286
|
+
throw std::runtime_error(std::string("StrokeTextView.paddingLeft: ") + exc.what());
|
|
287
|
+
}
|
|
288
|
+
}()),
|
|
289
|
+
hybridRef([&]() -> CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridStrokeTextViewSpec>& /* ref */)>>> {
|
|
290
|
+
try {
|
|
291
|
+
const react::RawValue* rawValue = rawProps.at("hybridRef", nullptr, nullptr);
|
|
292
|
+
if (rawValue == nullptr) return sourceProps.hybridRef;
|
|
293
|
+
const auto& [runtime, value] = (std::pair<jsi::Runtime*, jsi::Value>)*rawValue;
|
|
294
|
+
return CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridStrokeTextViewSpec>& /* ref */)>>>::fromRawValue(*runtime, value.asObject(*runtime).getProperty(*runtime, PropNameIDCache::get(*runtime, "f")), sourceProps.hybridRef);
|
|
295
|
+
} catch (const std::exception& exc) {
|
|
296
|
+
throw std::runtime_error(std::string("StrokeTextView.hybridRef: ") + exc.what());
|
|
297
|
+
}
|
|
298
|
+
}()) { }
|
|
299
|
+
|
|
300
|
+
HybridStrokeTextViewProps::HybridStrokeTextViewProps(const HybridStrokeTextViewProps& other):
|
|
301
|
+
react::ViewProps(),
|
|
302
|
+
text(other.text),
|
|
303
|
+
color(other.color),
|
|
304
|
+
strokeColor(other.strokeColor),
|
|
305
|
+
strokeWidth(other.strokeWidth),
|
|
306
|
+
fontSize(other.fontSize),
|
|
307
|
+
fontWeight(other.fontWeight),
|
|
308
|
+
fontFamily(other.fontFamily),
|
|
309
|
+
fontStyle(other.fontStyle),
|
|
310
|
+
lineHeight(other.lineHeight),
|
|
311
|
+
letterSpacing(other.letterSpacing),
|
|
312
|
+
textAlign(other.textAlign),
|
|
313
|
+
textDecorationLine(other.textDecorationLine),
|
|
314
|
+
textTransform(other.textTransform),
|
|
315
|
+
opacity(other.opacity),
|
|
316
|
+
allowFontScaling(other.allowFontScaling),
|
|
317
|
+
maxFontSizeMultiplier(other.maxFontSizeMultiplier),
|
|
318
|
+
includeFontPadding(other.includeFontPadding),
|
|
319
|
+
numberOfLines(other.numberOfLines),
|
|
320
|
+
ellipsizeMode(other.ellipsizeMode),
|
|
321
|
+
padding(other.padding),
|
|
322
|
+
paddingVertical(other.paddingVertical),
|
|
323
|
+
paddingHorizontal(other.paddingHorizontal),
|
|
324
|
+
paddingTop(other.paddingTop),
|
|
325
|
+
paddingRight(other.paddingRight),
|
|
326
|
+
paddingBottom(other.paddingBottom),
|
|
327
|
+
paddingLeft(other.paddingLeft),
|
|
328
|
+
hybridRef(other.hybridRef) { }
|
|
329
|
+
|
|
330
|
+
bool HybridStrokeTextViewProps::filterObjectKeys(const std::string& propName) {
|
|
331
|
+
switch (hashString(propName)) {
|
|
332
|
+
case hashString("text"): return true;
|
|
333
|
+
case hashString("color"): return true;
|
|
334
|
+
case hashString("strokeColor"): return true;
|
|
335
|
+
case hashString("strokeWidth"): return true;
|
|
336
|
+
case hashString("fontSize"): return true;
|
|
337
|
+
case hashString("fontWeight"): return true;
|
|
338
|
+
case hashString("fontFamily"): return true;
|
|
339
|
+
case hashString("fontStyle"): return true;
|
|
340
|
+
case hashString("lineHeight"): return true;
|
|
341
|
+
case hashString("letterSpacing"): return true;
|
|
342
|
+
case hashString("textAlign"): return true;
|
|
343
|
+
case hashString("textDecorationLine"): return true;
|
|
344
|
+
case hashString("textTransform"): return true;
|
|
345
|
+
case hashString("opacity"): return true;
|
|
346
|
+
case hashString("allowFontScaling"): return true;
|
|
347
|
+
case hashString("maxFontSizeMultiplier"): return true;
|
|
348
|
+
case hashString("includeFontPadding"): return true;
|
|
349
|
+
case hashString("numberOfLines"): return true;
|
|
350
|
+
case hashString("ellipsizeMode"): return true;
|
|
351
|
+
case hashString("padding"): return true;
|
|
352
|
+
case hashString("paddingVertical"): return true;
|
|
353
|
+
case hashString("paddingHorizontal"): return true;
|
|
354
|
+
case hashString("paddingTop"): return true;
|
|
355
|
+
case hashString("paddingRight"): return true;
|
|
356
|
+
case hashString("paddingBottom"): return true;
|
|
357
|
+
case hashString("paddingLeft"): return true;
|
|
358
|
+
case hashString("hybridRef"): return true;
|
|
359
|
+
default: return false;
|
|
360
|
+
}
|
|
361
|
+
}
|
|
362
|
+
|
|
363
|
+
HybridStrokeTextViewComponentDescriptor::HybridStrokeTextViewComponentDescriptor(const react::ComponentDescriptorParameters& parameters)
|
|
364
|
+
: ConcreteComponentDescriptor(parameters,
|
|
365
|
+
react::RawPropsParser(/* enableJsiParser */ true)) {}
|
|
366
|
+
|
|
367
|
+
std::shared_ptr<const react::Props> HybridStrokeTextViewComponentDescriptor::cloneProps(const react::PropsParserContext& context,
|
|
368
|
+
const std::shared_ptr<const react::Props>& props,
|
|
369
|
+
react::RawProps rawProps) const {
|
|
370
|
+
// 1. Prepare raw props parser
|
|
371
|
+
rawProps.parse(rawPropsParser_);
|
|
372
|
+
// 2. Copy props with Nitro's cached copy constructor
|
|
373
|
+
return HybridStrokeTextViewShadowNode::Props(context, /* & */ rawProps, props);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
#ifdef ANDROID
|
|
377
|
+
void HybridStrokeTextViewComponentDescriptor::adopt(react::ShadowNode& shadowNode) const {
|
|
378
|
+
// This is called immediately after `ShadowNode` is created, cloned or in progress.
|
|
379
|
+
// On Android, we need to wrap props in our state, which gets routed through Java and later unwrapped in JNI/C++.
|
|
380
|
+
auto& concreteShadowNode = dynamic_cast<HybridStrokeTextViewShadowNode&>(shadowNode);
|
|
381
|
+
const HybridStrokeTextViewProps& props = concreteShadowNode.getConcreteProps();
|
|
382
|
+
HybridStrokeTextViewState state;
|
|
383
|
+
state.setProps(props);
|
|
384
|
+
concreteShadowNode.setStateData(std::move(state));
|
|
385
|
+
}
|
|
386
|
+
#endif
|
|
387
|
+
|
|
388
|
+
} // namespace margelo::nitro::stroketext::views
|
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// HybridStrokeTextViewComponent.hpp
|
|
3
|
+
/// This file was generated by nitrogen. DO NOT MODIFY THIS FILE.
|
|
4
|
+
/// https://github.com/mrousavy/nitro
|
|
5
|
+
/// Copyright © 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 <optional>
|
|
21
|
+
#include "StrokeTextFontStyle.hpp"
|
|
22
|
+
#include "StrokeTextAlign.hpp"
|
|
23
|
+
#include "StrokeTextDecorationLine.hpp"
|
|
24
|
+
#include "StrokeTextTransform.hpp"
|
|
25
|
+
#include "StrokeTextEllipsizeMode.hpp"
|
|
26
|
+
#include <memory>
|
|
27
|
+
#include "HybridStrokeTextViewSpec.hpp"
|
|
28
|
+
#include <functional>
|
|
29
|
+
|
|
30
|
+
namespace margelo::nitro::stroketext::views {
|
|
31
|
+
|
|
32
|
+
using namespace facebook;
|
|
33
|
+
|
|
34
|
+
/**
|
|
35
|
+
* The name of the actual native View.
|
|
36
|
+
*/
|
|
37
|
+
extern const char HybridStrokeTextViewComponentName[];
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Props for the "StrokeTextView" View.
|
|
41
|
+
*/
|
|
42
|
+
class HybridStrokeTextViewProps final: public react::ViewProps {
|
|
43
|
+
public:
|
|
44
|
+
HybridStrokeTextViewProps() = default;
|
|
45
|
+
HybridStrokeTextViewProps(const HybridStrokeTextViewProps&);
|
|
46
|
+
HybridStrokeTextViewProps(const react::PropsParserContext& context,
|
|
47
|
+
const HybridStrokeTextViewProps& sourceProps,
|
|
48
|
+
const react::RawProps& rawProps);
|
|
49
|
+
|
|
50
|
+
public:
|
|
51
|
+
CachedProp<std::string> text;
|
|
52
|
+
CachedProp<std::optional<std::string>> color;
|
|
53
|
+
CachedProp<std::optional<std::string>> strokeColor;
|
|
54
|
+
CachedProp<std::optional<double>> strokeWidth;
|
|
55
|
+
CachedProp<std::optional<double>> fontSize;
|
|
56
|
+
CachedProp<std::optional<std::string>> fontWeight;
|
|
57
|
+
CachedProp<std::optional<std::string>> fontFamily;
|
|
58
|
+
CachedProp<std::optional<StrokeTextFontStyle>> fontStyle;
|
|
59
|
+
CachedProp<std::optional<double>> lineHeight;
|
|
60
|
+
CachedProp<std::optional<double>> letterSpacing;
|
|
61
|
+
CachedProp<std::optional<StrokeTextAlign>> textAlign;
|
|
62
|
+
CachedProp<std::optional<StrokeTextDecorationLine>> textDecorationLine;
|
|
63
|
+
CachedProp<std::optional<StrokeTextTransform>> textTransform;
|
|
64
|
+
CachedProp<std::optional<double>> opacity;
|
|
65
|
+
CachedProp<std::optional<bool>> allowFontScaling;
|
|
66
|
+
CachedProp<std::optional<double>> maxFontSizeMultiplier;
|
|
67
|
+
CachedProp<std::optional<bool>> includeFontPadding;
|
|
68
|
+
CachedProp<std::optional<double>> numberOfLines;
|
|
69
|
+
CachedProp<std::optional<StrokeTextEllipsizeMode>> ellipsizeMode;
|
|
70
|
+
CachedProp<std::optional<double>> padding;
|
|
71
|
+
CachedProp<std::optional<double>> paddingVertical;
|
|
72
|
+
CachedProp<std::optional<double>> paddingHorizontal;
|
|
73
|
+
CachedProp<std::optional<double>> paddingTop;
|
|
74
|
+
CachedProp<std::optional<double>> paddingRight;
|
|
75
|
+
CachedProp<std::optional<double>> paddingBottom;
|
|
76
|
+
CachedProp<std::optional<double>> paddingLeft;
|
|
77
|
+
CachedProp<std::optional<std::function<void(const std::shared_ptr<HybridStrokeTextViewSpec>& /* ref */)>>> hybridRef;
|
|
78
|
+
|
|
79
|
+
private:
|
|
80
|
+
static bool filterObjectKeys(const std::string& propName);
|
|
81
|
+
};
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* State for the "StrokeTextView" View.
|
|
85
|
+
*/
|
|
86
|
+
class HybridStrokeTextViewState final {
|
|
87
|
+
public:
|
|
88
|
+
HybridStrokeTextViewState() = default;
|
|
89
|
+
|
|
90
|
+
public:
|
|
91
|
+
void setProps(const HybridStrokeTextViewProps& props) { _props.emplace(props); }
|
|
92
|
+
const std::optional<HybridStrokeTextViewProps>& getProps() const { return _props; }
|
|
93
|
+
|
|
94
|
+
public:
|
|
95
|
+
#ifdef ANDROID
|
|
96
|
+
HybridStrokeTextViewState(const HybridStrokeTextViewState& /* previousState */, folly::dynamic /* data */) {}
|
|
97
|
+
folly::dynamic getDynamic() const {
|
|
98
|
+
throw std::runtime_error("HybridStrokeTextViewState does not support folly!");
|
|
99
|
+
}
|
|
100
|
+
react::MapBuffer getMapBuffer() const {
|
|
101
|
+
throw std::runtime_error("HybridStrokeTextViewState does not support MapBuffer!");
|
|
102
|
+
};
|
|
103
|
+
#endif
|
|
104
|
+
|
|
105
|
+
private:
|
|
106
|
+
std::optional<HybridStrokeTextViewProps> _props;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/**
|
|
110
|
+
* The Shadow Node for the "StrokeTextView" View.
|
|
111
|
+
*/
|
|
112
|
+
using HybridStrokeTextViewShadowNode = react::ConcreteViewShadowNode<HybridStrokeTextViewComponentName /* "HybridStrokeTextView" */,
|
|
113
|
+
HybridStrokeTextViewProps /* custom props */,
|
|
114
|
+
react::ViewEventEmitter /* default */,
|
|
115
|
+
HybridStrokeTextViewState /* custom state */>;
|
|
116
|
+
|
|
117
|
+
/**
|
|
118
|
+
* The Component Descriptor for the "StrokeTextView" View.
|
|
119
|
+
*/
|
|
120
|
+
class HybridStrokeTextViewComponentDescriptor final: public react::ConcreteComponentDescriptor<HybridStrokeTextViewShadowNode> {
|
|
121
|
+
public:
|
|
122
|
+
HybridStrokeTextViewComponentDescriptor(const react::ComponentDescriptorParameters& parameters);
|
|
123
|
+
|
|
124
|
+
public:
|
|
125
|
+
/**
|
|
126
|
+
* A faster path for cloning props - reuses the caching logic from `HybridStrokeTextViewProps`.
|
|
127
|
+
*/
|
|
128
|
+
std::shared_ptr<const react::Props> cloneProps(const react::PropsParserContext& context,
|
|
129
|
+
const std::shared_ptr<const react::Props>& props,
|
|
130
|
+
react::RawProps rawProps) const override;
|
|
131
|
+
#ifdef ANDROID
|
|
132
|
+
void adopt(react::ShadowNode& shadowNode) const override;
|
|
133
|
+
#endif
|
|
134
|
+
};
|
|
135
|
+
|
|
136
|
+
/* The actual view for "StrokeTextView" needs to be implemented in platform-specific code. */
|
|
137
|
+
|
|
138
|
+
} // namespace margelo::nitro::stroketext::views
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
{
|
|
2
|
+
"uiViewClassName": "StrokeTextView",
|
|
3
|
+
"supportsRawText": false,
|
|
4
|
+
"bubblingEventTypes": {},
|
|
5
|
+
"directEventTypes": {},
|
|
6
|
+
"validAttributes": {
|
|
7
|
+
"text": true,
|
|
8
|
+
"color": true,
|
|
9
|
+
"strokeColor": true,
|
|
10
|
+
"strokeWidth": true,
|
|
11
|
+
"fontSize": true,
|
|
12
|
+
"fontWeight": true,
|
|
13
|
+
"fontFamily": true,
|
|
14
|
+
"fontStyle": true,
|
|
15
|
+
"lineHeight": true,
|
|
16
|
+
"letterSpacing": true,
|
|
17
|
+
"textAlign": true,
|
|
18
|
+
"textDecorationLine": true,
|
|
19
|
+
"textTransform": true,
|
|
20
|
+
"opacity": true,
|
|
21
|
+
"allowFontScaling": true,
|
|
22
|
+
"maxFontSizeMultiplier": true,
|
|
23
|
+
"includeFontPadding": true,
|
|
24
|
+
"numberOfLines": true,
|
|
25
|
+
"ellipsizeMode": true,
|
|
26
|
+
"padding": true,
|
|
27
|
+
"paddingVertical": true,
|
|
28
|
+
"paddingHorizontal": true,
|
|
29
|
+
"paddingTop": true,
|
|
30
|
+
"paddingRight": true,
|
|
31
|
+
"paddingBottom": true,
|
|
32
|
+
"paddingLeft": true,
|
|
33
|
+
"hybridRef": true
|
|
34
|
+
}
|
|
35
|
+
}
|