@whetware/react-native-stroke-text 0.0.12 → 0.0.13
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 +8 -0
- package/android/src/main/cpp/cpp-adapter.cpp +4 -1
- package/android/src/main/java/com/margelo/nitro/stroketext/HybridStrokeTextView.kt +5 -11
- package/android/src/main/java/com/margelo/nitro/stroketext/NitroStrokeTextPackage.kt +2 -2
- package/nitro.json +8 -2
- package/nitrogen/generated/android/NitroStrokeTextOnLoad.cpp +27 -17
- package/nitrogen/generated/android/NitroStrokeTextOnLoad.hpp +13 -4
- package/nitrogen/generated/android/c++/JHybridStrokeTextViewSpec.cpp +72 -78
- package/nitrogen/generated/android/c++/JHybridStrokeTextViewSpec.hpp +19 -22
- package/nitrogen/generated/android/c++/JStrokeTextAlign.hpp +2 -2
- package/nitrogen/generated/android/c++/JStrokeTextAlignVertical.hpp +2 -2
- package/nitrogen/generated/android/c++/JStrokeTextDecorationLine.hpp +2 -2
- package/nitrogen/generated/android/c++/JStrokeTextEllipsizeMode.hpp +2 -2
- package/nitrogen/generated/android/c++/JStrokeTextFontStyle.hpp +2 -2
- package/nitrogen/generated/android/c++/JStrokeTextTransform.hpp +2 -2
- package/nitrogen/generated/android/c++/views/JHybridStrokeTextViewStateUpdater.cpp +94 -94
- package/nitrogen/generated/android/c++/views/JHybridStrokeTextViewStateUpdater.hpp +3 -3
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/HybridStrokeTextViewSpec.kt +16 -18
- package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/views/HybridStrokeTextViewManager.kt +13 -3
- package/nitrogen/generated/ios/NitroStrokeText+autolinking.rb +2 -0
- package/nitrogen/generated/ios/NitroStrokeText-Swift-Cxx-Bridge.hpp +9 -9
- package/nitrogen/generated/ios/c++/views/HybridStrokeTextViewComponent.mm +15 -0
- package/nitrogen/generated/ios/swift/HybridStrokeTextViewSpec.swift +0 -1
- package/nitrogen/generated/ios/swift/HybridStrokeTextViewSpec_cxx.swift +147 -46
- package/nitrogen/generated/shared/c++/views/HybridStrokeTextViewComponent.cpp +5 -36
- package/nitrogen/generated/shared/c++/views/HybridStrokeTextViewComponent.hpp +8 -5
- package/package.json +11 -11
- package/android/src/main/java/com/margelo/nitro/stroketext/views/StrokeTextViewManager.kt +0 -15
|
@@ -15,11 +15,11 @@ namespace margelo::nitro::stroketext {
|
|
|
15
15
|
using namespace facebook;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* The C++ JNI bridge between the C++ enum "StrokeTextAlignVertical" and the
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "StrokeTextAlignVertical" and the Kotlin enum "StrokeTextAlignVertical".
|
|
19
19
|
*/
|
|
20
20
|
struct JStrokeTextAlignVertical final: public jni::JavaClass<JStrokeTextAlignVertical> {
|
|
21
21
|
public:
|
|
22
|
-
static auto
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/stroketext/StrokeTextAlignVertical;";
|
|
23
23
|
|
|
24
24
|
public:
|
|
25
25
|
/**
|
|
@@ -15,11 +15,11 @@ namespace margelo::nitro::stroketext {
|
|
|
15
15
|
using namespace facebook;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* The C++ JNI bridge between the C++ enum "StrokeTextDecorationLine" and the
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "StrokeTextDecorationLine" and the Kotlin enum "StrokeTextDecorationLine".
|
|
19
19
|
*/
|
|
20
20
|
struct JStrokeTextDecorationLine final: public jni::JavaClass<JStrokeTextDecorationLine> {
|
|
21
21
|
public:
|
|
22
|
-
static auto
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/stroketext/StrokeTextDecorationLine;";
|
|
23
23
|
|
|
24
24
|
public:
|
|
25
25
|
/**
|
|
@@ -15,11 +15,11 @@ namespace margelo::nitro::stroketext {
|
|
|
15
15
|
using namespace facebook;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* The C++ JNI bridge between the C++ enum "StrokeTextEllipsizeMode" and the
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "StrokeTextEllipsizeMode" and the Kotlin enum "StrokeTextEllipsizeMode".
|
|
19
19
|
*/
|
|
20
20
|
struct JStrokeTextEllipsizeMode final: public jni::JavaClass<JStrokeTextEllipsizeMode> {
|
|
21
21
|
public:
|
|
22
|
-
static auto
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/stroketext/StrokeTextEllipsizeMode;";
|
|
23
23
|
|
|
24
24
|
public:
|
|
25
25
|
/**
|
|
@@ -15,11 +15,11 @@ namespace margelo::nitro::stroketext {
|
|
|
15
15
|
using namespace facebook;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* The C++ JNI bridge between the C++ enum "StrokeTextFontStyle" and the
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "StrokeTextFontStyle" and the Kotlin enum "StrokeTextFontStyle".
|
|
19
19
|
*/
|
|
20
20
|
struct JStrokeTextFontStyle final: public jni::JavaClass<JStrokeTextFontStyle> {
|
|
21
21
|
public:
|
|
22
|
-
static auto
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/stroketext/StrokeTextFontStyle;";
|
|
23
23
|
|
|
24
24
|
public:
|
|
25
25
|
/**
|
|
@@ -15,11 +15,11 @@ namespace margelo::nitro::stroketext {
|
|
|
15
15
|
using namespace facebook;
|
|
16
16
|
|
|
17
17
|
/**
|
|
18
|
-
* The C++ JNI bridge between the C++ enum "StrokeTextTransform" and the
|
|
18
|
+
* The C++ JNI bridge between the C++ enum "StrokeTextTransform" and the Kotlin enum "StrokeTextTransform".
|
|
19
19
|
*/
|
|
20
20
|
struct JStrokeTextTransform final: public jni::JavaClass<JStrokeTextTransform> {
|
|
21
21
|
public:
|
|
22
|
-
static auto
|
|
22
|
+
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/stroketext/StrokeTextTransform;";
|
|
23
23
|
|
|
24
24
|
public:
|
|
25
25
|
/**
|
|
@@ -8,6 +8,7 @@
|
|
|
8
8
|
#include "JHybridStrokeTextViewStateUpdater.hpp"
|
|
9
9
|
#include "views/HybridStrokeTextViewComponent.hpp"
|
|
10
10
|
#include <NitroModules/NitroDefines.hpp>
|
|
11
|
+
#include <react/fabric/StateWrapperImpl.h>
|
|
11
12
|
|
|
12
13
|
namespace margelo::nitro::stroketext::views {
|
|
13
14
|
|
|
@@ -15,145 +16,144 @@ using namespace facebook;
|
|
|
15
16
|
using ConcreteStateData = react::ConcreteState<HybridStrokeTextViewState>;
|
|
16
17
|
|
|
17
18
|
void JHybridStrokeTextViewStateUpdater::updateViewProps(jni::alias_ref<jni::JClass> /* class */,
|
|
18
|
-
jni::alias_ref<JHybridStrokeTextViewSpec::
|
|
19
|
+
jni::alias_ref<JHybridStrokeTextViewSpec::JavaPart> javaView,
|
|
19
20
|
jni::alias_ref<JStateWrapper::javaobject> stateWrapperInterface) {
|
|
20
|
-
JHybridStrokeTextViewSpec
|
|
21
|
+
std::shared_ptr<JHybridStrokeTextViewSpec> hybridView = javaView->getJHybridStrokeTextViewSpec();
|
|
21
22
|
|
|
22
23
|
// Get concrete StateWrapperImpl from passed StateWrapper interface object
|
|
23
24
|
jobject rawStateWrapper = stateWrapperInterface.get();
|
|
24
|
-
if (!stateWrapperInterface->isInstanceOf(react::StateWrapperImpl::javaClassStatic())) {
|
|
25
|
+
if (!stateWrapperInterface->isInstanceOf(react::StateWrapperImpl::javaClassStatic())) [[unlikely]] {
|
|
25
26
|
throw std::runtime_error("StateWrapper is not a StateWrapperImpl");
|
|
26
27
|
}
|
|
27
28
|
auto stateWrapper = jni::alias_ref<react::StateWrapperImpl::javaobject>{
|
|
28
29
|
static_cast<react::StateWrapperImpl::javaobject>(rawStateWrapper)};
|
|
29
|
-
|
|
30
30
|
std::shared_ptr<const react::State> state = stateWrapper->cthis()->getState();
|
|
31
|
-
auto concreteState = std::
|
|
31
|
+
auto concreteState = std::static_pointer_cast<const ConcreteStateData>(state);
|
|
32
32
|
const HybridStrokeTextViewState& data = concreteState->getData();
|
|
33
|
-
const std::
|
|
34
|
-
if (
|
|
33
|
+
const std::shared_ptr<HybridStrokeTextViewProps>& props = data.getProps();
|
|
34
|
+
if (props == nullptr) [[unlikely]] {
|
|
35
35
|
// Props aren't set yet!
|
|
36
36
|
throw std::runtime_error("HybridStrokeTextViewState's data doesn't contain any props!");
|
|
37
37
|
}
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
38
|
+
|
|
39
|
+
// Update all props if they are dirty
|
|
40
|
+
if (props->text.isDirty) {
|
|
41
|
+
hybridView->setText(props->text.value);
|
|
42
|
+
props->text.isDirty = false;
|
|
42
43
|
}
|
|
43
|
-
if (props
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
if (props->color.isDirty) {
|
|
45
|
+
hybridView->setColor(props->color.value);
|
|
46
|
+
props->color.isDirty = false;
|
|
46
47
|
}
|
|
47
|
-
if (props
|
|
48
|
-
|
|
49
|
-
|
|
48
|
+
if (props->strokeColor.isDirty) {
|
|
49
|
+
hybridView->setStrokeColor(props->strokeColor.value);
|
|
50
|
+
props->strokeColor.isDirty = false;
|
|
50
51
|
}
|
|
51
|
-
if (props
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
if (props->strokeWidth.isDirty) {
|
|
53
|
+
hybridView->setStrokeWidth(props->strokeWidth.value);
|
|
54
|
+
props->strokeWidth.isDirty = false;
|
|
54
55
|
}
|
|
55
|
-
if (props
|
|
56
|
-
|
|
57
|
-
|
|
56
|
+
if (props->fontSize.isDirty) {
|
|
57
|
+
hybridView->setFontSize(props->fontSize.value);
|
|
58
|
+
props->fontSize.isDirty = false;
|
|
58
59
|
}
|
|
59
|
-
if (props
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
if (props->fontWeight.isDirty) {
|
|
61
|
+
hybridView->setFontWeight(props->fontWeight.value);
|
|
62
|
+
props->fontWeight.isDirty = false;
|
|
62
63
|
}
|
|
63
|
-
if (props
|
|
64
|
-
|
|
65
|
-
|
|
64
|
+
if (props->fontFamily.isDirty) {
|
|
65
|
+
hybridView->setFontFamily(props->fontFamily.value);
|
|
66
|
+
props->fontFamily.isDirty = false;
|
|
66
67
|
}
|
|
67
|
-
if (props
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
if (props->fontStyle.isDirty) {
|
|
69
|
+
hybridView->setFontStyle(props->fontStyle.value);
|
|
70
|
+
props->fontStyle.isDirty = false;
|
|
70
71
|
}
|
|
71
|
-
if (props
|
|
72
|
-
|
|
73
|
-
|
|
72
|
+
if (props->lineHeight.isDirty) {
|
|
73
|
+
hybridView->setLineHeight(props->lineHeight.value);
|
|
74
|
+
props->lineHeight.isDirty = false;
|
|
74
75
|
}
|
|
75
|
-
if (props
|
|
76
|
-
|
|
77
|
-
|
|
76
|
+
if (props->letterSpacing.isDirty) {
|
|
77
|
+
hybridView->setLetterSpacing(props->letterSpacing.value);
|
|
78
|
+
props->letterSpacing.isDirty = false;
|
|
78
79
|
}
|
|
79
|
-
if (props
|
|
80
|
-
|
|
81
|
-
|
|
80
|
+
if (props->textAlign.isDirty) {
|
|
81
|
+
hybridView->setTextAlign(props->textAlign.value);
|
|
82
|
+
props->textAlign.isDirty = false;
|
|
82
83
|
}
|
|
83
|
-
if (props
|
|
84
|
-
|
|
85
|
-
|
|
84
|
+
if (props->textAlignVertical.isDirty) {
|
|
85
|
+
hybridView->setTextAlignVertical(props->textAlignVertical.value);
|
|
86
|
+
props->textAlignVertical.isDirty = false;
|
|
86
87
|
}
|
|
87
|
-
if (props
|
|
88
|
-
|
|
89
|
-
|
|
88
|
+
if (props->textDecorationLine.isDirty) {
|
|
89
|
+
hybridView->setTextDecorationLine(props->textDecorationLine.value);
|
|
90
|
+
props->textDecorationLine.isDirty = false;
|
|
90
91
|
}
|
|
91
|
-
if (props
|
|
92
|
-
|
|
93
|
-
|
|
92
|
+
if (props->textTransform.isDirty) {
|
|
93
|
+
hybridView->setTextTransform(props->textTransform.value);
|
|
94
|
+
props->textTransform.isDirty = false;
|
|
94
95
|
}
|
|
95
|
-
if (props
|
|
96
|
-
|
|
97
|
-
|
|
96
|
+
if (props->opacity.isDirty) {
|
|
97
|
+
hybridView->setOpacity(props->opacity.value);
|
|
98
|
+
props->opacity.isDirty = false;
|
|
98
99
|
}
|
|
99
|
-
if (props
|
|
100
|
-
|
|
101
|
-
|
|
100
|
+
if (props->allowFontScaling.isDirty) {
|
|
101
|
+
hybridView->setAllowFontScaling(props->allowFontScaling.value);
|
|
102
|
+
props->allowFontScaling.isDirty = false;
|
|
102
103
|
}
|
|
103
|
-
if (props
|
|
104
|
-
|
|
105
|
-
|
|
104
|
+
if (props->maxFontSizeMultiplier.isDirty) {
|
|
105
|
+
hybridView->setMaxFontSizeMultiplier(props->maxFontSizeMultiplier.value);
|
|
106
|
+
props->maxFontSizeMultiplier.isDirty = false;
|
|
106
107
|
}
|
|
107
|
-
if (props
|
|
108
|
-
|
|
109
|
-
|
|
108
|
+
if (props->includeFontPadding.isDirty) {
|
|
109
|
+
hybridView->setIncludeFontPadding(props->includeFontPadding.value);
|
|
110
|
+
props->includeFontPadding.isDirty = false;
|
|
110
111
|
}
|
|
111
|
-
if (props
|
|
112
|
-
|
|
113
|
-
|
|
112
|
+
if (props->numberOfLines.isDirty) {
|
|
113
|
+
hybridView->setNumberOfLines(props->numberOfLines.value);
|
|
114
|
+
props->numberOfLines.isDirty = false;
|
|
114
115
|
}
|
|
115
|
-
if (props
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
if (props->ellipsizeMode.isDirty) {
|
|
117
|
+
hybridView->setEllipsizeMode(props->ellipsizeMode.value);
|
|
118
|
+
props->ellipsizeMode.isDirty = false;
|
|
118
119
|
}
|
|
119
|
-
if (props
|
|
120
|
-
|
|
121
|
-
|
|
120
|
+
if (props->padding.isDirty) {
|
|
121
|
+
hybridView->setPadding(props->padding.value);
|
|
122
|
+
props->padding.isDirty = false;
|
|
122
123
|
}
|
|
123
|
-
if (props
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
if (props->paddingVertical.isDirty) {
|
|
125
|
+
hybridView->setPaddingVertical(props->paddingVertical.value);
|
|
126
|
+
props->paddingVertical.isDirty = false;
|
|
126
127
|
}
|
|
127
|
-
if (props
|
|
128
|
-
|
|
129
|
-
|
|
128
|
+
if (props->paddingHorizontal.isDirty) {
|
|
129
|
+
hybridView->setPaddingHorizontal(props->paddingHorizontal.value);
|
|
130
|
+
props->paddingHorizontal.isDirty = false;
|
|
130
131
|
}
|
|
131
|
-
if (props
|
|
132
|
-
|
|
133
|
-
|
|
132
|
+
if (props->paddingTop.isDirty) {
|
|
133
|
+
hybridView->setPaddingTop(props->paddingTop.value);
|
|
134
|
+
props->paddingTop.isDirty = false;
|
|
134
135
|
}
|
|
135
|
-
if (props
|
|
136
|
-
|
|
137
|
-
|
|
136
|
+
if (props->paddingRight.isDirty) {
|
|
137
|
+
hybridView->setPaddingRight(props->paddingRight.value);
|
|
138
|
+
props->paddingRight.isDirty = false;
|
|
138
139
|
}
|
|
139
|
-
if (props
|
|
140
|
-
|
|
141
|
-
|
|
140
|
+
if (props->paddingBottom.isDirty) {
|
|
141
|
+
hybridView->setPaddingBottom(props->paddingBottom.value);
|
|
142
|
+
props->paddingBottom.isDirty = false;
|
|
142
143
|
}
|
|
143
|
-
if (props
|
|
144
|
-
|
|
145
|
-
|
|
144
|
+
if (props->paddingLeft.isDirty) {
|
|
145
|
+
hybridView->setPaddingLeft(props->paddingLeft.value);
|
|
146
|
+
props->paddingLeft.isDirty = false;
|
|
146
147
|
}
|
|
147
148
|
|
|
148
149
|
// Update hybridRef if it changed
|
|
149
|
-
if (props
|
|
150
|
+
if (props->hybridRef.isDirty) {
|
|
150
151
|
// hybridRef changed - call it with new this
|
|
151
|
-
const auto& maybeFunc = props
|
|
152
|
+
const auto& maybeFunc = props->hybridRef.value;
|
|
152
153
|
if (maybeFunc.has_value()) {
|
|
153
|
-
|
|
154
|
-
maybeFunc.value()(shared);
|
|
154
|
+
maybeFunc.value()(hybridView);
|
|
155
155
|
}
|
|
156
|
-
|
|
156
|
+
props->hybridRef.isDirty = false;
|
|
157
157
|
}
|
|
158
158
|
}
|
|
159
159
|
|
|
@@ -12,8 +12,8 @@
|
|
|
12
12
|
#endif
|
|
13
13
|
|
|
14
14
|
#include <fbjni/fbjni.h>
|
|
15
|
-
#include <react/fabric/StateWrapperImpl.h>
|
|
16
15
|
#include <react/fabric/CoreComponentsRegistry.h>
|
|
16
|
+
#include <react/fabric/StateWrapperImpl.h>
|
|
17
17
|
#include <react/renderer/core/ConcreteComponentDescriptor.h>
|
|
18
18
|
#include <NitroModules/NitroDefines.hpp>
|
|
19
19
|
#include <NitroModules/JStateWrapper.hpp>
|
|
@@ -24,13 +24,13 @@ namespace margelo::nitro::stroketext::views {
|
|
|
24
24
|
|
|
25
25
|
using namespace facebook;
|
|
26
26
|
|
|
27
|
-
class JHybridStrokeTextViewStateUpdater: public jni::JavaClass<JHybridStrokeTextViewStateUpdater> {
|
|
27
|
+
class JHybridStrokeTextViewStateUpdater final: public jni::JavaClass<JHybridStrokeTextViewStateUpdater> {
|
|
28
28
|
public:
|
|
29
29
|
static constexpr auto kJavaDescriptor = "Lcom/margelo/nitro/stroketext/views/HybridStrokeTextViewStateUpdater;";
|
|
30
30
|
|
|
31
31
|
public:
|
|
32
32
|
static void updateViewProps(jni::alias_ref<jni::JClass> /* class */,
|
|
33
|
-
jni::alias_ref<JHybridStrokeTextViewSpec::
|
|
33
|
+
jni::alias_ref<JHybridStrokeTextViewSpec::JavaPart> view,
|
|
34
34
|
jni::alias_ref<JStateWrapper::javaobject> stateWrapperInterface);
|
|
35
35
|
|
|
36
36
|
public:
|
package/nitrogen/generated/android/kotlin/com/margelo/nitro/stroketext/HybridStrokeTextViewSpec.kt
CHANGED
|
@@ -10,6 +10,7 @@ package com.margelo.nitro.stroketext
|
|
|
10
10
|
import androidx.annotation.Keep
|
|
11
11
|
import com.facebook.jni.HybridData
|
|
12
12
|
import com.facebook.proguard.annotations.DoNotStrip
|
|
13
|
+
import com.margelo.nitro.core.HybridObject
|
|
13
14
|
import com.margelo.nitro.views.HybridView
|
|
14
15
|
|
|
15
16
|
/**
|
|
@@ -24,23 +25,6 @@ import com.margelo.nitro.views.HybridView
|
|
|
24
25
|
"LocalVariableName", "PropertyName", "PrivatePropertyName", "FunctionName"
|
|
25
26
|
)
|
|
26
27
|
abstract class HybridStrokeTextViewSpec: HybridView() {
|
|
27
|
-
@DoNotStrip
|
|
28
|
-
private var mHybridData: HybridData = initHybrid()
|
|
29
|
-
|
|
30
|
-
init {
|
|
31
|
-
super.updateNative(mHybridData)
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
override fun updateNative(hybridData: HybridData) {
|
|
35
|
-
mHybridData = hybridData
|
|
36
|
-
super.updateNative(hybridData)
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
// Default implementation of `HybridObject.toString()`
|
|
40
|
-
override fun toString(): String {
|
|
41
|
-
return "[HybridObject StrokeTextView]"
|
|
42
|
-
}
|
|
43
|
-
|
|
44
28
|
// Properties
|
|
45
29
|
@get:DoNotStrip
|
|
46
30
|
@get:Keep
|
|
@@ -207,7 +191,21 @@ abstract class HybridStrokeTextViewSpec: HybridView() {
|
|
|
207
191
|
// Methods
|
|
208
192
|
|
|
209
193
|
|
|
210
|
-
|
|
194
|
+
// Default implementation of `HybridObject.toString()`
|
|
195
|
+
override fun toString(): String {
|
|
196
|
+
return "[HybridObject StrokeTextView]"
|
|
197
|
+
}
|
|
198
|
+
|
|
199
|
+
// C++ backing class
|
|
200
|
+
@DoNotStrip
|
|
201
|
+
@Keep
|
|
202
|
+
protected open class CxxPart(javaPart: HybridStrokeTextViewSpec): HybridObject.CxxPart(javaPart) {
|
|
203
|
+
// C++ JHybridStrokeTextViewSpec::CxxPart::initHybrid(...)
|
|
204
|
+
external override fun initHybrid(): HybridData
|
|
205
|
+
}
|
|
206
|
+
override fun createCxxPart(): CxxPart {
|
|
207
|
+
return CxxPart(this)
|
|
208
|
+
}
|
|
211
209
|
|
|
212
210
|
companion object {
|
|
213
211
|
protected const val TAG = "HybridStrokeTextViewSpec"
|
|
@@ -19,7 +19,7 @@ import com.margelo.nitro.stroketext.*
|
|
|
19
19
|
/**
|
|
20
20
|
* Represents the React Native `ViewManager` for the "StrokeTextView" Nitro HybridView.
|
|
21
21
|
*/
|
|
22
|
-
|
|
22
|
+
public class HybridStrokeTextViewManager: SimpleViewManager<View>() {
|
|
23
23
|
init {
|
|
24
24
|
if (RecyclableView::class.java.isAssignableFrom(HybridStrokeTextView::class.java)) {
|
|
25
25
|
// Enable view recycling
|
|
@@ -39,7 +39,7 @@ open class HybridStrokeTextViewManager: SimpleViewManager<View>() {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
override fun updateState(view: View, props: ReactStylesDiffMap, stateWrapper: StateWrapper): Any? {
|
|
42
|
-
val hybridView = view
|
|
42
|
+
val hybridView = getHybridView(view)
|
|
43
43
|
?: throw Error("Couldn't find view $view in local views table!")
|
|
44
44
|
|
|
45
45
|
// 1. Update each prop individually
|
|
@@ -51,9 +51,15 @@ open class HybridStrokeTextViewManager: SimpleViewManager<View>() {
|
|
|
51
51
|
return super.updateState(view, props, stateWrapper)
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
override fun onDropViewInstance(view: View) {
|
|
55
|
+
val hybridView = getHybridView(view)
|
|
56
|
+
hybridView?.onDropView()
|
|
57
|
+
return super.onDropViewInstance(view)
|
|
58
|
+
}
|
|
59
|
+
|
|
54
60
|
protected override fun prepareToRecycleView(reactContext: ThemedReactContext, view: View): View? {
|
|
55
61
|
super.prepareToRecycleView(reactContext, view)
|
|
56
|
-
val hybridView = view
|
|
62
|
+
val hybridView = getHybridView(view)
|
|
57
63
|
?: return null
|
|
58
64
|
|
|
59
65
|
@Suppress("USELESS_IS_CHECK")
|
|
@@ -67,4 +73,8 @@ open class HybridStrokeTextViewManager: SimpleViewManager<View>() {
|
|
|
67
73
|
return null
|
|
68
74
|
}
|
|
69
75
|
}
|
|
76
|
+
|
|
77
|
+
private fun getHybridView(view: View): HybridStrokeTextView? {
|
|
78
|
+
return view.getTag(associated_hybrid_view_tag) as? HybridStrokeTextView
|
|
79
|
+
}
|
|
70
80
|
}
|
|
@@ -56,5 +56,7 @@ def add_nitrogen_files(spec)
|
|
|
56
56
|
"SWIFT_OBJC_INTEROP_MODE" => "objcxx",
|
|
57
57
|
# Enables stricter modular headers
|
|
58
58
|
"DEFINES_MODULE" => "YES",
|
|
59
|
+
# Disable auto-generated ObjC header for Swift (Static linkage on Xcode 26.4 breaks here)
|
|
60
|
+
"SWIFT_INSTALL_OBJC_HEADER" => "NO",
|
|
59
61
|
})
|
|
60
62
|
end
|
|
@@ -57,7 +57,7 @@ namespace margelo::nitro::stroketext::bridge::swift {
|
|
|
57
57
|
return optional.has_value();
|
|
58
58
|
}
|
|
59
59
|
inline std::string get_std__optional_std__string_(const std::optional<std::string>& optional) noexcept {
|
|
60
|
-
return
|
|
60
|
+
return optional.value();
|
|
61
61
|
}
|
|
62
62
|
|
|
63
63
|
// pragma MARK: std::optional<double>
|
|
@@ -72,7 +72,7 @@ namespace margelo::nitro::stroketext::bridge::swift {
|
|
|
72
72
|
return optional.has_value();
|
|
73
73
|
}
|
|
74
74
|
inline double get_std__optional_double_(const std::optional<double>& optional) noexcept {
|
|
75
|
-
return
|
|
75
|
+
return optional.value();
|
|
76
76
|
}
|
|
77
77
|
|
|
78
78
|
// pragma MARK: std::optional<StrokeTextFontStyle>
|
|
@@ -87,7 +87,7 @@ namespace margelo::nitro::stroketext::bridge::swift {
|
|
|
87
87
|
return optional.has_value();
|
|
88
88
|
}
|
|
89
89
|
inline StrokeTextFontStyle get_std__optional_StrokeTextFontStyle_(const std::optional<StrokeTextFontStyle>& optional) noexcept {
|
|
90
|
-
return
|
|
90
|
+
return optional.value();
|
|
91
91
|
}
|
|
92
92
|
|
|
93
93
|
// pragma MARK: std::optional<StrokeTextAlign>
|
|
@@ -102,7 +102,7 @@ namespace margelo::nitro::stroketext::bridge::swift {
|
|
|
102
102
|
return optional.has_value();
|
|
103
103
|
}
|
|
104
104
|
inline StrokeTextAlign get_std__optional_StrokeTextAlign_(const std::optional<StrokeTextAlign>& optional) noexcept {
|
|
105
|
-
return
|
|
105
|
+
return optional.value();
|
|
106
106
|
}
|
|
107
107
|
|
|
108
108
|
// pragma MARK: std::optional<StrokeTextAlignVertical>
|
|
@@ -117,7 +117,7 @@ namespace margelo::nitro::stroketext::bridge::swift {
|
|
|
117
117
|
return optional.has_value();
|
|
118
118
|
}
|
|
119
119
|
inline StrokeTextAlignVertical get_std__optional_StrokeTextAlignVertical_(const std::optional<StrokeTextAlignVertical>& optional) noexcept {
|
|
120
|
-
return
|
|
120
|
+
return optional.value();
|
|
121
121
|
}
|
|
122
122
|
|
|
123
123
|
// pragma MARK: std::optional<StrokeTextDecorationLine>
|
|
@@ -132,7 +132,7 @@ namespace margelo::nitro::stroketext::bridge::swift {
|
|
|
132
132
|
return optional.has_value();
|
|
133
133
|
}
|
|
134
134
|
inline StrokeTextDecorationLine get_std__optional_StrokeTextDecorationLine_(const std::optional<StrokeTextDecorationLine>& optional) noexcept {
|
|
135
|
-
return
|
|
135
|
+
return optional.value();
|
|
136
136
|
}
|
|
137
137
|
|
|
138
138
|
// pragma MARK: std::optional<StrokeTextTransform>
|
|
@@ -147,7 +147,7 @@ namespace margelo::nitro::stroketext::bridge::swift {
|
|
|
147
147
|
return optional.has_value();
|
|
148
148
|
}
|
|
149
149
|
inline StrokeTextTransform get_std__optional_StrokeTextTransform_(const std::optional<StrokeTextTransform>& optional) noexcept {
|
|
150
|
-
return
|
|
150
|
+
return optional.value();
|
|
151
151
|
}
|
|
152
152
|
|
|
153
153
|
// pragma MARK: std::optional<bool>
|
|
@@ -162,7 +162,7 @@ namespace margelo::nitro::stroketext::bridge::swift {
|
|
|
162
162
|
return optional.has_value();
|
|
163
163
|
}
|
|
164
164
|
inline bool get_std__optional_bool_(const std::optional<bool>& optional) noexcept {
|
|
165
|
-
return
|
|
165
|
+
return optional.value();
|
|
166
166
|
}
|
|
167
167
|
|
|
168
168
|
// pragma MARK: std::optional<StrokeTextEllipsizeMode>
|
|
@@ -177,7 +177,7 @@ namespace margelo::nitro::stroketext::bridge::swift {
|
|
|
177
177
|
return optional.has_value();
|
|
178
178
|
}
|
|
179
179
|
inline StrokeTextEllipsizeMode get_std__optional_StrokeTextEllipsizeMode_(const std::optional<StrokeTextEllipsizeMode>& optional) noexcept {
|
|
180
|
-
return
|
|
180
|
+
return optional.value();
|
|
181
181
|
}
|
|
182
182
|
|
|
183
183
|
// pragma MARK: std::shared_ptr<HybridStrokeTextViewSpec>
|
|
@@ -17,6 +17,13 @@
|
|
|
17
17
|
#import "HybridStrokeTextViewSpecSwift.hpp"
|
|
18
18
|
#import "NitroStrokeText-Swift-Cxx-Umbrella.hpp"
|
|
19
19
|
|
|
20
|
+
#if __has_include(<cxxreact/ReactNativeVersion.h>)
|
|
21
|
+
#include <cxxreact/ReactNativeVersion.h>
|
|
22
|
+
#if REACT_NATIVE_VERSION_MINOR >= 82
|
|
23
|
+
#define ENABLE_RCT_COMPONENT_VIEW_INVALIDATE
|
|
24
|
+
#endif
|
|
25
|
+
#endif
|
|
26
|
+
|
|
20
27
|
using namespace facebook;
|
|
21
28
|
using namespace margelo::nitro::stroketext;
|
|
22
29
|
using namespace margelo::nitro::stroketext::views;
|
|
@@ -234,4 +241,12 @@ using namespace margelo::nitro::stroketext::views;
|
|
|
234
241
|
swiftPart.maybePrepareForRecycle();
|
|
235
242
|
}
|
|
236
243
|
|
|
244
|
+
#ifdef ENABLE_RCT_COMPONENT_VIEW_INVALIDATE
|
|
245
|
+
- (void)invalidate {
|
|
246
|
+
NitroStrokeText::HybridStrokeTextViewSpec_cxx& swiftPart = _hybridView->getSwiftPart();
|
|
247
|
+
swiftPart.onDropView();
|
|
248
|
+
[super invalidate];
|
|
249
|
+
}
|
|
250
|
+
#endif
|
|
251
|
+
|
|
237
252
|
@end
|