Solution 1 :
Have you tried Lottie yet. It is not Gif but very useful
Solution 2 :
As far as I am aware, react native only allows static images for the splash page. However a workaround that I found successful is to have a static splash screen transition into a screen containing the gif/animation which then transitions to your home screen after a timeout. You can set the splash to be identical to whatever the starting frame of your gif/animation is for continuity.
Here is a tutorial outlining how this can be achieved:
Problem :
I am making an application with react native with native code of android and ios, in the application specifications a splash screen with a GiF is required, I have already inserted the required dependencies of the documentation of react native
dependencies {
// If your app supports Android versions before Ice Cream Sandwich (API level 14)
implementation 'com.facebook.fresco:animated-base-support:1.3.0'
// For animated GIF support
implementation 'com.facebook.fresco:animated-gif:2.0.0'
// For WebP support, including animated WebP
implementation 'com.facebook.fresco:animated-webp:2.1.0'
implementation 'com.facebook.fresco:webpsupport:2.0.0'
// For WebP support, without animations
implementation 'com.facebook.fresco:webpsupport:2.0.0'
}
GIF support works correctly within the screen / components. However, when I try to place the GIF on the splash screen it doesn’t work, there is a static image of the GIF
import android.content.Intent;
import android.os.Bundle;
import androidx.appcompat.app.AppCompatActivity;
public class SplashActivity extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Intent intent = new Intent(SplashActivity.this, MainActivity.class);
startActivity(intent);
finish();
}
}
<?xml version="1.0" encoding="utf-8"?>
<layer-list xmlns_android="http://schemas.android.com/apk/res/android">
<item>
<bitmap
android_gravity="center"
android_src="@drawable/splash_screen2"/>
</item>
</layer-list>
How can I place a splash screen in gif format?
Comments
Comment posted by hg20
No, I didn’t try, I will try with Lottie. Thanks for the recommendation
Comment posted by hg20
Do you know if it is possible to convert Gif to Lottie file?