无法将值从ReadableNativeMap强制转换为double

Muj*_*Muj 5 javascript variables android marker react-native

我有一个自定义标记图像,并且想为图像的不透明度使用一个变量。我执行以下操作,并收到此错误“无法将不透明的值从ReadableNativeMap转换为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>
Run Code Online (Sandbox Code Playgroud)

在此处输入图片说明

And*_*rei 10

你必须使用<Animated.*>例如

<View>使用<Animated.View>

<Image>使用<Animated.Image>

等等。如果在Animated.*组件中使用,React Native 会理解 Animated.Value 。