<Stack.Screen
name="addBusiness"
component={BusinessScreen}
options={{
title: 'My home',
header: (navigationOptions) => (
<View
style={{
position: 'relative',
bottom: 0,
height: 80,
width: '100%',
backgroundColor: '#dbdbdb',
}}
>
<Text>HOME</Text>
</View>
),
}}
/>
答案 0 :(得分:0)
您可以执行以下操作:
my_vals = np.random.choice(mean_max, size=(no_samples, len(mean_max)), replace=True)
然后可以像这样使用 import {isTablet} from 'react-native-device-info';
// ...
const headerStyles = () => {
if (isTablet()) {
return {
header: () => (
<View
style={{
position: 'absolute',
top: Dimensions.get('window').height - 60,
left: 0,
right: 0,
height: 60,
borderWidth: 1,
justifyContent: 'center',
alignItems: 'center',
}}>
<Text>HOME</Text>
</View>
),
};
}
}
:
headerStyles
因此,您需要从options={{
title: 'My home',
...headerStyles(),
}}
导入Dimensions
,并从react-native
导入isTablet
。
如果设备不是平板电脑,则此实现使用默认的react导航标题。因此,如果您还希望在移动设备上具有自定义标头,则同样需要在else语句中或if语句之后返回标头组件。