-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Modal not showing the LottieView #1141
Comments
I got the same issue, any updates? |
Hi. Thank you for opening an issue. Is the new architecture enabled? |
Hi, thank you for the answer. The new architecture is disabled. After some research I found the BREAKING CHANGES #992 that removed the default width. After apply my own width, height and/or aspectratio the behaviour was as expected. My problem is solved. |
@chatphonhasser How about you? I see that your code also only mentions height |
`import React, { useMemo } from 'react'; const UniversalLoadingComponent: React.FC = () => { const loadingAnimation = useMemo(() => ( export default UniversalLoadingComponent; |
This code sample is missing quite a bit that i can't figure out (What's in the |
As I said it is working. The point here is the style(unable to style the component within a View) and how the component is enclosed. Which is the issue I think. I cannot put it in a View tag.
loadingAnimation ==> I provided the code
|
It worked. Thanks. For your information, I could clone your project, there is the index error. Have a nice day |
Description
Using the Modal from react-native does not show the LottieView
Steps to Reproduce
Using Lottie as usual
Expected behavior: [What you expected to happen]
It should work everywhere
Actual behavior: [What actually happened]
Not showing
Minimal reproduction
`import React, { useRef } from "react";
import LottieView from "lottie-react-native";
const LoadingAnimation: React.FC = () =>{
// Define the type of the ref to match LottieView
const animationRef = useRef(null);
const play = () => {
console.log("animationRef", animationRef);
animationRef.current?.play();
}
return (
<LottieView
ref={animationRef}
onLayout={() => play() }
style={{
height: 50,
justifyContent: 'center',
alignItems: 'center',
}}
source={require("../assets/json/astronot.json")}
autoPlay
loop
/>
);
}
export default LoadingAnimation;`
`import React, { useMemo } from 'react';
import { View, StyleSheet, Modal } from 'react-native';
import { useLoading } from './LoadingContext';
import LoadingAnimation from './LoadingAnimation';
const UniversalLoadingComponent: React.FC = () => {
const { isLoading } = useLoading();
const loadingAnimation = useMemo(() => (
), []);
return (
<Modal visible={isLoading} animationType="none" transparent style={{
flex: 1, justifyContent: 'center',
alignItems: 'center',
}}>
{/* /}
{/ {loadingAnimation} */}
)
};
const styles = StyleSheet.create({
centeredView: {
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: "red"
},
});
export default UniversalLoadingComponent;
`
React Native Environment
"react": "^18.2.0",
"react-native": "^0.73.1",
Lottie Version
Version: "lottie-react-native": "^6.4.1",
The text was updated successfully, but these errors were encountered: