Skip to content

Prerender function #15

@iamcxds

Description

@iamcxds

When I try to create a text field that change h depend on w
so I define elem.props.w and elem.props.h,
If I use useEffect to update h by w, and the draw function is like

function (self, x, y, w, h)
self.props.w=w
...
end

And finally I want to call elem:render(x, y, w, elem.props.h)

These code I have some problems:

  1. Before first render, props.h is nil, so I have to set a default value.
  2. The update is after this frame, this can cause some problem if I have chain of update.

So I wonder, maybe it can be solved by add prerender function to do something before render?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions