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

Add mouseMode prop for selecting items by click or drag #83

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

krlls
Copy link

@krlls krlls commented Nov 11, 2024

Hi!

I’ve added a mouseMode prop that allows controlling the method of item selection with a mouse. Now, you can select an item either by clicking or by dragging, depending on the set value.

  • Introduced the mouseMode prop with values 'click' and 'drag'.
  • When set to 'click', the item will be selected by a mouse click as is currently implemented.
  • When set to 'drag', the item will be selected by dragging, similar to mobile behavior
import { useState } from 'react'
import Picker from 'react-mobile-picker'

function MyPicker() {
  const [pickerValue, setPickerValue] = useState({
    name1: 'item1',
    /* ... */
  })

  return (
    <Picker value={pickerValue} onChange={setPickerValue} mouseMode="drag">
      {/* ... */}
    </Picker>
  )
}

- Added the `mouseMode` prop to control item selection behavior.
- If set to 'click', item selection will happen by clicking.
- If set to 'drag', item selection will happen by dragging (similar to mobile behavior).
Copy link

vercel bot commented Nov 11, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-mobile-picker ✅ Ready (Inspect) Visit Preview 💬 Add feedback Nov 11, 2024 8:27pm

@bharatgidwani
Copy link

I am still facing this issue. Is this merged?

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

Successfully merging this pull request may close these issues.

2 participants