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.

Transitioning inside FlatList behaves differently on Android than on iOS

See original GitHub issue

Hey!

I noticed that transitioning inside a FlatList behaves different on Android than on iOS. On iOS the content in the list is pushed down, but on Android it is not.

Are there any solution for this problem or is there maybe a different way on achieving the same thing.

The code looks something like this:

const transition = (
  <Transition.Sequence>
    <Transition.Out type="fade" />
    <Transition.Change interpolation="easeInOut" />
    <Transition.In type="fade" />
  </Transition.Sequence>
);

class TransitionExample extends React.Component {
  transitionRef = React.createRef();

  render() {
    return (
      <Transitioning.View ref={this.transitionRef} transition={transition}>
        <FlatList
          style={styles.container}
          data={this.state.invoices}
          keyExtractor={item => item.id}
          renderItem={({ item }) => (
            <Accordion>
              {({ open, toggleAccordion }) => {
                return (
                  <Fragment>
                    <TouchableWithoutFeedback
                      onPress={() => {
                        this.transitionRef.current.animateNextTransition();
                        toggleAccordion();
                      }}
                    >
                      <View style={styles.invoiceItem}>
                        <View style={styles.arrowDown}>
                          <ChevronArrowDown
                            style={open && styles.arrowUp}
                            width={18}
                            height={18}
                            fill={colors.ALT_GREY}
                          />
                        </View>
                        <Text style={styles.date}>
                          Invoice Date: 03.04.2019
                        </Text>
                        <Text style={styles.billingPeriod}>
                          Billing period: 01.02 - 01.03.2018
                        </Text>
                        {open && <CostTable />}
                      </View>
                    </TouchableWithoutFeedback>
                  </Fragment>
                );
              }}
            </Accordion>
          )}
        />
      </Transitioning.View>
    );
  }
}

iOS

Transition iOS

Android

Transition Android

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Reactions:6
  • Comments:7 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
nandorojocommented, Jul 28, 2020

@jakub-gonet thanks for the heads up. It would be amazing to still have transitions in Reanimated 2. It’s a great API for difficult animations, such as dynamic height changes, accordions, and rearranging a list of items. It’s nice to be able to toss the transitioning view component in, and boom, UI changes look nice. The transition prop is a bit unintuitive to me, but it’s worth it for how powerful transitions are.

Thanks for the great work!

1reaction
jakub-gonetcommented, Jul 28, 2020

We discussed Transitions internally in our team. Considering that v2 makes creating animations easier and Transitions was an experimental API for a long time, we decided to leave Transitions as they are.

We won’t actively fix bugs in them, but we’ll happily merge any PR with fixes. We’re also thinking about rewriting Transitions in v2 sometime in the future.

I’m closing this issue, but if you have further questions, I will be happy to help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Transitioning inside FlatList behaves differently on Android ...
Hey! I noticed that transitioning inside a FlatList behaves different on Android than on iOS. On iOS the content in the list is...
Read more >
Spacing before and after a horizontal FlatList (React Native)
Seems like I was able to fix it by using a contentContainerStyle prop on the FlatList instead of passing it a style prop...
Read more >
4. Components for Mobile - Learning React Native, 2nd ...
This varies somewhat from platform to platform: iOS behaves differently from Android, which behaves differently yet again from Windows Phone.
Read more >
Tips for Optimizing React Native Application Performance: Part 1
In this article, we will discuss common pitfalls to avoid, and offer tips on optimizing your React Native application for performance before ...
Read more >
react-native-video - npm
Start using react-native-video in your project by running `npm i ... Usage; iOS App Transport Security; Audio Mixing; Android Expansion File ...
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