@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.
Files changed (82) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/LICENSE.md +21 -0
  3. package/NitroStrokeText.podspec +31 -0
  4. package/README.md +45 -0
  5. package/android/CMakeLists.txt +29 -0
  6. package/android/build.gradle +142 -0
  7. package/android/fix-prefab.gradle +51 -0
  8. package/android/gradle.properties +5 -0
  9. package/android/src/main/AndroidManifest.xml +2 -0
  10. package/android/src/main/cpp/cpp-adapter.cpp +6 -0
  11. package/android/src/main/java/com/margelo/nitro/stroketext/HybridStrokeTextView.kt +107 -0
  12. package/android/src/main/java/com/margelo/nitro/stroketext/NitroStrokeTextPackage.kt +39 -0
  13. package/android/src/main/java/com/margelo/nitro/stroketext/StrokeTextView.kt +429 -0
  14. package/ios/Bridge.h +8 -0
  15. package/ios/HybridStrokeTextView.swift +114 -0
  16. package/ios/StrokeTextColor.swift +120 -0
  17. package/ios/StrokeTextView.swift +326 -0
  18. package/ios/StrokedTextLabel.swift +72 -0
  19. package/lib/StrokeText.d.ts +3 -0
  20. package/lib/StrokeText.js +109 -0
  21. package/lib/StrokeText.web.d.ts +3 -0
  22. package/lib/StrokeText.web.js +106 -0
  23. package/lib/index.d.ts +2 -0
  24. package/lib/index.js +1 -0
  25. package/lib/index.web.d.ts +2 -0
  26. package/lib/index.web.js +1 -0
  27. package/lib/specs/StrokeTextView.nitro.d.ts +37 -0
  28. package/lib/specs/StrokeTextView.nitro.js +1 -0
  29. package/lib/types.d.ts +17 -0
  30. package/lib/types.js +1 -0
  31. package/nitro.json +24 -0
  32. package/nitrogen/generated/.gitattributes +1 -0
  33. package/nitrogen/generated/android/NitroStrokeText+autolinking.cmake +83 -0
  34. package/nitrogen/generated/android/NitroStrokeText+autolinking.gradle +27 -0
  35. package/nitrogen/generated/android/NitroStrokeTextOnLoad.cpp +46 -0
  36. package/nitrogen/generated/android/NitroStrokeTextOnLoad.hpp +25 -0
  37. package/nitrogen/generated/android/c++/JHybridStrokeTextViewSpec.cpp +308 -0
  38. package/nitrogen/generated/android/c++/JHybridStrokeTextViewSpec.hpp +117 -0
  39. package/nitrogen/generated/android/c++/JStrokeTextAlign.hpp +67 -0
  40. package/nitrogen/generated/android/c++/JStrokeTextDecorationLine.hpp +64 -0
  41. package/nitrogen/generated/android/c++/JStrokeTextEllipsizeMode.hpp +64 -0
  42. package/nitrogen/generated/android/c++/JStrokeTextFontStyle.hpp +58 -0
  43. package/nitrogen/generated/android/c++/JStrokeTextTransform.hpp +64 -0
  44. package/nitrogen/generated/android/c++/views/JHybridStrokeTextViewStateUpdater.cpp +156 -0
  45. package/nitrogen/generated/android/c++/views/JHybridStrokeTextViewStateUpdater.hpp +49 -0
  46. package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/HybridStrokeTextViewSpec.kt +209 -0
  47. package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/NitroStrokeTextOnLoad.kt +35 -0
  48. package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/StrokeTextAlign.kt +26 -0
  49. package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/StrokeTextDecorationLine.kt +25 -0
  50. package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/StrokeTextEllipsizeMode.kt +25 -0
  51. package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/StrokeTextFontStyle.kt +23 -0
  52. package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/StrokeTextTransform.kt +25 -0
  53. package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/views/HybridStrokeTextViewManager.kt +70 -0
  54. package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/views/HybridStrokeTextViewStateUpdater.kt +23 -0
  55. package/nitrogen/generated/ios/NitroStrokeText+autolinking.rb +60 -0
  56. package/nitrogen/generated/ios/NitroStrokeText-Swift-Cxx-Bridge.cpp +33 -0
  57. package/nitrogen/generated/ios/NitroStrokeText-Swift-Cxx-Bridge.hpp +177 -0
  58. package/nitrogen/generated/ios/NitroStrokeText-Swift-Cxx-Umbrella.hpp +58 -0
  59. package/nitrogen/generated/ios/NitroStrokeTextAutolinking.mm +33 -0
  60. package/nitrogen/generated/ios/NitroStrokeTextAutolinking.swift +26 -0
  61. package/nitrogen/generated/ios/c++/HybridStrokeTextViewSpecSwift.cpp +11 -0
  62. package/nitrogen/generated/ios/c++/HybridStrokeTextViewSpecSwift.hpp +271 -0
  63. package/nitrogen/generated/ios/c++/views/HybridStrokeTextViewComponent.mm +232 -0
  64. package/nitrogen/generated/ios/swift/HybridStrokeTextViewSpec.swift +81 -0
  65. package/nitrogen/generated/ios/swift/HybridStrokeTextViewSpec_cxx.swift +620 -0
  66. package/nitrogen/generated/ios/swift/StrokeTextAlign.swift +52 -0
  67. package/nitrogen/generated/ios/swift/StrokeTextDecorationLine.swift +48 -0
  68. package/nitrogen/generated/ios/swift/StrokeTextEllipsizeMode.swift +48 -0
  69. package/nitrogen/generated/ios/swift/StrokeTextFontStyle.swift +40 -0
  70. package/nitrogen/generated/ios/swift/StrokeTextTransform.swift +48 -0
  71. package/nitrogen/generated/shared/c++/HybridStrokeTextViewSpec.cpp +72 -0
  72. package/nitrogen/generated/shared/c++/HybridStrokeTextViewSpec.hpp +128 -0
  73. package/nitrogen/generated/shared/c++/StrokeTextAlign.hpp +88 -0
  74. package/nitrogen/generated/shared/c++/StrokeTextDecorationLine.hpp +84 -0
  75. package/nitrogen/generated/shared/c++/StrokeTextEllipsizeMode.hpp +84 -0
  76. package/nitrogen/generated/shared/c++/StrokeTextFontStyle.hpp +76 -0
  77. package/nitrogen/generated/shared/c++/StrokeTextTransform.hpp +84 -0
  78. package/nitrogen/generated/shared/c++/views/HybridStrokeTextViewComponent.cpp +388 -0
  79. package/nitrogen/generated/shared/c++/views/HybridStrokeTextViewComponent.hpp +138 -0
  80. package/nitrogen/generated/shared/json/StrokeTextViewConfig.json +35 -0
  81. package/package.json +124 -0
  82. package/react-native.config.js +16 -0
