I have tried everything I can think of, but I cannot prevent the placeholder in react-select from disappearing (I assume changed to display: none
because it is no longer in the HTML) when a value is selected for the component.
I've read through both posts with similar issues: https://github.com/JedWatson/react-select/issues/2152 https://github.com/JedWatson/react-select/issues/2143
But haven't found any success
My Styling on the placeholder element is:
valueContainer: base => ({
overflow: 'visible'
}),
placeholder: (provided, state) => ({
...provided,
position: "absolute",
marginTop: '-30px',
display:
state.isFocused || state.isSelected || state.selectProps.inputValue || state.value
? 'block'
: 'block',
}),
Here is a stackblitz. The end goal is to start the placeholder in the center and move it up to the spot it is here on focus and selection. The problem is, once something is selected, the placeholder disappears. https://stackblitz.com/edit/react-egf4va