【问题标题】:react-native footer appears above keyboard on androidreact-native 页脚出现在 android 的键盘上方
【发布时间】:2018-06-07 14:49:07
【问题描述】:

我有这个 react-navigation TabNavigator 组件,问题是当表单输入聚焦时,TabNavigator 页脚出现在键盘顶部,并且仅在 Android 上发生。如何解决这个问题?我尝试添加样式,例如 位置:'绝对', 底部:0 在 tabBar 选项中。 这是我的 TabNavigator

export const AuthTaber = TabNavigator(
  {
    Signin: { screen: Signin },
    Signup: { screen: Signup }
  },
  {
    tabBarPosition: 'bottom',
    swipeEnabled: true,
    animationEnabled: true,
    lazy: true,
    tabBarComponent: props => {
      return(
        <Footer>
          <FooterTab style={Style.bgBlack}>
            <Button
              vertical
              // active={props.navigationState.index === 0}
              onPress={() => props.navigation.navigate('Signin')}
              >
              <Text style={Style.white}>Sign In</Text>
            </Button>
            <Button
              vertical
              // active={props.navigationState.index === 1}
              onPress={() => props.navigation.navigate('Signup')}
              >
              <Text style={Style.white}>Sign Up</Text>
            </Button>
          </FooterTab>
        </Footer>
      );
    }
  }
);

【问题讨论】:

标签: javascript android react-native native-base


【解决方案1】:

添加这个

<activity
.....
        android:windowSoftInputMode="stateUnspecified|adjustPan"

.....

在 AndroidManifest.xml 中

【讨论】:

    【解决方案2】:

    使用 View 而不是 footer 和 native-base

       <View style={Style.bgBlack}>    // Do not have width and height in style
          <Button
            vertical
            // active={props.navigationState.index === 0}
            onPress={() => props.navigation.navigate("Signin")}
          >
            <Text style={Style.white}>Sign In</Text>
          </Button>
          <Button
            vertical
            // active={props.navigationState.index === 1}
            onPress={() => props.navigation.navigate("Signup")}
          >
            <Text style={Style.white}>Sign Up</Text>
          </Button>
        </View>
    

    【讨论】:

      猜你喜欢
      • 2017-05-10
      • 1970-01-01
      • 2013-07-19
      • 1970-01-01
      • 2013-07-24
      • 2019-06-12
      • 2020-06-09
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多