无法将值从ReadableNativeMap强制转换为double [英] Value cannot be cast from ReadableNativeMap to double
本文介绍了无法将值从ReadableNativeMap强制转换为double的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一个自定义标记图像,并且想为图像的不透明度使用一个变量.我执行以下操作,然后收到此错误不透明度的值不能从ReadableNativeMap转换为两倍"
var status = 1;< MapView.Marker键= {marker.latitude}坐标= {{纬度:marker.latitude,经度:marker.longitude}}onPress = {()=>this.props.Quiz2(marker.latitude,marker.longitude)}>< View><图片来源= {require('../assets/icons/quiz.png')} style = {{宽度:40,高度:40,不透明度:状态}}/></View></MapView.Marker>
解决方案
例如,您必须使用< Animated.*>
对于< View>
,请使用< Animated.View>
对于< Image>
,请使用< Animated.Image>
以此类推.如果在 Animated.*
组件中使用了React Native,它将理解Animated.Value.
I have a custom marker image and want to use a variable for the opacity of the image. I doing the following and gettin this error "Value for opacity cannot be cast from ReadableNativeMap to double"
var status=1;
<MapView.Marker
key={marker.latitude}
coordinate={{ latitude: marker.latitude, longitude: marker.longitude }}
onPress={() => this.props.Quiz2(marker.latitude, marker.longitude)} >
<View><Image source={require('../assets/icons/quiz.png')} style={{ width: 40, height: 40,opacity:status}}/></View>
</MapView.Marker>
解决方案
You have to use <Animated.*>
e.g.
For <View>
use <Animated.View>
For <Image>
use <Animated.Image>
And so on. React Native will understand Animated.Value if it's used in Animated.*
component.
这篇关于无法将值从ReadableNativeMap强制转换为double的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文