各項目を100%幅にします。スタイルブロックにalignSelf: 'stretch',
を追加すると機能しません。ネイティブでは子要素に100%の幅を設定できません
下記の画像をチェックしてください!
マイコード:
<View>
<ButtonNav style={
this.state.currentTab == 'order'
? styles.currentTab
: styles.tabItem
}
onPress={this.order}
tagline="BESTÄLLNING" />
</View>
const styles = StyleSheet.create({
navWrapper: {
flexDirection: 'row',
height: 75,
alignItems: 'center',
backgroundColor: '#949494',
flex: 1
},
tabItem: {
justifyContent: 'center',
borderWidth: 2,
borderColor: '#333333',
flexGrow: 1,
flex: 1
},
currentTab: {
backgroundColor: '#EEEEEE',
justifyContent: 'center',
flexGrow: 1,
borderTopWidth: 2,
borderTopColor: '#333333',
flex: 1
}
});
を動作するはずこれを試して、あなたの 'ButtonNav'ためのコードを記載してください。 'StyleSheet'とは何ですか? –