@@ -32,6 +32,8 @@ namespace para = skia::textlayout;
32
32
*/
33
33
class JsiSkParagraph : public JsiSkHostObject {
34
34
public:
35
+ EXPORT_JSI_API_TYPENAME (JsiSkParagraph, Paragraph)
36
+
35
37
JSI_HOST_FUNCTION (layout) {
36
38
auto width = getArgumentAsNumber (runtime, arguments, count, 0 );
37
39
_paragraph->layout (width);
@@ -122,6 +124,12 @@ class JsiSkParagraph : public JsiSkHostObject {
122
124
return returnValue;
123
125
}
124
126
127
+ JSI_HOST_FUNCTION (dispose) {
128
+ _paragraph = nullptr ;
129
+
130
+ return jsi::Value::undefined ();
131
+ }
132
+
125
133
JSI_EXPORT_FUNCTIONS (JSI_EXPORT_FUNC(JsiSkParagraph, layout),
126
134
JSI_EXPORT_FUNC (JsiSkParagraph, paint),
127
135
JSI_EXPORT_FUNC (JsiSkParagraph, getMaxWidth),
@@ -133,7 +141,8 @@ class JsiSkParagraph : public JsiSkHostObject {
133
141
JSI_EXPORT_FUNC (JsiSkParagraph,
134
142
getGlyphPositionAtCoordinate),
135
143
JSI_EXPORT_FUNC (JsiSkParagraph, getRectsForRange),
136
- JSI_EXPORT_FUNC (JsiSkParagraph, getLineMetrics))
144
+ JSI_EXPORT_FUNC (JsiSkParagraph, getLineMetrics),
145
+ JSI_EXPORT_FUNC (JsiSkParagraph, dispose))
137
146
138
147
explicit JsiSkParagraph (std::shared_ptr<RNSkPlatformContext> context,
139
148
para::ParagraphBuilder *paragraphBuilder)
0 commit comments