【问题标题】:screenOptions:{{tabBarHideonKeyboard: true}} not WorkingscreenOptions:{{tabBarHideonKeyboard: true}} 不工作
【发布时间】:2022-01-02 14:49:30
【问题描述】:

当我通过tabBar 函数使用自定义标签栏时,tabBarHideOnKeyboard 不起作用但没有tabBar 函数它工作正常,任何关于如何使用tabBar 函数使其工作的想法。

【问题讨论】:

  • 你在用什么标签? react-navigation中有3个标签
  • 请提供足够的代码,以便其他人更好地理解或重现问题。
  • @jted95 我正在使用底部标签导航器

标签: react-native tabbar react-navigation-v6


【解决方案1】:

您将从自定义tabBar 的道具中获得tabBarHideOnKeyboard。

tabBar={(props) => {
  return (
    <View>
      {props.state.routes.map((route, index) => {
        // You can replace Pressable and View with anything you like
        return (
          props.descriptors[route.key].options.tabBarHideOnKeyboard && (
            <Pressable>
              <View
                style={{
                  width: 200,
                  height: 200,
                  backgroundColor: "green",
                }}
              />
            </Pressable>
          )
        );
      })}
    </View>
  );

您可以阅读更多here

【讨论】:

  • 没用..
  • 什么不起作用?你有错误吗?如果您遵循我的一些代码,您是否仍会从中获得 tabBarHideOnKeyboard` 值?
  • 我的 tabBarHideonKeyboard 值为 true,但键盘打开时底部标签栏仍然不隐藏
  • @AdeelYousaf,你是怎么处理的?你能给我看看代码吗?
  • 问题已经解决,我添加了一个键盘监听器,并且在 keyboardopen 上将底部的值更改为负数,这对我有用,顺便说一句,非常感谢。
【解决方案2】:

在“android”键下的app.json文件中添加"softwareKeyboardLayoutMode": "pan",然后使用expo start -c重新启动您的expo服务器

【讨论】:

    猜你喜欢
    • 2016-04-09
    • 2019-05-02
    • 2018-04-14
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-02-16
    相关资源
    最近更新 更多