我正在开发反应原生的UI,在此<Image>
与源一起使用,我想通过setNativeProps而不是按状态更改图像源。如何通过在原生反应中使用setNativeProps更改图像源
我的代码是:
<Image source={require('imagePath')} ref="icon"/>
在某些事件中,我想改变它的来源:
this.refs['icon'].setNativeProps({
source: require('newImagePath')
});
但什么也没有发生,它不会改变。 通过使用NativeProps,图像风格发生了改变,但像源和类似的道具没有改变。
所以,请给我,我如何能(通过使用this.setState不)改变图像的任何特定事件源通过其裁判或关键的解决方案
同样的问题https://stackoverflow.com/questions/45754845/reactnative-image-setnativeprops-unable-to-change-source – zarcode