You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

React Native启动页转场安卓与iOS表现不一致,如何消除安卓额外动画?

Hey there! Let's fix those extra transition effects on Android for your react-native-splash-screen setup. I've dealt with this exact issue before, so here's what you need to do step by step:

1. Disable the fade-out animation when hiding the splash screen

The library's hide() method on Android actually accepts an optional parameter for animation duration. By setting this to 0, you'll skip the default fade-out effect entirely. Update your React Native code where you call hide():

// Replace this:
SplashScreen.hide();

// With this:
SplashScreen.hide(0);

2. Remove Android's default Activity transition animations

If your initial screen is still sliding up from the bottom, that's Android's default Activity switch animation. To turn this off, open your android/app/src/main/AndroidManifest.xml and add the android:windowAnimationStyle="@null" attribute to your MainActivity:

<activity
    android:name=".MainActivity"
    android:label="@string/app_name"
    android:configChanges="keyboard|keyboardHidden|orientation|screenLayout|screenSize|smallestScreenSize|uiMode"
    android:launchMode="singleTask"
    android:exported="true"
    android:windowAnimationStyle="@null"> <!-- Add this line -->
</activity>

3. Fix the "shrinking with black edges" issue

That slight shrink usually happens because your splash screen drawable isn't properly set to fill the screen. Open your splash screen drawable file (usually at android/app/src/main/res/drawable/splash_screen.xml) and make sure the bitmap is configured to fill the screen correctly:

<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
    <!-- Match your splash image's background color to avoid black edges -->
    <item android:drawable="@color/splash_background" />
    <item>
        <bitmap
            android:gravity="fill" <!-- Use fill or centerCrop depending on your image -->
            android:src="@drawable/your_splash_image" />
    </item>
</layer-list>

Also, double-check that your SplashTheme in android/app/src/main/res/values/styles.xml doesn't have any unintended animation properties. Add these lines to ensure no extra animations are applied:

<style name="SplashTheme" parent="Theme.AppCompat.Light.NoActionBar">
    <!-- Your existing windowBackground and other properties -->
    <item name="android:windowAnimationStyle">@null</item>
    <item name="android:windowEnterAnimation">@null</item>
    <item name="android:windowExitAnimation">@null</item>
</style>

After making these changes, rebuild your Android app (npx react-native run-android) and the transitions should match the iOS behavior—straight replacement with no extra effects.

内容的提问来源于stack exchange,提问作者Juan

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.22 09:56:00