Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Lottiefile animation looks different in android.#892

Unanswered
armostheus asked this question inQ&A
Discussion options

I have a lottiefile attached in this post, which I'm trying to render in my RN app.

Issue
Animation of the lottiefile looks different in android device than it should. Moreover, the animation works perfectly in iOS emulator.

Type of app
React Native CLI.

Screenshots
Screenshot 2022-06-10 at 11 07 29 PM
Screenshot 2022-06-10 at 11 07 57 PM

Lottiefile URL
https://lottiefiles.com/109043-spinning-wheel

React Native code

import React, { useRef, useState } from 'react';import type {Node} from 'react';import {  SafeAreaView,  useColorScheme,  Button,  Animated,} from 'react-native';import LottieView from 'lottie-react-native';import {  Colors,} from 'react-native/Libraries/NewAppScreen';import { GestureHandlerRootView } from 'react-native-gesture-handler';const App: () => Node = () => {  const isDarkMode = useColorScheme() === 'dark';  const inputEl = useRef(new Animated.Value(0)).current;  const [progress, setProgress] = useState(0)  const backgroundStyle = {    backgroundColor: isDarkMode ? Colors.darker : Colors.lighter,  };  const handlePress = () => {    Animated.timing(inputEl, {      toValue: progress,      duration: 1000,      useNativeDriver: true    }).start()    setProgress(progress === 0 ? Math.random() : 0)  }  return (    <GestureHandlerRootView style={{ flex: 1 }}>      <SafeAreaView style={backgroundStyle}>        <LottieView           source={require('./wheel1.json')}          progress={inputEl}          style={{ width: '100%' }}          resizeMode='cover'        />        <Button onPress={() => handlePress()} title={'Start'}> start </Button>      </SafeAreaView>    </GestureHandlerRootView>  );};export default App;

Package.json

{  "name": "awesomeproject",  "version": "0.0.1",  "private": true,  "scripts": {    "android": "react-native run-android",    "ios": "react-native run-ios",    "start": "react-native start",    "test": "jest",    "lint": "eslint ."  },  "dependencies": {    "lottie-ios": "^3.2.3",    "lottie-react-native": "^4.1.3",    "react": "17.0.1",    "react-native": "0.64.1",    "react-native-config": "^1.4.5",    "react-native-gesture-handler": "^2.4.2",    "react-native-reanimated": "^2.8.0"  },  "devDependencies": {    "@babel/core": "^7.12.9",    "@babel/runtime": "^7.12.5",    "@react-native-community/eslint-config": "^2.0.0",    "babel-jest": "^26.6.3",    "eslint": "7.14.0",    "jest": "^26.6.3",    "metro-react-native-babel-preset": "^0.64.0",    "react-test-renderer": "17.0.1"  },  "jest": {    "preset": "react-native"  }}
You must be logged in to vote

Replies: 1 comment

Comment options

Hi@armostheus,

A lot has changed in Lottie since version 4 (including V6 where we removed a lot of default sizing behaviors) If you still have the project or are running into this issue with the latest version, can you open an issue on the repo so we can take a look? (I know it has been a very long time, so this is mostly a shot in the dark and don't feel pressured to do so)

You must be logged in to vote
0 replies
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Category
Q&A
Labels
None yet
2 participants
@armostheus@TheRogue76

[8]ページ先頭

©2009-2025 Movatter.jp