package/lib/types.d.ts ADDED
@@ -0,0 +1,17 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { StyleProp, TextStyle } from 'react-native';
3
+ import type { StrokeTextAlign, StrokeTextDecorationLine, StrokeTextEllipsizeMode, StrokeTextFontStyle, StrokeTextMethods, StrokeTextProps as StrokeTextNitroProps, StrokeTextTransform, StrokeTextView } from './specs/StrokeTextView.nitro';
4
+ export type { StrokeTextAlign, StrokeTextDecorationLine, StrokeTextEllipsizeMode, StrokeTextFontStyle, StrokeTextMethods, StrokeTextTransform, StrokeTextView, };
5
+ type OptionalKeys<T> = {
6
+ [K in keyof T]-?: {} extends Pick<T, K> ? K : never;
7
+ }[keyof T];
8
+ type OptionalPropsAcceptUndefined<T> = Omit<T, OptionalKeys<T>> & {
9
+ [K in OptionalKeys<T>]?: T[K] | undefined;
10
+ };
11
+ export type StrokeTextNativeProps = OptionalPropsAcceptUndefined<StrokeTextNitroProps>;
12
+ export type StrokeTextProps = OptionalPropsAcceptUndefined<Omit<StrokeTextNitroProps, 'text'> & {
13
+ children?: ReactNode;
14
+ text?: string;
15
+ style?: StyleProp<TextStyle>;
16
+ hybridRef?: (ref: StrokeTextView) => void;
17
+ }>;
package/lib/types.js ADDED
@@ -0,0 +1 @@
1
+ export {};
package/nitro.json ADDED
@@ -0,0 +1,24 @@
1
+ {
2
+ "$schema": "https://nitro.margelo.com/nitro.schema.json",
3
+ "cxxNamespace": [
4
+ "stroketext"
5
+ ],
6
+ "ios": {
7
+ "iosModuleName": "NitroStrokeText"
8
+ },
9
+ "android": {
10
+ "androidNamespace": [
11
+ "stroketext"
12
+ ],
13
+ "androidCxxLibName": "NitroStrokeText"
14
+ },
15
+ "autolinking": {
16
+ "StrokeTextView": {
17
+ "swift": "HybridStrokeTextView",
18
+ "kotlin": "HybridStrokeTextView"
19
+ }
20
+ },
21
+ "ignorePaths": [
22
+ "**/node_modules"
23
+ ]
24
+ }
@@ -0,0 +1 @@
1
+ ** linguist-generated=true
@@ -0,0 +1,83 @@
1
+ #
2
+ # NitroStrokeText+autolinking.cmake
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
+ # This is a CMake file that adds all files generated by Nitrogen
9
+ # to the current CMake project.
10
+ #
11
+ # To use it, add this to your CMakeLists.txt:
12
+ # ```cmake
13
+ # include(${CMAKE_SOURCE_DIR}/../nitrogen/generated/android/NitroStrokeText+autolinking.cmake)
14
+ # ```
15
+
16
+ # Define a flag to check if we are building properly
17
+ add_definitions(-DBUILDING_NITROSTROKETEXT_WITH_GENERATED_CMAKE_PROJECT)
18
+
19
+ # Enable Raw Props parsing in react-native (for Nitro Views)
20
+ add_definitions(-DRN_SERIALIZABLE_STATE)
21
+
22
+ # Add all headers that were generated by Nitrogen
23
+ include_directories(
24
+ "../nitrogen/generated/shared/c++"
25
+ "../nitrogen/generated/android/c++"
26
+ "../nitrogen/generated/android/"
27
+ )
28
+
29
+ # Add all .cpp sources that were generated by Nitrogen
30
+ target_sources(
31
+ # CMake project name (Android C++ library name)
32
+ NitroStrokeText PRIVATE
33
+ # Autolinking Setup
34
+ ../nitrogen/generated/android/NitroStrokeTextOnLoad.cpp
35
+ # Shared Nitrogen C++ sources
36
+ ../nitrogen/generated/shared/c++/HybridStrokeTextViewSpec.cpp
37
+ ../nitrogen/generated/shared/c++/views/HybridStrokeTextViewComponent.cpp
38
+ # Android-specific Nitrogen C++ sources
39
+ ../nitrogen/generated/android/c++/JHybridStrokeTextViewSpec.cpp
40
+ ../nitrogen/generated/android/c++/views/JHybridStrokeTextViewStateUpdater.cpp
41
+ )
42
+
43
+ # From node_modules/react-native/ReactAndroid/cmake-utils/folly-flags.cmake
44
+ # Used in node_modules/react-native/ReactAndroid/cmake-utils/ReactNative-application.cmake
45
+ target_compile_definitions(
46
+ NitroStrokeText PRIVATE
47
+ -DFOLLY_NO_CONFIG=1
48
+ -DFOLLY_HAVE_CLOCK_GETTIME=1
49
+ -DFOLLY_USE_LIBCPP=1
50
+ -DFOLLY_CFG_NO_COROUTINES=1
51
+ -DFOLLY_MOBILE=1
52
+ -DFOLLY_HAVE_RECVMMSG=1
53
+ -DFOLLY_HAVE_PTHREAD=1
54
+ # Once we target android-23 above, we can comment
55
+ # the following line. NDK uses GNU style stderror_r() after API 23.
56
+ -DFOLLY_HAVE_XSI_STRERROR_R=1
57
+ )
58
+
59
+ # Add all libraries required by the generated specs
60
+ find_package(fbjni REQUIRED) # <-- Used for communication between Java <-> C++
61
+ find_package(ReactAndroid REQUIRED) # <-- Used to set up React Native bindings (e.g. CallInvoker/TurboModule)
62
+ find_package(react-native-nitro-modules REQUIRED) # <-- Used to create all HybridObjects and use the Nitro core library
63
+
64
+ # Link all libraries together
65
+ target_link_libraries(
66
+ NitroStrokeText
67
+ fbjni::fbjni # <-- Facebook C++ JNI helpers
68
+ ReactAndroid::jsi # <-- RN: JSI
69
+ react-native-nitro-modules::NitroModules # <-- NitroModules Core :)
70
+ )
71
+
72
+ # Link react-native (different prefab between RN 0.75 and RN 0.76)
73
+ if(ReactAndroid_VERSION_MINOR GREATER_EQUAL 76)
74
+ target_link_libraries(
75
+ NitroStrokeText
76
+ ReactAndroid::reactnative # <-- RN: Native Modules umbrella prefab
77
+ )
78
+ else()
79
+ target_link_libraries(
80
+ NitroStrokeText
81
+ ReactAndroid::react_nativemodule_core # <-- RN: TurboModules Core
82
+ )
83
+ endif()
@@ -0,0 +1,27 @@
1
+ ///
2
+ /// NitroStrokeText+autolinking.gradle
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
+ /// This is a Gradle file that adds all files generated by Nitrogen
9
+ /// to the current Gradle project.
10
+ ///
11
+ /// To use it, add this to your build.gradle:
12
+ /// ```gradle
13
+ /// apply from: '../nitrogen/generated/android/NitroStrokeText+autolinking.gradle'
14
+ /// ```
15
+
16
+ logger.warn("[NitroModules] 🔥 NitroStrokeText is boosted by nitro!")
17
+
18
+ android {
19
+ sourceSets {
20
+ main {
21
+ java.srcDirs += [
22
+ // Nitrogen files
23
+ "${project.projectDir}/../nitrogen/generated/android/kotlin"
24
+ ]
25
+ }
26
+ }
27
+ }
@@ -0,0 +1,46 @@
1
+ ///
2
+ /// NitroStrokeTextOnLoad.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
+ #ifndef BUILDING_NITROSTROKETEXT_WITH_GENERATED_CMAKE_PROJECT
9
+ #error NitroStrokeTextOnLoad.cpp is not being built with the autogenerated CMakeLists.txt project. Is a different CMakeLists.txt building this?
10
+ #endif
11
+
12
+ #include "NitroStrokeTextOnLoad.hpp"
13
+
14
+ #include <jni.h>
15
+ #include <fbjni/fbjni.h>
16
+ #include <NitroModules/HybridObjectRegistry.hpp>
17
+
18
+ #include "JHybridStrokeTextViewSpec.hpp"
19
+ #include "views/JHybridStrokeTextViewStateUpdater.hpp"
20
+ #include <NitroModules/DefaultConstructableObject.hpp>
21
+
22
+ namespace margelo::nitro::stroketext {
23
+
24
+ int initialize(JavaVM* vm) {
25
+ using namespace margelo::nitro;
26
+ using namespace margelo::nitro::stroketext;
27
+ using namespace facebook;
28
+
29
+ return facebook::jni::initialize(vm, [] {
30
+ // Register native JNI methods
31
+ margelo::nitro::stroketext::JHybridStrokeTextViewSpec::registerNatives();
32
+ margelo::nitro::stroketext::views::JHybridStrokeTextViewStateUpdater::registerNatives();
33
+
34
+ // Register Nitro Hybrid Objects
35
+ HybridObjectRegistry::registerHybridObjectConstructor(
36
+ "StrokeTextView",
37
+ []() -> std::shared_ptr<HybridObject> {
38
+ static DefaultConstructableObject<JHybridStrokeTextViewSpec::javaobject> object("com/margelo/nitro/stroketext/HybridStrokeTextView");
39
+ auto instance = object.create();
40
+ return instance->cthis()->shared();
41
+ }
42
+ );
43
+ });
44
+ }
45
+
46
+ } // namespace margelo::nitro::stroketext
@@ -0,0 +1,25 @@
1
+ ///
2
+ /// NitroStrokeTextOnLoad.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
+ #include <jni.h>
9
+ #include <NitroModules/NitroDefines.hpp>
10
+
11
+ namespace margelo::nitro::stroketext {
12
+
13
+ /**
14
+ * Initializes the native (C++) part of NitroStrokeText, and autolinks all Hybrid Objects.
15
+ * Call this in your `JNI_OnLoad` function (probably inside `cpp-adapter.cpp`).
16
+ * Example:
17
+ * ```cpp (cpp-adapter.cpp)
18
+ * JNIEXPORT jint JNICALL JNI_OnLoad(JavaVM* vm, void*) {
19
+ * return margelo::nitro::stroketext::initialize(vm);
20
+ * }
21
+ * ```
22
+ */
23
+ int initialize(JavaVM* vm);
24
+
25
+ } // namespace margelo::nitro::stroketext
@@ -0,0 +1,308 @@
1
+ ///
2
+ /// JHybridStrokeTextViewSpec.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 "JHybridStrokeTextViewSpec.hpp"
9
+
10
+ // Forward declaration of `StrokeTextFontStyle` to properly resolve imports.
11
+ namespace margelo::nitro::stroketext { enum class StrokeTextFontStyle; }
12
+ // Forward declaration of `StrokeTextAlign` to properly resolve imports.
13
+ namespace margelo::nitro::stroketext { enum class StrokeTextAlign; }
14
+ // Forward declaration of `StrokeTextDecorationLine` to properly resolve imports.
15
+ namespace margelo::nitro::stroketext { enum class StrokeTextDecorationLine; }
16
+ // Forward declaration of `StrokeTextTransform` to properly resolve imports.
17
+ namespace margelo::nitro::stroketext { enum class StrokeTextTransform; }
18
+ // Forward declaration of `StrokeTextEllipsizeMode` to properly resolve imports.
19
+ namespace margelo::nitro::stroketext { enum class StrokeTextEllipsizeMode; }
20
+
21
+ #include <string>
22
+ #include <optional>
23
+ #include "StrokeTextFontStyle.hpp"
24
+ #include "JStrokeTextFontStyle.hpp"
25
+ #include "StrokeTextAlign.hpp"
26
+ #include "JStrokeTextAlign.hpp"
27
+ #include "StrokeTextDecorationLine.hpp"
28
+ #include "JStrokeTextDecorationLine.hpp"
29
+ #include "StrokeTextTransform.hpp"
30
+ #include "JStrokeTextTransform.hpp"
31
+ #include "StrokeTextEllipsizeMode.hpp"
32
+ #include "JStrokeTextEllipsizeMode.hpp"
33
+
34
+ namespace margelo::nitro::stroketext {
35
+
36
+ jni::local_ref<JHybridStrokeTextViewSpec::jhybriddata> JHybridStrokeTextViewSpec::initHybrid(jni::alias_ref<jhybridobject> jThis) {
37
+ return makeCxxInstance(jThis);
38
+ }
39
+
40
+ void JHybridStrokeTextViewSpec::registerNatives() {
41
+ registerHybrid({
42
+ makeNativeMethod("initHybrid", JHybridStrokeTextViewSpec::initHybrid),
43
+ });
44
+ }
45
+
46
+ size_t JHybridStrokeTextViewSpec::getExternalMemorySize() noexcept {
47
+ static const auto method = javaClassStatic()->getMethod<jlong()>("getMemorySize");
48
+ return method(_javaPart);
49
+ }
50
+
51
+ bool JHybridStrokeTextViewSpec::equals(const std::shared_ptr<HybridObject>& other) {
52
+ if (auto otherCast = std::dynamic_pointer_cast<JHybridStrokeTextViewSpec>(other)) {
53
+ return _javaPart == otherCast->_javaPart;
54
+ }
55
+ return false;
56
+ }
57
+
58
+ void JHybridStrokeTextViewSpec::dispose() noexcept {
59
+ static const auto method = javaClassStatic()->getMethod<void()>("dispose");
60
+ method(_javaPart);
61
+ }
62
+
63
+ std::string JHybridStrokeTextViewSpec::toString() {
64
+ static const auto method = javaClassStatic()->getMethod<jni::JString()>("toString");
65
+ auto javaString = method(_javaPart);
66
+ return javaString->toStdString();
67
+ }
68
+
69
+ // Properties
70
+ std::string JHybridStrokeTextViewSpec::getText() {
71
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getText");
72
+ auto __result = method(_javaPart);
73
+ return __result->toStdString();
74
+ }
75
+ void JHybridStrokeTextViewSpec::setText(const std::string& text) {
76
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* text */)>("setText");
77
+ method(_javaPart, jni::make_jstring(text));
78
+ }
79
+ std::optional<std::string> JHybridStrokeTextViewSpec::getColor() {
80
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getColor");
81
+ auto __result = method(_javaPart);
82
+ return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
83
+ }
84
+ void JHybridStrokeTextViewSpec::setColor(const std::optional<std::string>& color) {
85
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* color */)>("setColor");
86
+ method(_javaPart, color.has_value() ? jni::make_jstring(color.value()) : nullptr);
87
+ }
88
+ std::optional<std::string> JHybridStrokeTextViewSpec::getStrokeColor() {
89
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getStrokeColor");
90
+ auto __result = method(_javaPart);
91
+ return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
92
+ }
93
+ void JHybridStrokeTextViewSpec::setStrokeColor(const std::optional<std::string>& strokeColor) {
94
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* strokeColor */)>("setStrokeColor");
95
+ method(_javaPart, strokeColor.has_value() ? jni::make_jstring(strokeColor.value()) : nullptr);
96
+ }
97
+ std::optional<double> JHybridStrokeTextViewSpec::getStrokeWidth() {
98
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getStrokeWidth");
99
+ auto __result = method(_javaPart);
100
+ return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
101
+ }
102
+ void JHybridStrokeTextViewSpec::setStrokeWidth(std::optional<double> strokeWidth) {
103
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* strokeWidth */)>("setStrokeWidth");
104
+ method(_javaPart, strokeWidth.has_value() ? jni::JDouble::valueOf(strokeWidth.value()) : nullptr);
105
+ }
106
+ std::optional<double> JHybridStrokeTextViewSpec::getFontSize() {
107
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getFontSize");
108
+ auto __result = method(_javaPart);
109
+ return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
110
+ }
111
+ void JHybridStrokeTextViewSpec::setFontSize(std::optional<double> fontSize) {
112
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* fontSize */)>("setFontSize");
113
+ method(_javaPart, fontSize.has_value() ? jni::JDouble::valueOf(fontSize.value()) : nullptr);
114
+ }
115
+ std::optional<std::string> JHybridStrokeTextViewSpec::getFontWeight() {
116
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getFontWeight");
117
+ auto __result = method(_javaPart);
118
+ return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
119
+ }
120
+ void JHybridStrokeTextViewSpec::setFontWeight(const std::optional<std::string>& fontWeight) {
121
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* fontWeight */)>("setFontWeight");
122
+ method(_javaPart, fontWeight.has_value() ? jni::make_jstring(fontWeight.value()) : nullptr);
123
+ }
124
+ std::optional<std::string> JHybridStrokeTextViewSpec::getFontFamily() {
125
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JString>()>("getFontFamily");
126
+ auto __result = method(_javaPart);
127
+ return __result != nullptr ? std::make_optional(__result->toStdString()) : std::nullopt;
128
+ }
129
+ void JHybridStrokeTextViewSpec::setFontFamily(const std::optional<std::string>& fontFamily) {
130
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JString> /* fontFamily */)>("setFontFamily");
131
+ method(_javaPart, fontFamily.has_value() ? jni::make_jstring(fontFamily.value()) : nullptr);
132
+ }
133
+ std::optional<StrokeTextFontStyle> JHybridStrokeTextViewSpec::getFontStyle() {
134
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<JStrokeTextFontStyle>()>("getFontStyle");
135
+ auto __result = method(_javaPart);
136
+ return __result != nullptr ? std::make_optional(__result->toCpp()) : std::nullopt;
137
+ }
138
+ void JHybridStrokeTextViewSpec::setFontStyle(std::optional<StrokeTextFontStyle> fontStyle) {
139
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JStrokeTextFontStyle> /* fontStyle */)>("setFontStyle");
140
+ method(_javaPart, fontStyle.has_value() ? JStrokeTextFontStyle::fromCpp(fontStyle.value()) : nullptr);
141
+ }
142
+ std::optional<double> JHybridStrokeTextViewSpec::getLineHeight() {
143
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getLineHeight");
144
+ auto __result = method(_javaPart);
145
+ return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
146
+ }
147
+ void JHybridStrokeTextViewSpec::setLineHeight(std::optional<double> lineHeight) {
148
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* lineHeight */)>("setLineHeight");
149
+ method(_javaPart, lineHeight.has_value() ? jni::JDouble::valueOf(lineHeight.value()) : nullptr);
150
+ }
151
+ std::optional<double> JHybridStrokeTextViewSpec::getLetterSpacing() {
152
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getLetterSpacing");
153
+ auto __result = method(_javaPart);
154
+ return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
155
+ }
156
+ void JHybridStrokeTextViewSpec::setLetterSpacing(std::optional<double> letterSpacing) {
157
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* letterSpacing */)>("setLetterSpacing");
158
+ method(_javaPart, letterSpacing.has_value() ? jni::JDouble::valueOf(letterSpacing.value()) : nullptr);
159
+ }
160
+ std::optional<StrokeTextAlign> JHybridStrokeTextViewSpec::getTextAlign() {
161
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<JStrokeTextAlign>()>("getTextAlign");
162
+ auto __result = method(_javaPart);
163
+ return __result != nullptr ? std::make_optional(__result->toCpp()) : std::nullopt;
164
+ }
165
+ void JHybridStrokeTextViewSpec::setTextAlign(std::optional<StrokeTextAlign> textAlign) {
166
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JStrokeTextAlign> /* textAlign */)>("setTextAlign");
167
+ method(_javaPart, textAlign.has_value() ? JStrokeTextAlign::fromCpp(textAlign.value()) : nullptr);
168
+ }
169
+ std::optional<StrokeTextDecorationLine> JHybridStrokeTextViewSpec::getTextDecorationLine() {
170
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<JStrokeTextDecorationLine>()>("getTextDecorationLine");
171
+ auto __result = method(_javaPart);
172
+ return __result != nullptr ? std::make_optional(__result->toCpp()) : std::nullopt;
173
+ }
174
+ void JHybridStrokeTextViewSpec::setTextDecorationLine(std::optional<StrokeTextDecorationLine> textDecorationLine) {
175
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JStrokeTextDecorationLine> /* textDecorationLine */)>("setTextDecorationLine");
176
+ method(_javaPart, textDecorationLine.has_value() ? JStrokeTextDecorationLine::fromCpp(textDecorationLine.value()) : nullptr);
177
+ }
178
+ std::optional<StrokeTextTransform> JHybridStrokeTextViewSpec::getTextTransform() {
179
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<JStrokeTextTransform>()>("getTextTransform");
180
+ auto __result = method(_javaPart);
181
+ return __result != nullptr ? std::make_optional(__result->toCpp()) : std::nullopt;
182
+ }
183
+ void JHybridStrokeTextViewSpec::setTextTransform(std::optional<StrokeTextTransform> textTransform) {
184
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JStrokeTextTransform> /* textTransform */)>("setTextTransform");
185
+ method(_javaPart, textTransform.has_value() ? JStrokeTextTransform::fromCpp(textTransform.value()) : nullptr);
186
+ }
187
+ std::optional<double> JHybridStrokeTextViewSpec::getOpacity() {
188
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getOpacity");
189
+ auto __result = method(_javaPart);
190
+ return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
191
+ }
192
+ void JHybridStrokeTextViewSpec::setOpacity(std::optional<double> opacity) {
193
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* opacity */)>("setOpacity");
194
+ method(_javaPart, opacity.has_value() ? jni::JDouble::valueOf(opacity.value()) : nullptr);
195
+ }
196
+ std::optional<bool> JHybridStrokeTextViewSpec::getAllowFontScaling() {
197
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getAllowFontScaling");
198
+ auto __result = method(_javaPart);
199
+ return __result != nullptr ? std::make_optional(static_cast<bool>(__result->value())) : std::nullopt;
200
+ }
201
+ void JHybridStrokeTextViewSpec::setAllowFontScaling(std::optional<bool> allowFontScaling) {
202
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* allowFontScaling */)>("setAllowFontScaling");
203
+ method(_javaPart, allowFontScaling.has_value() ? jni::JBoolean::valueOf(allowFontScaling.value()) : nullptr);
204
+ }
205
+ std::optional<double> JHybridStrokeTextViewSpec::getMaxFontSizeMultiplier() {
206
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getMaxFontSizeMultiplier");
207
+ auto __result = method(_javaPart);
208
+ return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
209
+ }
210
+ void JHybridStrokeTextViewSpec::setMaxFontSizeMultiplier(std::optional<double> maxFontSizeMultiplier) {
211
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* maxFontSizeMultiplier */)>("setMaxFontSizeMultiplier");
212
+ method(_javaPart, maxFontSizeMultiplier.has_value() ? jni::JDouble::valueOf(maxFontSizeMultiplier.value()) : nullptr);
213
+ }
214
+ std::optional<bool> JHybridStrokeTextViewSpec::getIncludeFontPadding() {
215
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JBoolean>()>("getIncludeFontPadding");
216
+ auto __result = method(_javaPart);
217
+ return __result != nullptr ? std::make_optional(static_cast<bool>(__result->value())) : std::nullopt;
218
+ }
219
+ void JHybridStrokeTextViewSpec::setIncludeFontPadding(std::optional<bool> includeFontPadding) {
220
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JBoolean> /* includeFontPadding */)>("setIncludeFontPadding");
221
+ method(_javaPart, includeFontPadding.has_value() ? jni::JBoolean::valueOf(includeFontPadding.value()) : nullptr);
222
+ }
223
+ std::optional<double> JHybridStrokeTextViewSpec::getNumberOfLines() {
224
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getNumberOfLines");
225
+ auto __result = method(_javaPart);
226
+ return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
227
+ }
228
+ void JHybridStrokeTextViewSpec::setNumberOfLines(std::optional<double> numberOfLines) {
229
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* numberOfLines */)>("setNumberOfLines");
230
+ method(_javaPart, numberOfLines.has_value() ? jni::JDouble::valueOf(numberOfLines.value()) : nullptr);
231
+ }
232
+ std::optional<StrokeTextEllipsizeMode> JHybridStrokeTextViewSpec::getEllipsizeMode() {
233
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<JStrokeTextEllipsizeMode>()>("getEllipsizeMode");
234
+ auto __result = method(_javaPart);
235
+ return __result != nullptr ? std::make_optional(__result->toCpp()) : std::nullopt;
236
+ }
237
+ void JHybridStrokeTextViewSpec::setEllipsizeMode(std::optional<StrokeTextEllipsizeMode> ellipsizeMode) {
238
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<JStrokeTextEllipsizeMode> /* ellipsizeMode */)>("setEllipsizeMode");
239
+ method(_javaPart, ellipsizeMode.has_value() ? JStrokeTextEllipsizeMode::fromCpp(ellipsizeMode.value()) : nullptr);
240
+ }
241
+ std::optional<double> JHybridStrokeTextViewSpec::getPadding() {
242
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPadding");
243
+ auto __result = method(_javaPart);
244
+ return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
245
+ }
246
+ void JHybridStrokeTextViewSpec::setPadding(std::optional<double> padding) {
247
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* padding */)>("setPadding");
248
+ method(_javaPart, padding.has_value() ? jni::JDouble::valueOf(padding.value()) : nullptr);
249
+ }
250
+ std::optional<double> JHybridStrokeTextViewSpec::getPaddingVertical() {
251
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPaddingVertical");
252
+ auto __result = method(_javaPart);
253
+ return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
254
+ }
255
+ void JHybridStrokeTextViewSpec::setPaddingVertical(std::optional<double> paddingVertical) {
256
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* paddingVertical */)>("setPaddingVertical");
257
+ method(_javaPart, paddingVertical.has_value() ? jni::JDouble::valueOf(paddingVertical.value()) : nullptr);
258
+ }
259
+ std::optional<double> JHybridStrokeTextViewSpec::getPaddingHorizontal() {
260
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPaddingHorizontal");
261
+ auto __result = method(_javaPart);
262
+ return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
263
+ }
264
+ void JHybridStrokeTextViewSpec::setPaddingHorizontal(std::optional<double> paddingHorizontal) {
265
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* paddingHorizontal */)>("setPaddingHorizontal");
266
+ method(_javaPart, paddingHorizontal.has_value() ? jni::JDouble::valueOf(paddingHorizontal.value()) : nullptr);
267
+ }
268
+ std::optional<double> JHybridStrokeTextViewSpec::getPaddingTop() {
269
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPaddingTop");
270
+ auto __result = method(_javaPart);
271
+ return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
272
+ }
273
+ void JHybridStrokeTextViewSpec::setPaddingTop(std::optional<double> paddingTop) {
274
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* paddingTop */)>("setPaddingTop");
275
+ method(_javaPart, paddingTop.has_value() ? jni::JDouble::valueOf(paddingTop.value()) : nullptr);
276
+ }
277
+ std::optional<double> JHybridStrokeTextViewSpec::getPaddingRight() {
278
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPaddingRight");
279
+ auto __result = method(_javaPart);
280
+ return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
281
+ }
282
+ void JHybridStrokeTextViewSpec::setPaddingRight(std::optional<double> paddingRight) {
283
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* paddingRight */)>("setPaddingRight");
284
+ method(_javaPart, paddingRight.has_value() ? jni::JDouble::valueOf(paddingRight.value()) : nullptr);
285
+ }
286
+ std::optional<double> JHybridStrokeTextViewSpec::getPaddingBottom() {
287
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPaddingBottom");
288
+ auto __result = method(_javaPart);
289
+ return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
290
+ }
291
+ void JHybridStrokeTextViewSpec::setPaddingBottom(std::optional<double> paddingBottom) {
292
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* paddingBottom */)>("setPaddingBottom");
293
+ method(_javaPart, paddingBottom.has_value() ? jni::JDouble::valueOf(paddingBottom.value()) : nullptr);
294
+ }
295
+ std::optional<double> JHybridStrokeTextViewSpec::getPaddingLeft() {
296
+ static const auto method = javaClassStatic()->getMethod<jni::local_ref<jni::JDouble>()>("getPaddingLeft");
297
+ auto __result = method(_javaPart);
298
+ return __result != nullptr ? std::make_optional(__result->value()) : std::nullopt;
299
+ }
300
+ void JHybridStrokeTextViewSpec::setPaddingLeft(std::optional<double> paddingLeft) {
301
+ static const auto method = javaClassStatic()->getMethod<void(jni::alias_ref<jni::JDouble> /* paddingLeft */)>("setPaddingLeft");
302
+ method(_javaPart, paddingLeft.has_value() ? jni::JDouble::valueOf(paddingLeft.value()) : nullptr);
303
+ }
304
+
305
+ // Methods
306
+
307
+
308
+ } // namespace margelo::nitro::stroketext
@@ -0,0 +1,117 @@
1
+ ///
2
+ /// HybridStrokeTextViewSpec.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 <NitroModules/JHybridObject.hpp>
11
+ #include <fbjni/fbjni.h>
12
+ #include "HybridStrokeTextViewSpec.hpp"
13
+
14
+
15
+
16
+
17
+ namespace margelo::nitro::stroketext {
18
+
19
+ using namespace facebook;
20
+
21
+ class JHybridStrokeTextViewSpec: public jni::HybridClass<JHybridStrokeTextViewSpec, JHybridObject>,
22
+ public virtual HybridStrokeTextViewSpec {
23
+ public:
24
+ static auto constexpr kJavaDescriptor = "Lcom/margelo/nitro/stroketext/HybridStrokeTextViewSpec;";
25
+ static jni::local_ref<jhybriddata> initHybrid(jni::alias_ref<jhybridobject> jThis);
26
+ static void registerNatives();
27
+
28
+ protected:
29
+ // C++ constructor (called from Java via `initHybrid()`)
30
+ explicit JHybridStrokeTextViewSpec(jni::alias_ref<jhybridobject> jThis) :
31
+ HybridObject(HybridStrokeTextViewSpec::TAG),
32
+ HybridBase(jThis),
33
+ _javaPart(jni::make_global(jThis)) {}
34
+
35
+ public:
36
+ ~JHybridStrokeTextViewSpec() override {
37
+ // Hermes GC can destroy JS objects on a non-JNI Thread.
38
+ jni::ThreadScope::WithClassLoader([&] { _javaPart.reset(); });
39
+ }
40
+
41
+ public:
42
+ size_t getExternalMemorySize() noexcept override;
43
+ bool equals(const std::shared_ptr<HybridObject>& other) override;
44
+ void dispose() noexcept override;
45
+ std::string toString() override;
46
+
47
+ public:
48
+ inline const jni::global_ref<JHybridStrokeTextViewSpec::javaobject>& getJavaPart() const noexcept {
49
+ return _javaPart;
50
+ }
51
+
52
+ public:
53
+ // Properties
54
+ std::string getText() override;
55
+ void setText(const std::string& text) override;
56
+ std::optional<std::string> getColor() override;
57
+ void setColor(const std::optional<std::string>& color) override;
58
+ std::optional<std::string> getStrokeColor() override;
59
+ void setStrokeColor(const std::optional<std::string>& strokeColor) override;
60
+ std::optional<double> getStrokeWidth() override;
61
+ void setStrokeWidth(std::optional<double> strokeWidth) override;
62
+ std::optional<double> getFontSize() override;
63
+ void setFontSize(std::optional<double> fontSize) override;
64
+ std::optional<std::string> getFontWeight() override;
65
+ void setFontWeight(const std::optional<std::string>& fontWeight) override;
66
+ std::optional<std::string> getFontFamily() override;
67
+ void setFontFamily(const std::optional<std::string>& fontFamily) override;
68
+ std::optional<StrokeTextFontStyle> getFontStyle() override;
69
+ void setFontStyle(std::optional<StrokeTextFontStyle> fontStyle) override;
70
+ std::optional<double> getLineHeight() override;
71
+ void setLineHeight(std::optional<double> lineHeight) override;
72
+ std::optional<double> getLetterSpacing() override;
73
+ void setLetterSpacing(std::optional<double> letterSpacing) override;
74
+ std::optional<StrokeTextAlign> getTextAlign() override;
75
+ void setTextAlign(std::optional<StrokeTextAlign> textAlign) override;
76
+ std::optional<StrokeTextDecorationLine> getTextDecorationLine() override;
77
+ void setTextDecorationLine(std::optional<StrokeTextDecorationLine> textDecorationLine) override;
78
+ std::optional<StrokeTextTransform> getTextTransform() override;
79
+ void setTextTransform(std::optional<StrokeTextTransform> textTransform) override;
80
+ std::optional<double> getOpacity() override;
81
+ void setOpacity(std::optional<double> opacity) override;
82
+ std::optional<bool> getAllowFontScaling() override;
83
+ void setAllowFontScaling(std::optional<bool> allowFontScaling) override;
84
+ std::optional<double> getMaxFontSizeMultiplier() override;
85
+ void setMaxFontSizeMultiplier(std::optional<double> maxFontSizeMultiplier) override;
86
+ std::optional<bool> getIncludeFontPadding() override;
87
+ void setIncludeFontPadding(std::optional<bool> includeFontPadding) override;
88
+ std::optional<double> getNumberOfLines() override;
89
+ void setNumberOfLines(std::optional<double> numberOfLines) override;
90
+ std::optional<StrokeTextEllipsizeMode> getEllipsizeMode() override;
91
+ void setEllipsizeMode(std::optional<StrokeTextEllipsizeMode> ellipsizeMode) override;
92
+ std::optional<double> getPadding() override;
93
+ void setPadding(std::optional<double> padding) override;
94
+ std::optional<double> getPaddingVertical() override;
95
+ void setPaddingVertical(std::optional<double> paddingVertical) override;
96
+ std::optional<double> getPaddingHorizontal() override;
97
+ void setPaddingHorizontal(std::optional<double> paddingHorizontal) override;
98
+ std::optional<double> getPaddingTop() override;
99
+ void setPaddingTop(std::optional<double> paddingTop) override;
100
+ std::optional<double> getPaddingRight() override;
101
+ void setPaddingRight(std::optional<double> paddingRight) override;
102
+ std::optional<double> getPaddingBottom() override;
103
+ void setPaddingBottom(std::optional<double> paddingBottom) override;
104
+ std::optional<double> getPaddingLeft() override;
105
+ void setPaddingLeft(std::optional<double> paddingLeft) override;
106
+
107
+ public:
108
+ // Methods
109
+
110
+
111
+ private:
112
+ friend HybridBase;
113
+ using HybridBase::HybridBase;
114
+ jni::global_ref<JHybridStrokeTextViewSpec::javaobject> _javaPart;
115
+ };
116
+
117
+ } // namespace margelo::nitro::stroketext