Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

191
Views
Componente con estilo que no genera estilos en nuevas ventanas

Me está costando mucho tratar de hacer que react-select renderice un menú desplegable en una nueva ventana. Supuse que había algunos problemas con los componentes con estilo y encontré este problema de GitHub con una solución a mi problema exacto: https://github.com/styled-components/styled-components/issues/3274

Pero aún no está funcionando. ¿Alguien puede ayudarme a entender cómo representar correctamente el menú desplegable react-select en una nueva ventana?

Aquí está mi código:

 // app.tsx import "./styles.css"; import React, { useState } from "react"; import SelectComponent from "./control"; export default function App() { const [show, setShow] = useState(false); return ( <div className="App"> <h1>Hello CodeSandbox</h1> <a onClick={() => setShow(!show)}>Click me</a> {show && <SelectComponent show={show} />} <div style={{ marginTop: "50px" }}>Status: {show ? "True" : "False"}</div> </div> ); }

Y el otro archivo es:

 // control.tsx import React, { useState, useRef } from "react"; import Select from "react-select"; import styled, { StyleSheetManager } from "styled-components"; import Popout from "react-popout"; const options = [ { value: "chocolate", label: "My Chocolates" }, { value: "strawberry", label: "Strawberry" }, { value: "vanilla", label: "Vanilla" } ]; const SelectComponent = ({ show }) => { const nwRef = useRef(); return ( <StyleSheetManager target={nwRef.current}> <div ref={nwRef}> <Popout isPopout={true}> <Select options={options} // menuPortalTarget={nwRef.current} styles={{ menuPortal: (base) => ({ ...base, zIndex: 9999 }) }} /> </Popout> </div> </StyleSheetManager> ); }; export default SelectComponent;

¿Puede alguien indicarme la dirección correcta para mostrar ese menú desplegable correctamente? Incluso probé el menuPortalTarget react-select pero no funciona. Cualquier ayuda sería apreciada.

about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!