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

118
Visualizações
How to make picker appear in selected region in React Native

I try to implement a picker and make him visible only in an certain area of an box. I added an style with width and height to my picker and I expected the picker will appear in this box. The picker gets rendered completely different. How can I render the picker inside of the box which I define in my style attribute for the picker?

Here is my implementation:

Imports

import React, { useState } from "react";
import { StyleSheet, Text, View } from "react-native";
import { Picker } from "@react-native-picker/picker";

Function

const LandingPage = () => {
  const [selectedValue, setSelectedValue] = useState("10 rounds");
  return (
    <View style={[styles.styleGeneral, {}]}>
      <View style={[styles.styleStandardOne]}>...Some view...</View>
      <View style={[styles.styleForPicker]}>
        <Text style={{ fontSize: 30 }}>Rounds</Text>
        <Picker
          selectedValue={selectedValue}
          style={{ height: 100, width: 100, backgroundColor: "blue" }}
          onValueChange={(itemValue, itemIndex) => setSelectedValue(itemValue)}
        >
          <Picker.Item label="red" value="0"></Picker.Item>
          <Picker.Item label="blue" value="1"></Picker.Item>
        </Picker>
      </View>
      <View style={[styles.styleStandardTwo]}>...Some view...</View>
      <View style={[styles.styleStandardTwo]}>...Some view...</View>
      <View style={[styles.styleStandardTwo]}>...Some view...</View>
    </View>
  );
};

Styles

const styles = StyleSheet.create({
  styleGeneral: {
    flex: 1,
    padding: 20,
    flexDirection: "column",
    margin: 0,
    padding: 0,
  },

  styleForPicker: {
    backgroundColor: "yellow",
    flex: 3,
  },

  styleStandardOne: {
    backgroundColor: "red",
    flex: 1.5,
    justifyContent: "center",
  },

  styleStandardTwo: {
    backgroundColor: "red",
    justifyContent: "center",
    alignItems: "center",
    flex: 3,
  },
});

about 4 years ago · Juan Pablo Isaza
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