我試圖模仿堆棧導航標題象下面這樣: 如何在同一行中存在其他組件時水平居中組件?
在標題完全集中而有左側同一行中返回按鈕。
我試圖用justifyContent: 'space-between'
在右側有一個空的View
,但標題會偏離右側一點。我應該如何處理這個問題?
我renderHeader
功能:
_renderHeader =() => {
return (
<View style={styles.headerAbsolute}>
<View style={styles.bar}>
<ButtonBack
text={"Resumes"}
onPress={() => this._onNavBackHandler()}
/>
{true ? (
<Text style={styles.headingFixed}>{this.state.title}</Text>
) : (null)}
<View/>
</View>
</View>
)
}
這些都是風格:
bar: {
height: 55,
flexDirection: "row",
alignItems: 'flex-end',
justifyContent: 'space-between',
paddingHorizontal: 10,
paddingBottom: 5,
},
headingFixed: {
fontSize: TITLE_TERTIARY,
fontWeight: 'bold',
color: COLOR_DARK_SECONDARY,
backgroundColor: 'transparent',
},