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.

attempt to call missing method '__mount' of table #386

@krikora

Description

@krikora

I'm trying to make a button, but I'm getting this error: Roact.createReconciler:408: attempt to call missing method '__mount' of table. What am I doing wrong? Thanks.

My code:

local Flat = Roact.createElement("ExtendedButton")

function Flat:init()
	self.ref = Roact.createRef()
end

function Flat:render()
	local children = self.props.children

	return Roact.createElement("TextButton", {
		AutoButtonColor = false,
		Text = "",
		AutomaticSize = Enum.AutomaticSize.X,
		[Roact.Ref] = self.ref,
		BackgroundColor3 = Theme.colorScheme.primary,
		BorderSizePixel = 0,
		[Roact.Event.MouseButton1Click] = self.props.onClick or function() end
	}, {
		children,
		Roact.createElement(Ripple, {
			cornerRadius = UDim.new(0, 8)
		}),
		Roact.createElement("UICorner", {
			CornerRadius = UDim.new(0, 8)
		})
	})
end

function Flat:didMount()
	self.ref:getValue().Size = UDim2.fromOffset(self.ref:getValue().AbsoluteSize.X+80, 40)
	
	self.ref:getValue().AutomaticSize = false
end

In another script:

Roact.mount(
	Roact.createElement(Flat, {
		children = Button.Text("Hey")	
	}),
	script.Parent.Parent.Tree
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions