Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: add missing dispose and typename to skparagraph #2570

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading