我有一个自定义标记图像,并想使用一个变量来表示图像的不透明度。我执行以下操作并遇到此错误“无法将不透明度的值从 ReadableNativeMap 转换为加倍”
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>
最佳答案
您必须使用 <Animated.*>
例如
对于 <View>
使用 <Animated.View>
对于 <Image>
使用 <Animated.Image>
等等。如果在 Animated.*
中使用,React Native 会理解 Animated.Value零件。
关于javascript - 值不能从 ReadableNativeMap 转换为 double,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/54272759/