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.

Transition flashes the end position of elements first

See original GitHub issue

Transition flashes the end position of elements first, then starts animation, causing a jarring flicker.

This is intermittent as well, most the first time, but every now and then when repeatedly trying, it works.

`class DemoClass extends PureComponent<PaymentTypeSelectionProps> {

transitionMoveUpAndFadeIn = (transitionInfo) => { const { progress, start, end } = transitionInfo; const moveUpInterpolation = progress.interpolate({ inputRange: [0, start, end, 1], outputRange: [100, 100, 0, 0], }); const opacityInterpolation = progress.interpolate({ inputRange: [0, start, 0.9, end, 1], outputRange: [0, 0, 0.5, 0.8, 1], }); return { transform: [{ translateY: moveUpInterpolation }], opacity: opacityInterpolation, }; };

transitionNoFade = (transitionInfo) => { const { progress, start, end } = transitionInfo; const opacityInterpolation = progress.interpolate({ inputRange: [0, start, end, 1], outputRange: [0, 0, 0, 0], }); return { opacity: opacityInterpolation, }; };

transitionFadeOut = (transitionInfo) => { const { progress, start, end } = transitionInfo; const opacityInterpolation = progress.interpolate({ inputRange: [0, start, end, 1], outputRange: [1, 1, 0, 0], }); return { opacity: opacityInterpolation, }; };

handleNavigation = (spread: any) => { this.props.initPaymentMethods(spread); };

render() { return ( <PfView.View.Flex backgroundColor={Colors.veryLightGrey}> <SafeAreaView> <StatusBar backgroundColor="transparent" barStyle="dark-content" /> <ScrollView> <PfView.Column.FlexStart margin={[0, 10]}> <Transition appear={transitionInfo => this.transitionMoveUpAndFadeIn(transitionInfo)} disappear={transitionInfo => this.transitionFadeOut(transitionInfo)} > <PfText.Regular fontSize={20} color={Colors.greyMid} margin={[24, 18, 5, 18]}> Filler text here </PfText.Regular> </Transition> <PfView.View.Stretch> {this.props.combinedPaymentSpread.map(spread => ( <InfoCard showShadow tranistionDirection=“top” key={spread.reference} handleNavigation={() => this.handleNavigation(spread)} sharedElementRef={spread.reference} title={spread.title} subTitle={spread.subTitle} amount={spread.amount} symbol={spread.symbol} /> ))} </PfView.View.Stretch> </PfView.Column.FlexStart> </ScrollView> </SafeAreaView> </PfView.View.Flex> ); } }`

errorgif

Issue Analytics

  • State:open
  • Created 5 years ago
  • Comments:8 (2 by maintainers)

github_iconTop GitHub Comments

1reaction
iwikalcommented, Feb 20, 2019

I have a similar problem: I have this setup:

import React, { Component } from 'react'
import {
  StyleSheet,
  Animated
} from 'react-native'

const styles = StyleSheet.create({
  image: {
    height: 100,
    width: 100,
    borderRadius: 50,
    backgroundColor: '#eeeeee'
  }
})

const GROW_FACTOR = 1.5
const SMALL = 1.0 / GROW_FACTOR
const LARGE = 1.0

export default class extends Component {
  render () {
    const { progress, large, source } = this.props
    let scale = large ? LARGE : SMALL
    if (progress) {
      scale = progress.interpolate({
        inputRange: [0, 1],
        outputRange: [SMALL, LARGE]
      })
    }
    return (
      <Animated.Image
        source={{ uri: source }}
        style={[
          styles.image,
          {
            transform: [{ scale }]
          }
        ]}
      />
    )
  }
}

But sometimes when I transition from <MyImage /> to <MyImage large />, during a frame or two, the final, large size can be seen before starting to animate from small to large. I haven’t observed it when going back, from progress 1 to progress 0.

0reactions
R1D3commented, Sep 24, 2020

same issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

An Interactive Guide to CSS Transitions - Josh W Comeau
This comprehensive guide shows how to use CSS transitions! A back-to-basics look at the fundamental building blocks we need to create ...
Read more >
Prevent flicker on webkit-transition of webkit-transform
The solution is mentioned here: iPhone WebKit CSS animations cause flicker. For your element, you need to set -webkit-backface-visibility: hidden;.
Read more >
Transitions causing "flashing" in text elements further down ...
Hi again, For z-index, select the element in question (like the container of all the elements who are blinking), click on position:relative and...
Read more >
Using Multi-Step Animations and Transitions - CSS-Tricks
CSS animations are rad and the concept is fairly simple. Name the animation, define the movement in @keyframes and then call that animation ......
Read more >
Smoothly Reverting CSS Animations - Pragmatic Pineapple
Hey there, you probably tried to animate some HTML elements in your time using transitions, transforms, and animations in the CSS.
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