如何在HypserStack中使用MaterialUI的Mobile-Stepper?

问题描述 投票:0回答:1

我尝试在Hyperstack中使用mobile-stepper组件(https://material-ui.com/demos/steppers/#mobile-stepper-progress),但是我收到此错误:

Failed prop type: Invalid prop `nextButton` supplied to `MobileStepper`, expected a ReactNode. in MobileStepper

它只呈现进度条但没有按钮。

尝试各种方式,即:

Mui.MobileStepper( variant: "progress", steps: 6, position: "static",
                   nextButton: lambda { Mui.Button(size: "small") {'next'} },
                   backButton: lambda { Mui.Button(size: "small") {'back'} })
ruby reactjs material-ui hyperstack
1个回答
3
投票

您希望将完整的ReactNode传递给nextButton和backButton道具。您还需要将组件转换为本机JavaScript。您可以在任何Hyperstack组件上调用to_n,将其转换为本机反应类。

Mui.MobileStepper( variant: "progress", steps: 6, position: "static",
                   nextButton: Mui.Button(size: "small") {'next'}.to_n,
                   backButton: Mui.Button(size: "small") {'back'}.to_n)
© www.soinside.com 2019 - 2024. All rights reserved.