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

时间:2019-04-15 17:49:58

标签: ruby reactjs material-ui hyperstack

我尝试在Hyperstack中使用移动步进器组件(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'} })

1 个答案:

答案 0 :(得分:3)

您想将完整的ReactNode传递给nextButton和backButton道具。您还需要将组件转换为本地javascript。您可以在任何Hyperstack组件上调用to_n,以将其转换为本地React类。

Mui.MobileStepper( variant: "progress", steps: 6, position: "static",
                   nextButton: Mui.Button(size: "small") {'next'}.to_n,
                   backButton: Mui.Button(size: "small") {'back'}.to_n)
相关问题