React native 图像中的图像组件未完全拉伸 返回( {this.state.textintal} )
您可以看到书中的可触摸不透明度,并且组件的高度很好,但宽度没有完全拉伸,我已尝试更改resize mode属性的所有枚举值,但似乎没有任何效果尝试设置imageStyleReact native 图像中的图像组件未完全拉伸 返回( {this.state.textintal} ),react-native,React Native,您可以看到书中的可触摸不透明度,并且组件的高度很好,但宽度没有完全拉伸,我已尝试更改resize mode属性的所有枚举值,但似乎没有任何效果尝试设置imageStyle return( <TouchableOpacity style={{flex:1,justifyContent:'center',backgroundColor:'transparent',flexDirection:'column',...this.props.style}} > <ImageBackgr
return(
<TouchableOpacity style={{flex:1,justifyContent:'center',backgroundColor:'transparent',flexDirection:'column',...this.props.style}}
>
<ImageBackground
source={this.state.backimage}
resizeMode={'cover'}
style={{ flex: 1,
width: '100%',
height: '100%',
justifyContent:'center'}}
>
<Text ref={this.textref}style={{color:this.state.textcolor,position:'absolute',alignSelf:'center',fontSize:this.props.fontSize,fontWeight:this.props.fontWeight}}>{this.state.textintial}</Text>
</ImageBackground>
</TouchableOpacity>
)
尝试设置imageStyle
return(
<TouchableOpacity style={{flex:1,justifyContent:'center',backgroundColor:'transparent',flexDirection:'column',...this.props.style}}
>
<ImageBackground
source={this.state.backimage}
resizeMode={'cover'}
style={{ flex: 1,
width: '100%',
height: '100%',
justifyContent:'center'}}
>
<Text ref={this.textref}style={{color:this.state.textcolor,position:'absolute',alignSelf:'center',fontSize:this.props.fontSize,fontWeight:this.props.fontWeight}}>{this.state.textintial}</Text>
</ImageBackground>
</TouchableOpacity>
)
你能分享一下你是如何定义这个.props.style的吗?这将是我要寻找的地方。你能分享一下你如何定义…这个.props.style
?这将是我要去看的地方。