picker beeing rendered below other components
See original GitHub issueDescribe the bug I can open the picker but when i open it the items are rendered below other components and they can’t be touched, i’ve read some topics about it in the documentation but I couldn’t find a solution on my own
To Reproduce To reproduce this error open your react-native project (i have started a project with CRNA and not using EXPO) and:
- Create a screen
- Place a View inside the screen and into this View place my CustomDropdown (the code of the component is right below)
- Give some items to the dropdown Here are some items to make it easy:
[
{ label: 'January', value: 'jan' },
{ label: 'February', value: 'fev' },
{ label: 'Mars', value: 'mar' },
{ label: 'April', value: 'apr' },
{ label: 'May', value: 'may' },
{ label: 'June', value: 'jun' },
{ label: 'July', value: 'jul' },
{ label: 'August', value: 'ago' },
{ label: 'September', value: 'set' },
{ label: 'October', value: 'out' },
{ label: 'November', value: 'nov' },
{ label: 'December', value: 'dec' },
]
- Place some Text outside the View which contains the dropdown component
I have made a custom component for the dropdown, it’s only a Container wrapper arround the dropdown to give some aditional styles CustomDropdown.tsx
import React, { Dispatch, SetStateAction } from 'react';
import DropDownPicker from 'react-native-dropdown-picker';
import { Container } from './styles';
interface DropwDownProps {
selectedValue: string;
setSelectedValue: Dispatch<SetStateAction<string>>;
items: Array<{ label: string; value: string }>;
contrast?: boolean;
size?: string;
}
const DropDown: React.FC<DropwDownProps> = ({
selectedValue,
setSelectedValue,
items,
contrast = false,
size = 'small,',
...rest
}) => {
return (
<Container contrast={contrast} size={size} {...rest}>
<DropDownPicker
items={items}
defaultValue={selectedValue}
containerStyle={{
height: '100%',
width: size === 'small' ? 100 : 170,
}}
style={{ backgroundColor: 'transparent' }}
selectedLabelStyle={{ color: contrast ? '#002d72' : '#fff' }}
arrowColor={contrast ? '#002d72' : '#fff'}
onChangeItem={(item) => console.log(item.value)}
/>
</Container>
);
};
export default DropDown;
styles.ts
import styled, { css } from 'styled-components/native';
interface ContainerProps {
contrast: boolean;
size: string;
}
export const Container = styled.View<ContainerProps>`
border-radius: 6px;
justify-content: center;
margin-right: 20px;
${(props) =>
props.size === 'small'
? css`
height: 40px;
width: 100px;
`
: css`
height: 45px;
width: 170px;
`}
${(props) =>
props.contrast
? css`
border: solid 1px #002d72;
`
: css`
border: solid 1px #fff;
`}
`;
Expected behavior The expected behavior was that the items of the dropdown should be clickable and above all other components
Screenshots Android screenshot
iOS screenshot
Info (please complete the following information):
- OS: [iOS, Android]
Additional context It’s my first time opening an issue, sorry if i forgot something, just let me know it and i’ll improve it for you, thanks for any help ❤️
Issue Analytics
- State:
- Created 3 years ago
- Reactions:13
- Comments:29 (1 by maintainers)

Top Related StackOverflow Question
I can echo @Jose24San. I had a similar issue with this, where the dropdown box would render behind two Button elements. I tried using z-index in the View wrapper for the picker, but that didn’t seem to do anything.
However, I set the z-index to a negative value in the View that wrapped around those buttons, and that seemed to do the trick. So perhaps trying to set a negative z-index on all the other elements that appear over the picker is a quick fix.
Roughly something like this:
Got this working by setting a state together with zIndex property set to
2to control theisVisibleprops from the package P:S