我尝试过的解决方案之一是,在android manifest中更改android:windowSoftInputMode="adjustPan"或"adjustNothing"。这正常工作,但我们在另一个选项卡中使用聊天布局,需要"adjustResize"。因此,我必须保持windowSoftInputMode为"adjustResize"。
另一种解决方案是,在组件内部更改windowSoftInputMode。因此,我尝试了https://www.npmjs.com/package/react-native-android-keyboard-adjust,但没有用处。
还有一种方法是创建一个类似于https://github.com/react-navigation/react-navigation/issues/618中提到的TabBarComponent。但是效果不如预期。
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
}
}
}
);
- 除了将底部标签栏固定在底部之外,是否还存在其他属性? 或
- 是否有可能从组件内部更改Android清单windowSoftInputMode? 如果需要其他代码部分作为参考,请在下面评论。感谢任何帮助。