octopitus / rn-sliding-up-panel

Draggable sliding up panel implemented in React Native https://octopitus.github.io/rn-sliding-up-panel/
MIT License
928 stars 157 forks source link

onDragStart not working #134

Open Miiiiii7 opened 5 years ago

Miiiiii7 commented 5 years ago

Issue Description

It seems that onDragStart prop is not been called. The code bellow is an example of a simple console.log to show when the panel starts and stops dragging. It just shows the 'end' console.log

Steps to Reproduce / Code Snippets / Screenshots

import React from 'react'
import {View, TouchableOpacity, Text, ScrollView, Alert} from 'react-native'

import SlidingUpPanel from 'rn-sliding-up-panel'

const styles = {
  container: {
    flex: 1,
    zIndex: 1,
    backgroundColor: 'white',
    alignItems: 'center',
    justifyContent: 'center'
  },
  dragHandler: {
    alignSelf: 'stretch',
    height: 64,
    alignItems: 'center',
    justifyContent: 'center',
    backgroundColor: '#ccc'
  }
}

class ScrollViewInsidePanel extends React.Component {
  render() {
    return (
      <View style={styles.container}>
        <TouchableOpacity onPress={() => this._panel.show()}>
          <View>
            <Text>Test</Text>
          </View>
        </TouchableOpacity>
        <SlidingUpPanel 
          onDragStart={() => console.log('start')}
          onDragEnd={() => console.log('end')}
        ref={c => (this._panel = c)}>
          {dragHandler => (
            <View style={styles.container}>
              <View style={styles.dragHandler} {...dragHandler}>
                <Text>Drag handler</Text>
              </View>
              <ScrollView>
                <Text>Here is the content inside panel</Text>
                <Text>Here is the content inside panel</Text>
                <Text>Here is the content inside panel</Text>
                <Text>Here is the content inside panel</Text>
                <Text>Here is the content inside panel</Text>
                <Text>Here is the content inside panel</Text>
                <Text>Here is the content inside panel</Text>
                <Text>Here is the content inside panel</Text>
                <Text>Here is the content inside panel</Text>
                <Text>Here is the content inside panel</Text>
                <Text>Here is the content inside panel</Text>
                <Text>Here is the content inside panel</Text>
                <Text>Here is the content inside panel</Text>
                <Text>Here is the content inside panel</Text>
              </ScrollView>
            </View>
          )}
        </SlidingUpPanel>
      </View>
    )
  }
}

export default ScrollViewInsidePanel

Environment

sheheryar-pirzada commented 5 years ago

It's not working for me either. I am using the latest version

octopitus commented 5 years ago

Fixed in v2.3.1.