NativeBase icon indicating copy to clipboard operation
NativeBase copied to clipboard

Deck Swiper Flashing Content

Open brodus13 opened this issue 9 years ago • 18 comments

Hi there! I checked around and didn't notice any existing issues open for this.

I'm having an issue where I have quite a bit of content inside of my deck swiper cards, and random parts of the content seem to flash from invisible to visible at random intervals when the cards are being swiped, or moved around.

Is this something I'm doing wrong? It seems like a bug to me. I'd opened a question about it in the forms to ask if it was an issue with something on my end, but I had no replies, and one person comment saying the same thing was happening to them. I'll link this below... http://discuss.nativebase.io/t/deck-swiper-content-flashing/407

I don't have an example of it on hand, but I could probably create one if there isn't an easy answer for this.

Thanks so much for your time!

brodus13 avatar May 13 '17 05:05 brodus13

@brodus13 What version of React Native and NativeBase are you on? It would be good if you could post the snippet with output here

SupriyaKalghatgi avatar May 24 '17 06:05 SupriyaKalghatgi

#866

SupriyaKalghatgi avatar May 26 '17 10:05 SupriyaKalghatgi

#334

SupriyaKalghatgi avatar May 26 '17 13:05 SupriyaKalghatgi

Hi there @SupriyaKalghatgi , sorry for the delayed response, here's the versions I'm working on. "native-base": "2.1.0-rc.2", "react": "~15.4.0", "react-native": "0.42.3",

brodus13 avatar May 27 '17 20:05 brodus13

Hi! I'm facing the same issue using react-native 0.44.3 and native-base 2.1.4 Any news about it?

Thanks!

mdebo avatar Jul 26 '17 20:07 mdebo

i'm having the same issue on IOS. Please look at my video in referenced issue

flieks avatar Oct 11 '17 09:10 flieks

Hey! I haven't checked out the code of GeekyAnts Nativebase package but generally my images flash when I re-render a component from View tag to Animated.View tag. So basically, you should use <Animated.View> even for the cards that are not at the top of the stack.

pallavbakshi avatar Dec 10 '17 05:12 pallavbakshi

Yes. I followed a deck swiper component creation online tutorial. After use <Animated.View> for the cards that are not at the top of the stack, the image flashing is gone.

CliveTeow avatar Dec 10 '17 12:12 CliveTeow

Hey guys, I am having this same issue.

The Animated.View approach didnt work for me though :(

However I was able to find something out. The content flickers because it is being re-rendered several times. By putting a simple log statement in the renderItems function you can see everytime that the card is swipe the item is re-rendered between 5 to 8 times.

I would expect a single re-render since it is basically switching from one item to the next.

Hope it helps

carocad avatar Jan 31 '18 22:01 carocad

@carocad How did you fix the re-rendering issue then ? Did you have to override the shouldComponentUpdate method ?

ojathelonius avatar Mar 07 '18 07:03 ojathelonius

@ojathelonius I couldnt find a solution for it. I just stopped using using after I found what the problem was and switched to a more basic approach :/

carocad avatar Mar 07 '18 10:03 carocad

@carocad I'll give it a try, there may be a way to prevent rendering the component (let alone the thumbnail inside) while swiping.

Out of curiosity, did you try the other swipe cards libraries out there ? I need the same look and feel and would then seek another solution to retain the same behavior.

ojathelonius avatar Mar 07 '18 11:03 ojathelonius

@ojathelonius no I didnt try the other libraries. I simply created a View which I re-render whenever the user request the next item.

carocad avatar Mar 07 '18 12:03 carocad

@carocad Alright, thanks !

ojathelonius avatar Mar 07 '18 14:03 ojathelonius

I got the issue that local images were loading properly, but external images were flickering. Using FastImage from https://github.com/DylanVann/react-native-fast-image fixed the issue for me

e11i0t avatar Mar 20 '18 00:03 e11i0t

Checked this. Not present in the latest version (2.4.4).

Code

import React, { Component } from 'react';
import { Image } from 'react-native';
import { Container, Header, View, DeckSwiper, Card, CardItem, Thumbnail, Text, Left, Body, Icon } from 'native-base';
const cards = [
  {
    text: 'Google',
    name: 'Alphabet',
    uri: "https://www.google.co.in/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png",
    description: "Google LLC is an American multinational technology company that specializes in Internet-related services and products, which include online advertising technologies, search engine, cloud computing, software, and hardware."
  },
  {
    text: 'React',
    name: 'Facebook',
    uri: "https://cdn-images-1.medium.com/max/512/1*qUlxDdY3T-rDtJ4LhLGkEg.png",
    description: "React is a JavaScript library for building user interfaces. It is maintained by Facebook, Instagram and a community of individual developers and corporations."
  },
  {
    text: 'NativeBase',
    name: 'GeekyAnts',
    uri: "https://nativebase.io/assets/img/front-page-icon.png",
    description: "NativeBase is an open source framework to build React Native apps over a single JavaScript codebase for Android and iOS."
  },

];
export default class App extends Component {
  render() {
    return (
      <Container>
        <Header />
        <View>
          <DeckSwiper
            dataSource={cards}
            renderItem={item =>
              <Card style={{ elevation: 3 }}>
                <CardItem>
                  <Left>
                    <Thumbnail source={{ uri: item.uri }} resizeMode="contain" fadeDuration={0} />
                    <Body>
                      <Text>{item.text}</Text>
                      <Text note>{item.name}</Text>
                    </Body>
                  </Left>
                </CardItem>
                <CardItem cardBody>
                  <Image style={{ height: 300, flex: 1 }} source={{ uri: item.uri }} resizeMode="contain" fadeDuration={0}
                  />
                </CardItem>
                <CardItem>
                  <Icon name="heart" style={{ color: '#ED4A6A' }} />
                  <Text>{item.name}</Text>
                </CardItem>
                <CardItem>
                  <Text>{item.description}</Text>
                </CardItem>
              </Card>
            }
          />
        </View>
      </Container>
    );
  }
}

Gif

deckswiper

Closing this due to no activity. Let us know if you are still facing any issue.

akhil-ga avatar May 15 '18 11:05 akhil-ga

i am having a serious performance issue while using the deckswiper of nativebase. When the data increases the deckswiper seems to be responding very poor and is also flashing.

aravi365 avatar Mar 11 '19 12:03 aravi365

Same for me

felix-lambert avatar Nov 12 '19 18:11 felix-lambert