我是 ReactNative 的新手,我有以下组件:
<View style={{flex: 1}}>
<View style={styles.container}>
<Animated.Image style= {styles.photo}
source={{uri: this.props.user.picture.large}}/>
</View>
<View style={{backgroundColor:'whitesmoke', flex: 1}}></View>
</View>
在样式中,我有以下内容:
const styles = StyleSheet.create({
container: {
flex: 0.5,
backgroundColor: '#4dbce9',
alignItems: 'center',
},
photo: {
height: 150,
width: 150,
borderRadius: 75,
borderWidth: 3,
borderColor: 'white',
transform: [ // `transform` is an ordered array
{scale: this.state.profileImgBounceVal},
]
}
});
当我this.state.profileImgBounceVal在我知道的组件之外访问它时出现错误。除了包含Animated.Image标签内的样式外,是否有任何解决方法?