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

90
Visualizações
Scrollview whose individual child takes all remaining area

I want to create a scrollview (in react-native app) whose individual children take the remaining space on the screen.

The goal is that, as user scrolls, he should only be shown one profile at a time instead of multiple profiles.

This is how my Scroll view code looks

const ProfileVerticalScroll = ({
  active = 0,
  setActive,
  profileData,
  scrollViewRef,
}: Props) => {
  return (
    <ScrollView style={styles.scrollView} ref={scrollViewRef}>
      {profileData.map((el, index) => {
        return (
          <View style={styles.profile}>
            <View style={styles.profileHeadings}>
              <Text>{el.name} </Text>
              <Text>{el.profession}</Text>
            </View>
            <View style={styles.abouteMe}>
              <Text> About Me</Text>
              <Text>{el.info}</Text>
            </View>
          </View>
        );
      })}
    </ScrollView>
  );
};

export default ProfileVerticalScroll;

Where styles, for now, are just these

import { StyleSheet, Dimensions } from 'react-native';

const { width } = Dimensions.get('window');
export default StyleSheet.create({
  scrollView: {},
  profile: {
    flex: 1,
    display: 'flex',
    flexDirection: 'column',
    alignItems: 'center',
    width: width,
    paddingHorizontal: width * 0.05,
  },
  profileHeadings: {},
  abouteMe: {},
});

Problem: I am unable to get single children of a ScrollView to take up the entire screen

For example, In the below screenshot, I would want Alan to take the complete screen and further scrolling should take the user to Amanda and so on

enter image description here

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

0

Hello have you try to set the height to min-max 100vh? like below:

profile: {
    flex: 1,
    display: "flex",
    flexDirection: 'column',
    alignItems: 'center', 
    minHeight: '100vh',
    width: width,
    paddingHorizontal: width*0.05,
}
about 4 years ago · Juan Pablo Isaza Relatório

0

If you're trying to have each profile fill 100% of the container vertically and scroll through then I would do something like this:

export default StyleSheet.create({
  scrollView: {
    overflowY: 'scroll',
  },
  profile: {
    height: '100%',
    display: 'flex',
    flexDirection: 'column',
    alignItems: 'center',
    width: width,
    paddingHorizontal: width * 0.05,
  },
  profileHeadings: {},
  abouteMe: {},
});
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