有时,人们可能希望使用prop来设置只能通过JS设置的元素属性(因此,无法通过React进行控制)。一个例子(也是我的用例)是使用paused属性来定义是否应该播放视频(我的目标是分离视频的控件和可视化)。only property from the Component props.only property from the Component props./15.1.0/react.min.js"><
我将一个道具uri传递给我的本机组件。但是当我尝试在视图的init方法中使用它时,它是nil。self.uri is not nil here}uri在init中是nil,但在onTap方法中不是,所以我认为我们不能在init方法中使用属性我想过创建一个方法来设置我的图像,并在componentDidMount中的JS部分调用它,但感觉是错误的。
谢谢你的帮忙!