Skip to content

New Arch: autoPlay=false odd behavior #1307

@ian-wd

Description

@ian-wd

Description

As we started migrating our app to RN's New Arch we stumbled into this weird issue where <LottieView /> that has prop autoPlay={false} and loop={false} starts the animation even if there was no imperative api methods was called.

Fresh
https://github.com/user-attachments/assets/de78a926-95ee-4c33-9050-7ee52a68adab

Seems it only happens when there is another <LottieView /> that has opposite props of the affected animation autoPlay={true} loop={true}

Steps to reproduce

import React, {useState} from 'react';
import {Button, StyleSheet, View, Text} from 'react-native';
import LottieView from 'lottie-react-native';

export default function App() {
  const [showTest, setShowTest] = useState(false);

  return (
    <View style={styles.animationContainer}>
      {showTest && (
        <>
          <LottieView
            autoPlay={false}
            loop={false}
            style={{
              width: 200,
              height: 200,
              backgroundColor: '#eee',
            }}
            // Find more Lottie files at https://lottiefiles.com/featured
            source={require('./assets/capture.json')}
          />

          <LottieView
            autoPlay={true}
            loop={true}
            style={{
              width: 200,
              height: 200,
              backgroundColor: '#eee',
            }}
            source={require('./assets/phone-portrait.json')}
          />
        </>
      )}

      <Text>
        New Architecture: {global.RN$Bridgeless ? 'Enabled' : 'Disabled'}
      </Text>

      <View style={styles.buttonContainer}>
        <Button
          title="Test"
          onPress={() => {
            setShowTest(!showTest);
          }}
        />
      </View>
    </View>
  );
}

const styles = StyleSheet.create({
  animationContainer: {
    backgroundColor: '#fff',
    alignItems: 'center',
    justifyContent: 'center',
    flex: 1,
  },
  buttonContainer: {
    paddingTop: 20,
  },
});

Snack or a link to a repository

https://github.com/ian-wd/lottie-rep1

Lottie React Native version

7.1.0

React Native version

0.76.3

Platforms

iOS

Workflow

React Native

Architecture

Fabric (New Architecture)

Build type

Debug app & dev bundle

Device

iOS simulator

Acknowledgements

Yes

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions