-
Notifications
You must be signed in to change notification settings - Fork 36
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(native): 🔨 temp work around for the [double splash screen issue](z…
…oontek/react-native-bootsplash#496). This is until [expo-splash-screen addresses the issue in sdk 52](expo/expo#29440)
- Loading branch information
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -53,7 +53,8 @@ | |
} | ||
} | ||
} | ||
] | ||
], | ||
["./translucent-default-splash-screen-config"] | ||
], | ||
"extra": { | ||
"eas": { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/** | ||
* @module withSplashWindowIsTranslucent | ||
* @description Custom expo plugin that makes the {@link https://developer.android.com/develop/ui/views/launch/splash-screen/migrate|default splash screen (android 12+)} transparent. | ||
* This is a temporary work around for the {@link https://github.com/zoontek/react-native-bootsplash/issues/496|double splash screen issue}. | ||
* | ||
* | ||
* Credits: {@link https://github.com/expo/expo/issues/16084#issuecomment-1261330440} | ||
*/ | ||
|
||
const { AndroidConfig, withAndroidStyles } = require('@expo/config-plugins'); | ||
|
||
const withSplashWindowIsTranslucent = (config) => { | ||
return withAndroidStyles(config, async (config) => { | ||
config.modResults = await configureFullScreenDialog(config.modResults); | ||
return config; | ||
}); | ||
}; | ||
|
||
async function configureFullScreenDialog(styles) { | ||
const splashScreen = styles.resources.style.find( | ||
(style) => style.$.name === 'Theme.App.SplashScreen', | ||
); | ||
|
||
if (splashScreen) { | ||
splashScreen.item = splashScreen.item.filter( | ||
(item) => item.$.name !== 'android:windowIsTranslucent', | ||
); | ||
splashScreen.item.push( | ||
AndroidConfig.Resources.buildResourceItem({ | ||
name: 'android:windowIsTranslucent', | ||
value: true, | ||
}), | ||
); | ||
} | ||
|
||
return styles; | ||
} | ||
|
||
module.exports = withSplashWindowIsTranslucent; |