简体   繁体   English

我不能将 flexbox 用于可触摸的不透明度/可按压。 如何连续对齐这两个元素?

[英]Can't I use flexbox for touchable opacity/ pressable. How to align these 2 elements in a row?

<View style = {{flex : 0.2, backgroundColor : 'white', flexDirection : 'row' , justifyContent : 'space-around', alignItems : 'center'}}>
    <Pressable style = {{ height : '100%', width : '100%'}}>
    <Image style = {{height : '60%' , width : '10%'}} source = {require('../../DataStorage/SymbolsPicture/arrowLeft.png')}></Image> 
    </Pressable>
    <Pressable style = {{ height : '100%', width : '100%'}}>
    <Image style = {{height : '60%' , width : '10%'}} source = {require('../../DataStorage/SymbolsPicture/arrowRight.png')}></Image> 
    </Pressable>
    </View> 

What I get我得到的

I need both of the arrows to be spaced around in the same row.我需要两个箭头在同一行中间隔开。

what about using just flex:只使用 flex 怎么样:

<View style={{flex: 0.2, backgroundColor: 'white', flexDirection: 'row', justifyContent: 'space-evenly'}}>
    <Pressable style={{flex: 1}}>
        <Image style={{flex: 1}} resizeMode="contain" source = {require('../../DataStorage/SymbolsPicture/arrowLeft.png')}/> 
    </Pressable>
    <Pressable style={{flex: 1}}>
        <Image style={{flex: 1}} resizeMode="contain" source = {require('../../DataStorage/SymbolsPicture/arrowRight.png')}/> 
    </Pressable>
</View> 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM