TabNavigator nao aparece da maneira que imaginei - resolvido

Tenho esta Home

import { NavigationContainer } from "@react-navigation/native";
import { StackNavigationProp } from "@react-navigation/stack";
import React from "react";
import { StyleSheet, View } from "react-native";
import { RootNavigator } from "../App";
import HomeScrollView from "../componentes/HomeScrollView";
import TabNavigator from "../componentes/TabNavigator";
import TopoPaginaUsuarioLogado from "../componentes/TopoPaginaUsuarioLogado";

interface Props {
  navigation: StackNavigationProp<RootNavigator, "Login">;
}

const Home: React.FC<Props> = ({ navigation }) => {
  return (
    <>
      <View>
        <TopoPaginaUsuarioLogado
          apereceBotaoVoltar={false}
          titulo={"Ol√° Jo√£o Pedro !"}
          navigation={navigation}
        ></TopoPaginaUsuarioLogado>
        <HomeScrollView navigation={navigation} />
        <NavigationContainer independent={true}>
          <TabNavigator />
        </NavigationContainer>
      </View>
    </>
  );
};

const specificStyle = StyleSheet.create({
  headerFooterStyle: {
    height: 45,
    backgroundColor: "#606070",
  },
  textStyle: {
    textAlign: "center",
    color: "#fff",
    fontSize: 18,
    padding: 7,
  },
});

export default Home;

TabNavigator

import { createBottomTabNavigator } from "@react-navigation/bottom-tabs";
import React from "react";
import Login from "../screens/Login";

const AppTab = createBottomTabNavigator();

interface Props {}

const TabNavigator: React.FC<Props> = ({}) => {
  return (
    <AppTab.Navigator>
      <AppTab.Screen name="Início" component={Login} />
      <AppTab.Screen name="Assistência" component={Login} />
      <AppTab.Screen name="Perfil" component={Login} />
    </AppTab.Navigator>
  );
};

export default TabNavigator;

HomeScrollView

import { StackNavigationProp } from "@react-navigation/stack";
import React from "react";
import { Image, ScrollView, StyleSheet, Text } from "react-native";
import { Card } from "react-native-elements";
import { RootNavigator } from "../App";
import HomeSolicitacaoServico from "./HomeSolicitacaoServico";

interface Props {
  navigation: StackNavigationProp<RootNavigator, "Login">;
}

const HomeScrollView: React.FC<Props> = ({ navigation }) => {
  return (
    <ScrollView>
      <Card containerStyle={specificStyle.card}>
        <Text
          adjustsFontSizeToFit={true}
          style={{
            color: "#000000",
            fontSize: 20,
            fontStyle: "normal",
            fontWeight: "700",
            lineHeight: 23,
            alignItems: "center",
            fontFamily: "Roboto-Regular",
            marginLeft: 0,
            marginTop: 5,
          }}
        >
          Solicita√ß√Ķes em andamento
        </Text>
        <Card containerStyle={specificStyle.cardReboque}>
          <Text
            adjustsFontSizeToFit={true}
            style={{
              color: "#000000",
              fontSize: 20,
              fontStyle: "normal",
              fontWeight: "700",
              lineHeight: 23,
              alignItems: "center",
              fontFamily: "Roboto-Regular",
              marginLeft: 0,
              marginTop: 5,
              marginBottom: 5,
            }}
          >
            Reboque - Acidente
          </Text>
          <Text
            adjustsFontSizeToFit={true}
            style={{
              color: "#000000",
              fontSize: 13,
              fontStyle: "normal",
              fontWeight: "400",
              lineHeight: 12,
              alignItems: "center",
              fontFamily: "Roboto-Regular",
              marginLeft: 0,
              marginTop: 5,
            }}
          >
            <Image source={require("../assets/fornecedor_home.png")} />
            Geraldinho da Costa e Silva
          </Text>
          <Text
            adjustsFontSizeToFit={true}
            style={{
              color: "#000000",
              fontSize: 13,
              fontStyle: "normal",
              fontWeight: "400",
              lineHeight: 12,
              alignItems: "center",
              fontFamily: "Roboto-Regular",
              marginLeft: 0,
              marginTop: 5,
            }}
          >
            <Image source={require("../assets/tempo_home.png")} />
            Em 15 minutos o prestador chegará até você
          </Text>
        </Card>
        <Text
          adjustsFontSizeToFit={true}
          style={{
            color: "#2D2D2D",
            fontSize: 20,
            fontStyle: "normal",
            fontWeight: "700",
            lineHeight: 23,
            alignItems: "center",
            fontFamily: "Roboto-Regular",
            marginLeft: 0,
            marginTop: 5,
          }}
        >
          Solicitar Serviço
        </Text>
        <HomeSolicitacaoServico navigation={navigation} numeroLinha={1} />
        <HomeSolicitacaoServico navigation={navigation} numeroLinha={2} />
        <HomeSolicitacaoServico navigation={navigation} numeroLinha={3} />
        <HomeSolicitacaoServico navigation={navigation} numeroLinha={4} />
        <HomeSolicitacaoServico navigation={navigation} numeroLinha={5} />
      </Card>
    </ScrollView>
  );
};

