question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

itemFull component gets hidden on swipe-down

See original GitHub issue

This is my code

<SwipeUpDown
  swipeHeight={20}
  hasRef={ref => (this.swipeUpDownRef = ref)}
  itemFull={<Destination />}
  disablePressToShow={false}
  style={{ zIndex: 10, backgroundColor: '#a3a3a3'' }}
   animation="easeInEaseOut"
/>

Step 1: Swipe Up simulator screen shot - iphone 6 - 2018-09-04 at 19 43 00

When i try to swipe down, the content/component gets hidden and displays only the background color.

simulator screen shot - iphone 6 - 2018-09-04 at 19 43 04

What I’m trying to achieve ? Component shouldn’t hide on swipe down.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:3
  • Comments:9

github_iconTop GitHub Comments

5reactions
sunilmishracommented, Mar 12, 2019

Just add this line in showMini function. this.SWIPE_HEIGHT = 150; // Avoid hiding when swiping down.

showMini() { const { onShowMini, itemMini } = this.props; this.SWIPE_HEIGHT = 150; // Avoid hiding when swiping down. this.customStyle.style.top = itemMini ? DEVICE_HEIGHT - this.SWIPE_HEIGHT : DEVICE_HEIGHT; this.customStyle.style.height = itemMini ? this.SWIPE_HEIGHT : 0; this.swipeIconRef && this.swipeIconRef.setState({ showIcon: false }); this.updateNativeProps(); !this.state.collapsed && this.setState({ collapsed: true }); this.checkCollapsed = true; onShowMini && onShowMini(); }

0reactions
imdhemycommented, May 29, 2019

I think that the MARGIN_TOP constant on the top of the file on src/index is the source of this problem. My suggestion is to subtract it from DEVICE_HEIGHT on the showMini() method.

showMini() {
    const { onShowMini, itemMini } = this.props;
    this.customStyle.style.top = itemMini
      ? DEVICE_HEIGHT - this.SWIPE_HEIGHT - MARGIN_TOP // avoid hiding on swipe down
      : DEVICE_HEIGHT;
    this.customStyle.style.height = itemMini ? this.SWIPE_HEIGHT : 0;
    this.swipeIconRef && this.swipeIconRef.setState({ showIcon: true });
    this.updateNativeProps();
    !this.state.collapsed && this.setState({ collapsed: true });
    this.checkCollapsed = true;
    onShowMini && onShowMini();
  }
Read more comments on GitHub >

github_iconTop Results From Across the Web

React Native - Swipe to hide and show new content
import React, {Component} from 'react'; import { ScrollView, Text, View, Image, Button } from 'react-native'; import GestureRecognizer, { ...
Read more >
React Native Swipe Up Down Component - Morioh
React Native Swipe Up Down. This module support iOS & Android. Demo. When hidden component. Getting started. $ npm install react-native-swipe-up-down --save.
Read more >
react-native-swipe-up-down - npm
If you want hidden component just don't pass props itemMini . ... help you show component when hidden component <SwipeUpDown itemFull={<Test ...
Read more >
Swipeable | React Native Gesture Handler - Software Mansion
This component allows for implementing swipeable rows or similar interaction. ... method that is called when left action panel gets open.
Read more >
react-native-swipe-up-down - npm package - Snyk
Swipe Up Down component For more information about how to use this ... The npm package react-native-swipe-up-down receives a total of 335 downloads...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found