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

Multiselect: arrow incorrect position on scroll #69

Open
kayman233 opened this issue Sep 14, 2024 · 3 comments
Open

Multiselect: arrow incorrect position on scroll #69

kayman233 opened this issue Sep 14, 2024 · 3 comments

Comments

@kayman233
Copy link

When the Multiselect component's dropdown opens upwards, the arrow indicator is incorrectly positioned when it's scrolled. Example from Storybook (with padding-top so that it opens upwards):

2024-09-14.15.56.50.mov
@ildarin22
Copy link

ildarin22 commented Dec 12, 2024

Hi! Could you please tell me how to correctly use Multiselect?
What is wrong here?

import {Multiselect} from "@telegram-apps/telegram-ui";
function Test() {
  const options = [
        { value: 'option1', label: 'option1' },
        { value: 'option2', label: 'option2' },
        { value: 'option3', label: 'option3' },
      ];
  const handleChange = (selected) => {
          setSelectedValues(selected);
          console.log('Select:', selected);
      };

   return (
       <Multiselect
                options={options}
                value={selectedValues}
                onChange={handleChange}
                placeholder="Select"
            >
                
            </Multiselect>

)


}

In StoryBook does not show the example.
image

@kayman233
Copy link
Author

kayman233 commented Dec 12, 2024

@ildarin22 In your example I can't see where you initialize your state, but the usage of the component is correct. This is not a bug in the component in your case. So please, for other questions ask them in the official telegram chat (t.me/devs) for developers.

@ildarin22
Copy link

ildarin22 commented Dec 12, 2024

@ildarin22 In your example I can't see where you initialize your state, but the usage of the component is correct. This is not a bug in the component in your case. So please, for other questions ask them in the official telegram chat (t.me/devs) for developers.

Ya, sorry, I missed useState
In general, it seems that this component does not work inside the Modal component; at least, I don't know how to set it up correctly. However, if I write it outside of the Modal, it works fine.
Thanks for link to chat!

UP: I noticed that if you add more than one component along with Multiselect in the Modal component, the dropdown stops working.

import {Multiselect, Modal} from "@telegram-apps/telegram-ui";
function Test() {
  const options = [
        { value: 'option1', label: 'option1' },
        { value: 'option2', label: 'option2' },
        { value: 'option3', label: 'option3' },
      ];

  const [selectedValues, setSelectedValues] = useState([]);
  const handleChange = (selected) => {
          setSelectedValues(selected);
          console.log('Select:', selected);
      };

   return (
   <Modal open={true}>
       <Multiselect
                options={options}
                value={selectedValues}
                onChange={handleChange}
                placeholder="Select"
            >
        </Multiselect>
          />
            <Input header="Name"></Input>
            {/* <Input header="Price"></Input>   */}  //  If uncomment this then stop working
   </Modal>
)}

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

2 participants