const specificStyle = StyleSheet.create({
  card: {
    marginTop: 0,
    marginLeft: 0,
    marginRight: 0,
    marginBottom: 100,
    borderWidth: 0,
  },
  cardReboque: {
    marginTop: 10,
    marginBottom: 10,
    marginLeft: 0,
    marginRight: 0,
    borderWidth: 1,
    borderRadius: 5,
    borderColor: "#FFFFFF",
  },
});

export default HomeScrollView;

Ele n√£o aparece:

Se tiro este componente da Home <HomeScrollView navigation={navigation} />< ele aparece.

O que pode ser ?

Coloca o HomeScrollView com o style de flex: 1

1 curtida
<ScrollView style={{ flex: 1 }}>
      <Card containerStyle={specificStyle.card}>
        <Text
          adjustsFontSizeToFit={true}
          style={{
            color: "#000000",
            fontSize: 20,
            fontStyle: "normal",
            fontWeight: "700",
            lineHeight: 23,
            alignItems: "center",
            fontFamily: "Roboto-Regular",
            marginLeft: 0,
            marginTop: 5,
          }}
        >
          Solicita√ß√Ķes em andamento
        </Text>
        <Card containerStyle={specificStyle.cardReboque}>
          <Text
            adjustsFontSizeToFit={true}
            style={{
              color: "#000000",
              fontSize: 20,
              fontStyle: "normal",
              fontWeight: "700",
              lineHeight: 23,
              alignItems: "center",
              fontFamily: "Roboto-Regular",
              marginLeft: 0,
              marginTop: 5,
              marginBottom: 5,
            }}
          >
            Reboque - Acidente
          </Text>
          <Text
            adjustsFontSizeToFit={true}
            style={{
              color: "#000000",
              fontSize: 13,
              fontStyle: "normal",
              fontWeight: "400",
              lineHeight: 12,
              alignItems: "center",
              fontFamily: "Roboto-Regular",
              marginLeft: 0,
              marginTop: 5,
            }}
          >
            <Image source={require("../assets/fornecedor_home.png")} />
            Geraldinho da Costa e Silva
          </Text>
          <Text
            adjustsFontSizeToFit={true}
            style={{
              color: "#000000",
              fontSize: 13,
              fontStyle: "normal",
              fontWeight: "400",
              lineHeight: 12,
              alignItems: "center",
              fontFamily: "Roboto-Regular",
              marginLeft: 0,
              marginTop: 5,
            }}
          >
            <Image source={require("../assets/tempo_home.png")} />
            Em 15 minutos o prestador chegará até você
          </Text>
        </Card>
        <Text
          adjustsFontSizeToFit={true}
          style={{
            color: "#2D2D2D",
            fontSize: 20,
            fontStyle: "normal",
            fontWeight: "700",
            lineHeight: 23,
            alignItems: "center",
            fontFamily: "Roboto-Regular",
            marginLeft: 0,
            marginTop: 5,
          }}
        >
          Solicitar Serviço
        </Text>
        <HomeSolicitacaoServico navigation={navigation} numeroLinha={1} />
        <HomeSolicitacaoServico navigation={navigation} numeroLinha={2} />
        <HomeSolicitacaoServico navigation={navigation} numeroLinha={3} />
        <HomeSolicitacaoServico navigation={navigation} numeroLinha={4} />
        <HomeSolicitacaoServico navigation={navigation} numeroLinha={5} />
      </Card>
    </ScrollView>

assim ?

Se for nao funcionou.

Vou executar aqui, perai

1 curtida

Cara, t√° meio complicado testar aqui sem o acesso aos mesmos assets que vc, vamos tentar assim.

Vc colocou um Fragment e depois um View, faz o seguinte, remove o Fragment, e deixa o View com o flex 1, tipo assim:

<View style={{flex: 1}}>
   <Topo>.....</Topo>
   .....
</View>
1 curtida