Skip to content

Commit

Permalink
fix: add missing dispose and typename to skparagraph (#2570)
Browse files Browse the repository at this point in the history
---------

Co-authored-by: William Candillon <[email protected]>
  • Loading branch information
terrysahaidak and wcandillon authored Aug 22, 2024
1 parent b9a38f0 commit 9de8da3
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion package/cpp/api/JsiSkParagraph.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,8 @@ namespace para = skia::textlayout;
*/
class JsiSkParagraph : public JsiSkHostObject {
public:
EXPORT_JSI_API_TYPENAME(JsiSkParagraph, Paragraph)

JSI_HOST_FUNCTION(layout) {
auto width = getArgumentAsNumber(runtime, arguments, count, 0);
_paragraph->layout(width);
Expand Down Expand Up @@ -122,6 +124,12 @@ class JsiSkParagraph : public JsiSkHostObject {
return returnValue;
}

JSI_HOST_FUNCTION(dispose) {
_paragraph = nullptr;

return jsi::Value::undefined();
}

JSI_EXPORT_FUNCTIONS(JSI_EXPORT_FUNC(JsiSkParagraph, layout),
JSI_EXPORT_FUNC(JsiSkParagraph, paint),
JSI_EXPORT_FUNC(JsiSkParagraph, getMaxWidth),
Expand All @@ -133,7 +141,8 @@ class JsiSkParagraph : public JsiSkHostObject {
JSI_EXPORT_FUNC(JsiSkParagraph,
getGlyphPositionAtCoordinate),
JSI_EXPORT_FUNC(JsiSkParagraph, getRectsForRange),
JSI_EXPORT_FUNC(JsiSkParagraph, getLineMetrics))
JSI_EXPORT_FUNC(JsiSkParagraph, getLineMetrics),
JSI_EXPORT_FUNC(JsiSkParagraph, dispose))

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

0 comments on commit 9de8da3

Please sign in to comment.