Dhe*_*n M 11 javascript android react-native react-native-android bottomnavigationview
我们正在使用 createBottomTabNavigator。在其中一个选项卡中包含顶部的搜索栏。单击该搜索栏时,我们正在打开键盘。但是键盘也向上推底部标签栏。打开键盘时,我们需要底部标签栏保持在底部。
const SignedIn = createBottomTabNavigator(
{
Followers: {
screen: FollowerStack,
...
},
Search: {
screen: SearchStack,
},
Home: {
screen: HomeStack,
},
Bookmarks: {
screen: BookmarkStack,
},
Profile: {
screen: ProfileStack,
}
},
{
initialRouteName: "Home",
tabBarPosition: 'bottom',
swipeEnabled: false,
animationEnabled: false,
tabBarOptions: {
keyboardHidesTabBar: true,
showIcon: true,
showLabel: false,
activeTintColor: "red",
inactiveTintColor: "gray",
adaptive: true,
safeAreaInset: {
bottom: "always"
},
style: {
position: 'relative',
backgroundColor: "#F9F8FB",
height: TAB_NAVIGATOR_DYNAMIC_HEIGHT,
paddingTop: DeviceInfo.hasNotch() ? "5%" : "0%",
minHeight: TAB_NAVIGATOR_DYNAMIC_HEIGHT,
width: '100%',
bottom: 0
}
}
}
);
Run Code Online (Sandbox Code Playgroud)
Cha*_*hok 31
我用的是 React navigation 5,这是你想要的吗?
<SignedIn.Navigator
tabBarOptions={{
keyboardHidesTabBar: true
}}
}>
</SignedIn.Navigator>
Run Code Online (Sandbox Code Playgroud)
要在此处阅读的文档。
小智 25
请使用此功能
<Tab.Navigator
screenOptions={{
tabBarHideOnKeyboard: true
}}
/>
Run Code Online (Sandbox Code Playgroud)
我相信它会完美地工作
小智 10
找到它,只需将底部导航添加到视图中,以制作屏幕尺寸的视图,如下所示:
import React from 'react'
import { StyleSheet, Text, View, Dimensions } from 'react-native'
import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
const { width, height } = Dimensions.get("window")
const Tab = createBottomTabNavigator()
export default function () {
return (
<View style={{
width,
height,
}}>
<Tab.Navigator>
<Tab.Screen
name="Screen1"
component={Component}
/>
<Tab.Screen
name="Screen2"
component={Component}
/>
<Tab.Screen
name="Screen3"
component={Component}
/>
</Tab.Navigator>
</View>
)
}
Run Code Online (Sandbox Code Playgroud)
只需转到AndroidManifest.xml文件并更改/添加内部activity标签:
android:windowSoftInputMode="adjustPan"
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
10625 次 |
| 最近记录: |