Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

245
Visualizações
ScrollView cut off in React Native

I have encountered a problem. ScrollView is cut off at the bottom of the screen on both Android and iOS. It's "unscrollable". My code is rather simple:

 <View style={{ flex: 1 }}>
          <ScrollView style={styles.container}>
            <Image
              style={styles.image}
              source={{ uri: constants.media_url + "/" + data.img }}
            />

            <Text style={styles.title}>{data.heading}</Text>
            <Text style={styles.published_date}>{data.published_date}</Text>

            <Text style={styles.introduction}>
              {stripHTML(data.introduction)}
            </Text>
            <RenderHtml contentWidth={width} source={source} />
          </ScrollView>
        </View>
const styles = StyleSheet.create({
  container: {
    backgroundColor: colors.background,
    padding: 10,
    flex: 1,
  },
  image: {
    width: "100%",
    maxHeight: 270,
    height: "100%",
  },
  title: {
    fontSize: 24,
    marginTop: 20,
    fontWeight: "bold",
  },
  introduction: {
    fontWeight: "bold",
  },
  text: {
    fontWeight: "normal",
    marginTop: 13,
  },
  published_date: {
    color: colors.gray,
    marginVertical: 10,
  },
});

As you can see I have used flex tricks, I've also tried padding, everything. It just doesn't work. I use only two libraries in my project: "react-native-render-html": "^6.3.4", and React Navigation.

Thank you!

about 4 years ago · Juan Pablo Isaza
1 Respostas
Responde à pergunta

0

So, after hours of searching and trying, literally, I have done it.

<View style={{ flex: 1 }}>
          <ScrollView
            style={styles.container}
            contentContainerStyle={{ flexGrow: 1, paddingBottom: 300 }}
          >
            <Image
              style={styles.image}
              source={{ uri: constants.media_url + "/" + data.img }}
            />

            <Text style={styles.title}>{data.heading}</Text>
            <Text style={styles.published_date}>{data.published_date}</Text>

            <Text style={styles.introduction}>
              {stripHTML(data.introduction)}
            </Text>
            <RenderHtml contentWidth={width} source={source} />
          </ScrollView>
        </View>

What I changed is I added contentContainerStyle={{ flexGrow: 1, paddingBottom: 300 }} to my ScrollView component. For me 300 worked, maybe you can change according to your needs.

about 4 years ago · Juan Pablo Isaza Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda