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

How can implement show(Top) on double click? #200

Open
areksiekiera opened this issue Apr 19, 2021 · 0 comments
Open

How can implement show(Top) on double click? #200

areksiekiera opened this issue Apr 19, 2021 · 0 comments

Comments

@areksiekiera
Copy link

Issue Description

I would like the panel to open/close on double click on handler.

Steps to Reproduce / Code Snippets / Screenshots

I've tried adding TouchableWithoutFeedback around handler which works, but now I can't drag it normally.

let backCount = 0
let backTimer = false
return (
      <SlidingUpPanel
          allowDragging={allowDragging}
          friction={0.4}
          containerStyle={styles.panel}
          ref={refSlider}
          draggableRange={draggableRange}
          onDragEnd={(value, gestureState) => {setPanelLocation(value)}}
      >
        {dragHandler => (
            
            <Layout style={styles.handler}>
            
              <TouchableWithoutFeedback
                onPress={() => {
                  backCount++
                  if (backCount == 2) {
                      clearTimeout(backTimer)
                      toggle()
                  } else {
                      backTimer = setTimeout(() => {
                        backCount = 0
                      }, 3000) 
                  }
                }}
              >
                <Layout style={dragHandlerStyle} {...dragHandler}>
                  { dragHandlerTitle }
                </Layout>
              </TouchableWithoutFeedback>
            
              <ScrollView
                onTouchStart={() => setAllowDragging(false)}
                onTouchEnd={() => setAllowDragging(true)}
                onTouchCancel={() => setAllowDragging(true)}
                style={styles.container}
              >

                { panelView }
              </ScrollView>
            
            </Layout>
        )}
      </SlidingUpPanel>
)

Environment

  • Version: 2.4.5
  • React Native version: 0.63.2
  • Platform(s) (iOS & Android, or both?): both
  • Device info (Simulator/Device? OS version? Debug/Release?): android simulator on ubuntu
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

1 participant