嘗試了不同的東西,它們都不起作用,檔案也無濟于事
<MainFlowStack.Navigator
screenOptions={{headerTitleAlign: 'left', shadowColor: 'transparent', headerStyle: {height: 200}}}
>
<MainFlowStack.Screen name="RoutinesList" component={RoutinesListScreen} option={{headerStyle: {height: 600}}} options={{
headerTitle: (props) =>
(<View style={{width: '100%'}}>
<Text style={styles.header1}>
Your Workouts
</Text>
</View>),
headerShadowVisible: false,
headerStyle: {height: 100}
}} />
<MainFlowStack.Screen name="RoutineScreen" component={RoutineScreen} options={({ route }) => ({ title: route.params.name })} />
</MainFlowStack.Navigator>
uj5u.com熱心網友回復:
的headerStyle道具Stack.Navigator不支持設定自定義高度。從官方檔案:
標題樣式
標題的樣式物件。支持的屬性:
- 背景顏色
就我而言,這與 react-navigation 相比發生了變化v5。
但是,我們可以提供自定義標題組件并以這種方式設定特定高度。
<Stack.Screen
options={
header: (props) =>
(
<View style={{ height: 100 }}>
...
</View>
),
}
/>
轉載請註明出處,本文鏈接:https://www.uj5u.com/qianduan/433666.html
