Comments (7)
It works for me when using the imperative API
import React from 'react';
import Animation from 'lottie-react-native';
export default class BasicExample extends React.Component {
componentDidMount() {
this.animation.play();
}
render() {
return (
<Animation
loop={true}
ref={animation => { this.animation = animation; }}
style={{
width: 200,
height: 200,
}}
source={require('../path/to/animation.json')}
/>
);
}
}
from lottie-react-native.
I didn't try the imperative API, just pointing that looping on the component API isn't working
from lottie-react-native.
At the moment loop
is only applicable to the imperative API. I'm not quite sure how it would work with the Animated API, since the animation progress is controlled by an animated value (which you would be able to loop yourself if you wanted, though it's not straight-forward).
I'm happy to take suggestions on how this could/should work
from lottie-react-native.
If there was a callback when the animation ends something like onAnimationComplete
we can reset the animation again.
from lottie-react-native.
if you're using the Animated
API, this callback already exists. You would animate from 0 -> 1, and then reset
from lottie-react-native.
Though, I do think that the Animated
API could use a loop
API. I know I had talked to vjeux about this at some point. Perhaps it's time to make a PR
from lottie-react-native.
Sounds good, thanks for your feedback!
from lottie-react-native.
Related Issues (20)
- [Android] dotlottie files not working HOT 11
- pod install fail on MacOS 12.7.3(monterey) Xcode 14.2 HOT 3
- Lottie json crashes on Andriod devices but IOS works fine HOT 5
- RN 0.73.4 application keeps stopping HOT 3
- Download lotties json fies not working on expo android. HOT 4
- reduce motion: lottie files no longer animated HOT 1
- dotLottie will not load on web HOT 4
- Lottie animation is breaked on my app HOT 25
- Play method does not respect startFrame and endFrame properties
- Possible to change colorFilters dynamically without reseting animation? HOT 1
- [Android | Expo 50 | RN 0.73.4] Memory is not freed on unmount HOT 3
- How to remove lottie-react-native for windows HOT 1
- Cannot run IOS after installing lottie-react-native. HOT 1
- Lottie json crashes on Andriod devices but IOS works fine HOT 6
- Animation flickering & Some animations not even visible on Android HOT 5
- [MACOS App Development][react Native Build Failure] Cannot find type 'Color' in scope HOT 2
- Flashing while animation is playing HOT 1
- Xcode will not build project with [email protected] due to lack of PrivacyInfo HOT 2
- My Lottie animation not working correctly HOT 8
- New version Lottie-ios(4.4.2) minimum deployment target HOT 8
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from lottie-react-native.