@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,67 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JStrokeTextAlign.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 <fbjni/fbjni.h>
|
|
11
|
+
#include "StrokeTextAlign.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::stroketext {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "StrokeTextAlign" and the the Kotlin enum "StrokeTextAlign".
|
|
19
|
+
*/
|
|
20
|
+
struct JStrokeTextAlign final: public jni::JavaClass<JStrokeTextAlign> {
|
|
21
|
+
public:
|
|
22
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/stroketext/StrokeTextAlign;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum StrokeTextAlign.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
StrokeTextAlign toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<StrokeTextAlign>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JStrokeTextAlign> fromCpp(StrokeTextAlign value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
switch (value) {
|
|
45
|
+
case StrokeTextAlign::AUTO:
|
|
46
|
+
static const auto fieldAUTO = clazz->getStaticField<JStrokeTextAlign>("AUTO");
|
|
47
|
+
return clazz->getStaticFieldValue(fieldAUTO);
|
|
48
|
+
case StrokeTextAlign::LEFT:
|
|
49
|
+
static const auto fieldLEFT = clazz->getStaticField<JStrokeTextAlign>("LEFT");
|
|
50
|
+
return clazz->getStaticFieldValue(fieldLEFT);
|
|
51
|
+
case StrokeTextAlign::RIGHT:
|
|
52
|
+
static const auto fieldRIGHT = clazz->getStaticField<JStrokeTextAlign>("RIGHT");
|
|
53
|
+
return clazz->getStaticFieldValue(fieldRIGHT);
|
|
54
|
+
case StrokeTextAlign::CENTER:
|
|
55
|
+
static const auto fieldCENTER = clazz->getStaticField<JStrokeTextAlign>("CENTER");
|
|
56
|
+
return clazz->getStaticFieldValue(fieldCENTER);
|
|
57
|
+
case StrokeTextAlign::JUSTIFY:
|
|
58
|
+
static const auto fieldJUSTIFY = clazz->getStaticField<JStrokeTextAlign>("JUSTIFY");
|
|
59
|
+
return clazz->getStaticFieldValue(fieldJUSTIFY);
|
|
60
|
+
default:
|
|
61
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
62
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
|
|
67
|
+
} // namespace margelo::nitro::stroketext
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JStrokeTextDecorationLine.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 <fbjni/fbjni.h>
|
|
11
|
+
#include "StrokeTextDecorationLine.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::stroketext {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "StrokeTextDecorationLine" and the the Kotlin enum "StrokeTextDecorationLine".
|
|
19
|
+
*/
|
|
20
|
+
struct JStrokeTextDecorationLine final: public jni::JavaClass<JStrokeTextDecorationLine> {
|
|
21
|
+
public:
|
|
22
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/stroketext/StrokeTextDecorationLine;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum StrokeTextDecorationLine.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
StrokeTextDecorationLine toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<StrokeTextDecorationLine>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JStrokeTextDecorationLine> fromCpp(StrokeTextDecorationLine value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
switch (value) {
|
|
45
|
+
case StrokeTextDecorationLine::NONE:
|
|
46
|
+
static const auto fieldNONE = clazz->getStaticField<JStrokeTextDecorationLine>("NONE");
|
|
47
|
+
return clazz->getStaticFieldValue(fieldNONE);
|
|
48
|
+
case StrokeTextDecorationLine::UNDERLINE:
|
|
49
|
+
static const auto fieldUNDERLINE = clazz->getStaticField<JStrokeTextDecorationLine>("UNDERLINE");
|
|
50
|
+
return clazz->getStaticFieldValue(fieldUNDERLINE);
|
|
51
|
+
case StrokeTextDecorationLine::LINE_THROUGH:
|
|
52
|
+
static const auto fieldLINE_THROUGH = clazz->getStaticField<JStrokeTextDecorationLine>("LINE_THROUGH");
|
|
53
|
+
return clazz->getStaticFieldValue(fieldLINE_THROUGH);
|
|
54
|
+
case StrokeTextDecorationLine::UNDERLINE_LINE_THROUGH:
|
|
55
|
+
static const auto fieldUNDERLINE_LINE_THROUGH = clazz->getStaticField<JStrokeTextDecorationLine>("UNDERLINE_LINE_THROUGH");
|
|
56
|
+
return clazz->getStaticFieldValue(fieldUNDERLINE_LINE_THROUGH);
|
|
57
|
+
default:
|
|
58
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
59
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
} // namespace margelo::nitro::stroketext
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JStrokeTextEllipsizeMode.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 <fbjni/fbjni.h>
|
|
11
|
+
#include "StrokeTextEllipsizeMode.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::stroketext {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "StrokeTextEllipsizeMode" and the the Kotlin enum "StrokeTextEllipsizeMode".
|
|
19
|
+
*/
|
|
20
|
+
struct JStrokeTextEllipsizeMode final: public jni::JavaClass<JStrokeTextEllipsizeMode> {
|
|
21
|
+
public:
|
|
22
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/stroketext/StrokeTextEllipsizeMode;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum StrokeTextEllipsizeMode.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
StrokeTextEllipsizeMode toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<StrokeTextEllipsizeMode>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JStrokeTextEllipsizeMode> fromCpp(StrokeTextEllipsizeMode value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
switch (value) {
|
|
45
|
+
case StrokeTextEllipsizeMode::HEAD:
|
|
46
|
+
static const auto fieldHEAD = clazz->getStaticField<JStrokeTextEllipsizeMode>("HEAD");
|
|
47
|
+
return clazz->getStaticFieldValue(fieldHEAD);
|
|
48
|
+
case StrokeTextEllipsizeMode::MIDDLE:
|
|
49
|
+
static const auto fieldMIDDLE = clazz->getStaticField<JStrokeTextEllipsizeMode>("MIDDLE");
|
|
50
|
+
return clazz->getStaticFieldValue(fieldMIDDLE);
|
|
51
|
+
case StrokeTextEllipsizeMode::TAIL:
|
|
52
|
+
static const auto fieldTAIL = clazz->getStaticField<JStrokeTextEllipsizeMode>("TAIL");
|
|
53
|
+
return clazz->getStaticFieldValue(fieldTAIL);
|
|
54
|
+
case StrokeTextEllipsizeMode::CLIP:
|
|
55
|
+
static const auto fieldCLIP = clazz->getStaticField<JStrokeTextEllipsizeMode>("CLIP");
|
|
56
|
+
return clazz->getStaticFieldValue(fieldCLIP);
|
|
57
|
+
default:
|
|
58
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
59
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
} // namespace margelo::nitro::stroketext
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JStrokeTextFontStyle.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 <fbjni/fbjni.h>
|
|
11
|
+
#include "StrokeTextFontStyle.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::stroketext {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "StrokeTextFontStyle" and the the Kotlin enum "StrokeTextFontStyle".
|
|
19
|
+
*/
|
|
20
|
+
struct JStrokeTextFontStyle final: public jni::JavaClass<JStrokeTextFontStyle> {
|
|
21
|
+
public:
|
|
22
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/stroketext/StrokeTextFontStyle;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum StrokeTextFontStyle.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
StrokeTextFontStyle toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<StrokeTextFontStyle>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JStrokeTextFontStyle> fromCpp(StrokeTextFontStyle value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
switch (value) {
|
|
45
|
+
case StrokeTextFontStyle::NORMAL:
|
|
46
|
+
static const auto fieldNORMAL = clazz->getStaticField<JStrokeTextFontStyle>("NORMAL");
|
|
47
|
+
return clazz->getStaticFieldValue(fieldNORMAL);
|
|
48
|
+
case StrokeTextFontStyle::ITALIC:
|
|
49
|
+
static const auto fieldITALIC = clazz->getStaticField<JStrokeTextFontStyle>("ITALIC");
|
|
50
|
+
return clazz->getStaticFieldValue(fieldITALIC);
|
|
51
|
+
default:
|
|
52
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
53
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
} // namespace margelo::nitro::stroketext
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JStrokeTextTransform.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 <fbjni/fbjni.h>
|
|
11
|
+
#include "StrokeTextTransform.hpp"
|
|
12
|
+
|
|
13
|
+
namespace margelo::nitro::stroketext {
|
|
14
|
+
|
|
15
|
+
using namespace facebook;
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "StrokeTextTransform" and the the Kotlin enum "StrokeTextTransform".
|
|
19
|
+
*/
|
|
20
|
+
struct JStrokeTextTransform final: public jni::JavaClass<JStrokeTextTransform> {
|
|
21
|
+
public:
|
|
22
|
+
static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/stroketext/StrokeTextTransform;";
|
|
23
|
+
|
|
24
|
+
public:
|
|
25
|
+
/**
|
|
26
|
+
* Convert this Java/Kotlin-based enum to the C++ enum StrokeTextTransform.
|
|
27
|
+
*/
|
|
28
|
+
[[maybe_unused]]
|
|
29
|
+
[[nodiscard]]
|
|
30
|
+
StrokeTextTransform toCpp() const {
|
|
31
|
+
static const auto clazz = javaClassStatic();
|
|
32
|
+
static const auto fieldOrdinal = clazz->getField<int>("value");
|
|
33
|
+
int ordinal = this->getFieldValue(fieldOrdinal);
|
|
34
|
+
return static_cast<StrokeTextTransform>(ordinal);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
public:
|
|
38
|
+
/**
|
|
39
|
+
* Create a Java/Kotlin-based enum with the given C++ enum's value.
|
|
40
|
+
*/
|
|
41
|
+
[[maybe_unused]]
|
|
42
|
+
static jni::alias_ref<JStrokeTextTransform> fromCpp(StrokeTextTransform value) {
|
|
43
|
+
static const auto clazz = javaClassStatic();
|
|
44
|
+
switch (value) {
|
|
45
|
+
case StrokeTextTransform::NONE:
|
|
46
|
+
static const auto fieldNONE = clazz->getStaticField<JStrokeTextTransform>("NONE");
|
|
47
|
+
return clazz->getStaticFieldValue(fieldNONE);
|
|
48
|
+
case StrokeTextTransform::UPPERCASE:
|
|
49
|
+
static const auto fieldUPPERCASE = clazz->getStaticField<JStrokeTextTransform>("UPPERCASE");
|
|
50
|
+
return clazz->getStaticFieldValue(fieldUPPERCASE);
|
|
51
|
+
case StrokeTextTransform::LOWERCASE:
|
|
52
|
+
static const auto fieldLOWERCASE = clazz->getStaticField<JStrokeTextTransform>("LOWERCASE");
|
|
53
|
+
return clazz->getStaticFieldValue(fieldLOWERCASE);
|
|
54
|
+
case StrokeTextTransform::CAPITALIZE:
|
|
55
|
+
static const auto fieldCAPITALIZE = clazz->getStaticField<JStrokeTextTransform>("CAPITALIZE");
|
|
56
|
+
return clazz->getStaticFieldValue(fieldCAPITALIZE);
|
|
57
|
+
default:
|
|
58
|
+
std::string stringValue = std::to_string(static_cast<int>(value));
|
|
59
|
+
throw std::invalid_argument("Invalid enum value (" + stringValue + "!");
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
};
|
|
63
|
+
|
|
64
|
+
} // namespace margelo::nitro::stroketext
|
|
@@ -0,0 +1,156 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridStrokeTextViewStateUpdater.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 "JHybridStrokeTextViewStateUpdater.hpp"
|
|
9
|
+
#include "views/HybridStrokeTextViewComponent.hpp"
|
|
10
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
11
|
+
|
|
12
|
+
namespace margelo::nitro::stroketext::views {
|
|
13
|
+
|
|
14
|
+
using namespace facebook;
|
|
15
|
+
using ConcreteStateData = react::ConcreteState<HybridStrokeTextViewState>;
|
|
16
|
+
|
|
17
|
+
void JHybridStrokeTextViewStateUpdater::updateViewProps(jni::alias_ref<jni::JClass> /* class */,
|
|
18
|
+
jni::alias_ref<JHybridStrokeTextViewSpec::javaobject> javaView,
|
|
19
|
+
jni::alias_ref<JStateWrapper::javaobject> stateWrapperInterface) {
|
|
20
|
+
JHybridStrokeTextViewSpec* view = javaView->cthis();
|
|
21
|
+
|
|
22
|
+
// Get concrete StateWrapperImpl from passed StateWrapper interface object
|
|
23
|
+
jobject rawStateWrapper = stateWrapperInterface.get();
|
|
24
|
+
if (!stateWrapperInterface->isInstanceOf(react::StateWrapperImpl::javaClassStatic())) {
|
|
25
|
+
throw std::runtime_error("StateWrapper is not a StateWrapperImpl");
|
|
26
|
+
}
|
|
27
|
+
auto stateWrapper = jni::alias_ref<react::StateWrapperImpl::javaobject>{
|
|
28
|
+
static_cast<react::StateWrapperImpl::javaobject>(rawStateWrapper)};
|
|
29
|
+
|
|
30
|
+
std::shared_ptr<const react::State> state = stateWrapper->cthis()->getState();
|
|
31
|
+
auto concreteState = std::dynamic_pointer_cast<const ConcreteStateData>(state);
|
|
32
|
+
const HybridStrokeTextViewState& data = concreteState->getData();
|
|
33
|
+
const std::optional<HybridStrokeTextViewProps>& maybeProps = data.getProps();
|
|
34
|
+
if (!maybeProps.has_value()) {
|
|
35
|
+
// Props aren't set yet!
|
|
36
|
+
throw std::runtime_error("HybridStrokeTextViewState's data doesn't contain any props!");
|
|
37
|
+
}
|
|
38
|
+
const HybridStrokeTextViewProps& props = maybeProps.value();
|
|
39
|
+
if (props.text.isDirty) {
|
|
40
|
+
view->setText(props.text.value);
|
|
41
|
+
// TODO: Set isDirty = false
|
|
42
|
+
}
|
|
43
|
+
if (props.color.isDirty) {
|
|
44
|
+
view->setColor(props.color.value);
|
|
45
|
+
// TODO: Set isDirty = false
|
|
46
|
+
}
|
|
47
|
+
if (props.strokeColor.isDirty) {
|
|
48
|
+
view->setStrokeColor(props.strokeColor.value);
|
|
49
|
+
// TODO: Set isDirty = false
|
|
50
|
+
}
|
|
51
|
+
if (props.strokeWidth.isDirty) {
|
|
52
|
+
view->setStrokeWidth(props.strokeWidth.value);
|
|
53
|
+
// TODO: Set isDirty = false
|
|
54
|
+
}
|
|
55
|
+
if (props.fontSize.isDirty) {
|
|
56
|
+
view->setFontSize(props.fontSize.value);
|
|
57
|
+
// TODO: Set isDirty = false
|
|
58
|
+
}
|
|
59
|
+
if (props.fontWeight.isDirty) {
|
|
60
|
+
view->setFontWeight(props.fontWeight.value);
|
|
61
|
+
// TODO: Set isDirty = false
|
|
62
|
+
}
|
|
63
|
+
if (props.fontFamily.isDirty) {
|
|
64
|
+
view->setFontFamily(props.fontFamily.value);
|
|
65
|
+
// TODO: Set isDirty = false
|
|
66
|
+
}
|
|
67
|
+
if (props.fontStyle.isDirty) {
|
|
68
|
+
view->setFontStyle(props.fontStyle.value);
|
|
69
|
+
// TODO: Set isDirty = false
|
|
70
|
+
}
|
|
71
|
+
if (props.lineHeight.isDirty) {
|
|
72
|
+
view->setLineHeight(props.lineHeight.value);
|
|
73
|
+
// TODO: Set isDirty = false
|
|
74
|
+
}
|
|
75
|
+
if (props.letterSpacing.isDirty) {
|
|
76
|
+
view->setLetterSpacing(props.letterSpacing.value);
|
|
77
|
+
// TODO: Set isDirty = false
|
|
78
|
+
}
|
|
79
|
+
if (props.textAlign.isDirty) {
|
|
80
|
+
view->setTextAlign(props.textAlign.value);
|
|
81
|
+
// TODO: Set isDirty = false
|
|
82
|
+
}
|
|
83
|
+
if (props.textDecorationLine.isDirty) {
|
|
84
|
+
view->setTextDecorationLine(props.textDecorationLine.value);
|
|
85
|
+
// TODO: Set isDirty = false
|
|
86
|
+
}
|
|
87
|
+
if (props.textTransform.isDirty) {
|
|
88
|
+
view->setTextTransform(props.textTransform.value);
|
|
89
|
+
// TODO: Set isDirty = false
|
|
90
|
+
}
|
|
91
|
+
if (props.opacity.isDirty) {
|
|
92
|
+
view->setOpacity(props.opacity.value);
|
|
93
|
+
// TODO: Set isDirty = false
|
|
94
|
+
}
|
|
95
|
+
if (props.allowFontScaling.isDirty) {
|
|
96
|
+
view->setAllowFontScaling(props.allowFontScaling.value);
|
|
97
|
+
// TODO: Set isDirty = false
|
|
98
|
+
}
|
|
99
|
+
if (props.maxFontSizeMultiplier.isDirty) {
|
|
100
|
+
view->setMaxFontSizeMultiplier(props.maxFontSizeMultiplier.value);
|
|
101
|
+
// TODO: Set isDirty = false
|
|
102
|
+
}
|
|
103
|
+
if (props.includeFontPadding.isDirty) {
|
|
104
|
+
view->setIncludeFontPadding(props.includeFontPadding.value);
|
|
105
|
+
// TODO: Set isDirty = false
|
|
106
|
+
}
|
|
107
|
+
if (props.numberOfLines.isDirty) {
|
|
108
|
+
view->setNumberOfLines(props.numberOfLines.value);
|
|
109
|
+
// TODO: Set isDirty = false
|
|
110
|
+
}
|
|
111
|
+
if (props.ellipsizeMode.isDirty) {
|
|
112
|
+
view->setEllipsizeMode(props.ellipsizeMode.value);
|
|
113
|
+
// TODO: Set isDirty = false
|
|
114
|
+
}
|
|
115
|
+
if (props.padding.isDirty) {
|
|
116
|
+
view->setPadding(props.padding.value);
|
|
117
|
+
// TODO: Set isDirty = false
|
|
118
|
+
}
|
|
119
|
+
if (props.paddingVertical.isDirty) {
|
|
120
|
+
view->setPaddingVertical(props.paddingVertical.value);
|
|
121
|
+
// TODO: Set isDirty = false
|
|
122
|
+
}
|
|
123
|
+
if (props.paddingHorizontal.isDirty) {
|
|
124
|
+
view->setPaddingHorizontal(props.paddingHorizontal.value);
|
|
125
|
+
// TODO: Set isDirty = false
|
|
126
|
+
}
|
|
127
|
+
if (props.paddingTop.isDirty) {
|
|
128
|
+
view->setPaddingTop(props.paddingTop.value);
|
|
129
|
+
// TODO: Set isDirty = false
|
|
130
|
+
}
|
|
131
|
+
if (props.paddingRight.isDirty) {
|
|
132
|
+
view->setPaddingRight(props.paddingRight.value);
|
|
133
|
+
// TODO: Set isDirty = false
|
|
134
|
+
}
|
|
135
|
+
if (props.paddingBottom.isDirty) {
|
|
136
|
+
view->setPaddingBottom(props.paddingBottom.value);
|
|
137
|
+
// TODO: Set isDirty = false
|
|
138
|
+
}
|
|
139
|
+
if (props.paddingLeft.isDirty) {
|
|
140
|
+
view->setPaddingLeft(props.paddingLeft.value);
|
|
141
|
+
// TODO: Set isDirty = false
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
// Update hybridRef if it changed
|
|
145
|
+
if (props.hybridRef.isDirty) {
|
|
146
|
+
// hybridRef changed - call it with new this
|
|
147
|
+
const auto& maybeFunc = props.hybridRef.value;
|
|
148
|
+
if (maybeFunc.has_value()) {
|
|
149
|
+
std::shared_ptr<JHybridStrokeTextViewSpec> shared = javaView->cthis()->shared_cast<JHybridStrokeTextViewSpec>();
|
|
150
|
+
maybeFunc.value()(shared);
|
|
151
|
+
}
|
|
152
|
+
// TODO: Set isDirty = false
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
} // namespace margelo::nitro::stroketext::views
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
///
|
|
2
|
+
/// JHybridStrokeTextViewStateUpdater.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
|
+
#ifndef RN_SERIALIZABLE_STATE
|
|
11
|
+
#error NitroStrokeText was compiled without the 'RN_SERIALIZABLE_STATE' flag. This flag is required for Nitro Views - set it in your CMakeLists!
|
|
12
|
+
#endif
|
|
13
|
+
|
|
14
|
+
#include <fbjni/fbjni.h>
|
|
15
|
+
#include <react/fabric/StateWrapperImpl.h>
|
|
16
|
+
#include <react/fabric/CoreComponentsRegistry.h>
|
|
17
|
+
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
18
|
+
#include <NitroModules/NitroDefines.hpp>
|
|
19
|
+
#include <NitroModules/JStateWrapper.hpp>
|
|
20
|
+
#include "JHybridStrokeTextViewSpec.hpp"
|
|
21
|
+
#include "views/HybridStrokeTextViewComponent.hpp"
|
|
22
|
+
|
|
23
|
+
namespace margelo::nitro::stroketext::views {
|
|
24
|
+
|
|
25
|
+
using namespace facebook;
|
|
26
|
+
|
|
27
|
+
class JHybridStrokeTextViewStateUpdater: public jni::JavaClass<JHybridStrokeTextViewStateUpdater> {
|
|
28
|
+
public:
|
|
29
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/stroketext/views/HybridStrokeTextViewStateUpdater;";
|
|
30
|
+
|
|
31
|
+
public:
|
|
32
|
+
static void updateViewProps(jni::alias_ref<jni::JClass> /* class */,
|
|
33
|
+
jni::alias_ref<JHybridStrokeTextViewSpec::javaobject> view,
|
|
34
|
+
jni::alias_ref<JStateWrapper::javaobject> stateWrapperInterface);
|
|
35
|
+
|
|
36
|
+
public:
|
|
37
|
+
static void registerNatives() {
|
|
38
|
+
// Register JNI calls
|
|
39
|
+
javaClassStatic()->registerNatives({
|
|
40
|
+
makeNativeMethod("updateViewProps", JHybridStrokeTextViewStateUpdater::updateViewProps),
|
|
41
|
+
});
|
|
42
|
+
// Register React Native view component descriptor
|
|
43
|
+
auto provider = react::concreteComponentDescriptorProvider<HybridStrokeTextViewComponentDescriptor>();
|
|
44
|
+
auto providerRegistry = react::CoreComponentsRegistry::sharedProviderRegistry();
|
|
45
|
+
providerRegistry->add(provider);
|
|
46
|
+
}
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
} // namespace margelo::nitro::stroketext::views
|