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

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

Open
krikora opened this issue May 18, 2023 · 0 comments
Open

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

krikora opened this issue May 18, 2023 · 0 comments

Comments

@krikora
Copy link

krikora commented May 18, 2023

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
)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant