Skip to content
This repository was archived by the owner on Dec 13, 2023. It is now read-only.
This repository was archived by the owner on Dec 13, 2023. It is now read-only.

Build element from existing gui object suggestion #384

@BlueMond

Description

@BlueMond

I am new to Roact, so correct me if I have any misunderstandings of the library, but I noticed there doesn't seem to be a built in way to create an element from an existing roblox gui object, in the case where you would want to prebuild your GUIs in roblox studio and use them as a template for a Roact based gui library.

I suggest that the library is extended to include this functionality. I have not tested this code, but I am attempting to do it in my code, using a function like this:


local function createRoactElement(guiObject)
    local props = {}

    for k, v in pairs(guiObject) do
        if typeof(v) ~= "function" and k ~= "Parent" and k ~= "ClassName" then
            props[k] = v
        end
    end

    return Roact.createElement(guiObject.ClassName, props)
end

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions