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

Know when cell is pressed? #1

Closed
dsandmark opened this issue Mar 12, 2017 · 5 comments
Closed

Know when cell is pressed? #1

dsandmark opened this issue Mar 12, 2017 · 5 comments

Comments

@dsandmark
Copy link

Hi,

Thanks for creating this component, it's very handy.

Is there a way of knowing when a cell is pressed? I wrap my cells in a <TouchableOpacity> but onPress is never called. Do you perhaps consume the onPress event in ScrollView or ScrollViewChild? Was hoping I could send an onPress attribute and have a method called when a cell is pressed.

class GridContent extends Component {
...
renderCell(cell) {
  return (
    <TouchableOpacity
      onPress = {() => { console.log('onPress') }}
      key = {cell.id}
      style = {styles.cellContainer}
    >
      <Text>{cell.id}</Text>
    </TouchableOpacity>
  )
}
...

Thank you.

@dsandmark
Copy link
Author

@chrisfisher

@chrisfisher
Copy link
Owner

@dsandmark I'm currently working on a fix for this, it should be ready to land within the next few days.

@chrisfisher
Copy link
Owner

chrisfisher commented Mar 15, 2017

@dsandmark I've made a minor change, updated the example and published a new patch version. You can control which views should intercept touch events by using the pointerEvents prop. Looks like it'll need some more significant changes to work perfectly in Android, but as the example shows you can work around this somewhat.

@dsandmark
Copy link
Author

Thank you @chrisfisher, will have a look. Our main platform is Android but anything that works will do for now.

@dsandmark
Copy link
Author

Works like a charm. Thank you @chrisfisher.

shevchenkona19 pushed a commit to shevchenkona19/react-native-directed-scrollview that referenced this issue Feb 6, 2019
e1ferapontov pushed a commit to e1ferapontov/react-native-directed-scrollview that referenced this issue Jan 16, 2020
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