Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dropdown list conflict with below View #754

Closed
saaspeter opened this issue May 16, 2024 · 8 comments
Closed

dropdown list conflict with below View #754

saaspeter opened this issue May 16, 2024 · 8 comments

Comments

@saaspeter
Copy link

saaspeter commented May 16, 2024

Hi: When I use this good lib, I encounter a problem, see below picture:
截屏2024-05-16 15 49 36

the View is under the select dropdown list, they are conflicted. The component's version is: 5.4.6. The code like this:
"< View style={styles.pickerView} >
<DropDownPicker containerStyle={styles.pickerStyles}
style={{ backgroundColor: "crimson" }}
open={open}
value={drugDose.unitType}
items={items}
mode={"SIMPLE"}
textStyle={{ fontSize: 17 }}
setOpen={setOpen}
setValue={handleSlectChange}
setItems={setItems}
/>
</ View>
< View style={styles.footerView}>
< Text text="Generally, the dosage instructions... " />
</ View>"

I tried to add zIndex=1000 in DropDownPicker or add zIndex=1000 in its parent's View style (pickerView), but they all don't take effect in IOS simulator. My solution is to set zIndex=-1 in its below text view: styles.footerView, but I don't think it is a good solution, I think there should has a property in DropDownPicker to control the overlap problem. (unfortunately zIndex don't work), Is there any good solution?

(I found this issue: #103, but the solution link in it cannot find this section: "zindex-conflicts-untouchable-items-overlapping-pickers")

@AtulCube
Copy link

Screenshot 2024-05-24 at 3 12 20 PM same here

@AtulCube
Copy link

Screenshot 2024-05-24 at 3 13 01 PM

@Awnish-10
Copy link

i have 2 DropDownPicker one below another adding this styling property fixes overlap problem for me
containerProps={{
style: {
zIndex: open ? 10 : 1,
},
}}
my entire custom component looks like
import React, { useState } from 'react';

import { StyleSheet } from 'react-native';

import DropDownPicker from 'react-native-dropdown-picker';
import { horizontalScale, verticalScale, scale } from '../../utils/scaling';

export default function CustomDropdown({ value, setValue, items }) {
const [open, setOpen] = useState(false);

return (
<DropDownPicker
open={open}
value={value}
items={items}
setOpen={setOpen}
setValue={setValue}
theme="DARK"
style={styles.container}
containerProps={{
style: {
zIndex: open ? 10 : 1,
},
}}
/>
);
}
const styles = StyleSheet.create({
container: {
backgroundColor: '#1A1C24',
borderRadius: scale(24),
paddingVertical: verticalScale(8),
paddingHorizontal: horizontalScale(16),
color: '#FEFEFE',
fontSize: scale(14),
fontWeight: '600',
},
});

@IuriKintschev
Copy link

image
same problem here.

Unfortunately the solution above didn't work for me.

@Awnish-10
Copy link

@ferdiamg
Copy link

ferdiamg commented Aug 17, 2024

Just went like this as props for <DropDownPicker>:

zIndex={3000}
zIndexInverse={1000}

and it was solved.

@saaspeter
Copy link
Author

Thank you all, I switched another simple component. [react-native-picker-select], so I close this issue.

@mauriciofullana
Copy link

mauriciofullana commented Sep 4, 2024

#248

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants