Skip to content

Commit 9de8da3

Browse files
fix: add missing dispose and typename to skparagraph (#2570)
--------- Co-authored-by: William Candillon <[email protected]>
1 parent b9a38f0 commit 9de8da3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

package/cpp/api/JsiSkParagraph.h

+10-1
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ namespace para = skia::textlayout;
3232
*/
3333
class JsiSkParagraph : public JsiSkHostObject {
3434
public:
35+
EXPORT_JSI_API_TYPENAME(JsiSkParagraph, Paragraph)
36+
3537
JSI_HOST_FUNCTION(layout) {
3638
auto width = getArgumentAsNumber(runtime, arguments, count, 0);
3739
_paragraph->layout(width);
@@ -122,6 +124,12 @@ class JsiSkParagraph : public JsiSkHostObject {
122124
return returnValue;
123125
}
124126

127+
JSI_HOST_FUNCTION(dispose) {
128+
_paragraph = nullptr;
129+
130+
return jsi::Value::undefined();
131+
}
132+
125133
JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkParagraph, layout),
126134
JSI_EXPORT_FUNC(JsiSkParagraph, paint),
127135
JSI_EXPORT_FUNC(JsiSkParagraph, getMaxWidth),
@@ -133,7 +141,8 @@ class JsiSkParagraph : public JsiSkHostObject {
133141
JSI_EXPORT_FUNC(JsiSkParagraph,
134142
getGlyphPositionAtCoordinate),
135143
JSI_EXPORT_FUNC(JsiSkParagraph, getRectsForRange),
136-
JSI_EXPORT_FUNC(JsiSkParagraph, getLineMetrics))
144+
JSI_EXPORT_FUNC(JsiSkParagraph, getLineMetrics),
145+
JSI_EXPORT_FUNC(JsiSkParagraph, dispose))
137146

138147
explicit JsiSkParagraph(std::shared_ptr<RNSkPlatformContext> context,
139148
para::ParagraphBuilder *paragraphBuilder)

0 commit comments

Comments
 (0)