React-Native页脚不是静态的

时间:2018-05-04 07:16:29

标签: react-native

我为反应原生应用程序创建了一个页脚。它没有固定在底部。当键盘打开时,页脚也会向上移动。这是我的代码。如何在底部固定页脚?

export const TabNavFooter = TabNavigator(
  {
    mainfeed: { screen: MainFeedScreen },
    workout: { screen: WorkoutScreen },
    videos: { screen: VideosScreen },
    chat: { screen: ChatScreen },
    profile: { screen: ProfilePageScreen }
  },
  {
    navigationOptions: ({ navigation }) => ({
      tabBarIcon: ({ focused, tintColor }) => {
        const { routeName } = navigation.state;
        let iconName;
        if (routeName === "chat") {
          iconName = `message${focused ? "" : "-outline"}`;
        } else if (routeName === "profile") {
          iconName = `account${focused ? "" : "-outline"}`;
        }

        return <Icon name={iconName} size={25} color={tintColor} />;
      }
    }),
    tabBarComponent: TabBarBottom,
    tabBarPosition: "bottom",
    tabBarOptions: {
      activeTintColor: "blue",
      inactiveTintColor: "gray"
    },
    swipeEnabled: false,
    lazyLoad: true,
    animationEnabled: false
  }
);

1 个答案:

答案 0 :(得分:1)

除非您尝试关注的标签上有一些叠加组件,否则通常不会发生这种情况。

要将TabBar固定到屏幕底部,请将 using (var httpClient = new HttpClient(filter)) { using (var httpContent = new HttpStringContent(postBody, UnicodeEncoding.Utf8, content_type)) { var source = new CancellationTokenSource(150000); HttpResponseMessage result; try { result = await httpClient.PostAsync(new Uri(url), httpContent).AsTask(source.Token, new Progress<HttpProgress>( progress => { Debug.WriteLine("Progress"); })); } catch (TaskCanceledException e) { return new ServerRequestResponse(RequestResponseType.Timeout); } catch (Exception e) { return new ServerRequestResponse(RequestResponseType.Failure); } var buffer = await result.Content.ReadAsBufferAsync(); var byteArray = buffer.ToArray(); var responseString = Encoding.UTF8.GetString(byteArray, 0, byteArray.Length); return new ServerRequestResponse(RequestResponseType.Success, responseString); } } 添加为

tab styles