私のホームページにはフレックスでレイアウトしたボタンが4つあります。私は親のflex:1を設定しました。これは、ページ全体をカバーしていることを意味します(私はbackgroundColorでそれを確認しました)。私の問題は、alignItems: 'flex-end'を設定すると、フレックスがページの半分しかカバーしていないかのように、ボタンが少し下に移動することです。alignItems: 'フレックスエンド'が正しく動作しない(ページ全体をカバーしない) - 反応しないネイティブ
ここに私のコードのマークアップです:
<Card style={styles.cardStyle}>
<CardSection style={styles.containerStyle}>
<Button onPress={() => navigate("NewScreen")}>
New
</Button>
</CardSection>
<CardSection style={styles.containerStyle}>
<Button onPress={() => navigate("SavedScreen")}>
Saved
</Button>
</CardSection>
<CardSection style={styles.containerStyle}>
<Button onPress={() => navigate("ParametersScreen")}>
Settings
</Button>
</CardSection>
<CardSection style={styles.containerStyle}>
<Button onPress={() => navigate("FMRScreen")}>
FMR
</Button>
</CardSection>
</Card>
カードスタイル:
cardStyle: {
flex: 1,
flexDirection: 'row',
flexWrap: 'wrap',
justifyContent: 'space-around',
alignItems: 'center',
backgroundColor: '#0000ff',
}
CardSectionスタイル:
やアイテムのスタイル:
textStyle: {
color: '#007aff',
fontSize: 20,
fontWeight: '600',
},
buttonStyle: {
backgroundColor: 'rgba(255, 255, 255, 0)',
borderWidth: 0,
borderColor: '#007aff',
flex: 1,
flexDirection: 'column',
justifyContent: 'center',
alignItems: 'center',
},
は、
そして、これは私が得るものです:
注私はflexWrapを削除する場合、この問題が消えること:「ラップ」が、私はこれを行うことはできません!
アイデア?
をラップする際に必要とされる注意を追加
alignContent: 'flex-end'
、およびFlexの項目のCSS ...?またマークアップを表示する – LGSonさて、 'cardItems'を' itemItems'に設定する必要があります。 – LGSon
@LGSonをアイテムや親にしますか? –