bamlab / generator-rn-toolbox

The React Native Generator to bootstrap your apps
MIT License
1.2k stars 119 forks source link

Remove splashscreen #144

Open rizwanahmed19 opened 7 years ago

rizwanahmed19 commented 7 years ago

Is there a way to remove the splashscreen from the project?

JenSebastian commented 7 years ago

@rizwanahmed19 have you figured out a way to revert it back?

Almouro commented 7 years ago

Hi @rizwanahmed19 and @JenSebastian,

Why do you guys need to remove the splashscreen? :)

Here's how to do it manually though:

For iOS

Revert what was done here with those 2 steps:

  1. Revert the line ASSETCATALOG_COMPILER_LAUNCHIMAGE_NAME = LaunchImage; in ios/[YOUR_PROJECT_NAME].xcodeproj/project.pbxproj
  2. Remove the assets: rm -rf ios/[YOUR_PROJECT_NAME]/Images.xcassets/LaunchImage.launchimage

For Android

Revert what was done here with those 2 steps:

  1. rm android/app/src/main/res/drawable/launch_screen_bitmap.xml
  2. Remove all the splash assets located in android/app/src/main/res/drawable-*/launch_screen.png
rizwanahmed19 commented 7 years ago

I'm seeing a glitch in my app, whenever the keyboard opens up I can see the splashscreen in the back. I wanted to remove splashscreen and use react-native-splash-screen to see if the glitch persists. Here's how it looks like: glitch

rizwanahmed19 commented 7 years ago

@Almouro Few things that are not clear to me related to removal of splashscreen are what do you mean by "Remove what happens here"? There are functions when I visit the link but where can I find those functions in my code? And do you mean Remove the line when you say Revert the line?

Almouro commented 7 years ago

@rizwanahmed19 sorry I was not particularly clear. I just wanted to point to the line in the generator code where all the stuff was added. You only need to run the steps 1 and 2 for each platform

Kida007 commented 7 years ago

@Almouro , I am new to react native . I tried the Splash screen , but always stays at background . How to fix that .

rizwanahmed19 commented 7 years ago

@Almouro I've performed the steps stated above but I get the error while building android by running react-native run-android. Here it is:

                                                                 :app:processDebugManifest
:app:processDebugResources
D:\Rizwan\RN\BalanceApp\android\app\build\intermediates\res\merged\debug\values\values.xml:296:47-77: AAPT: No resource found that matches the given name (at 'android:windowBackground' with value '@drawable/launch_screen_bitmap').

Failed to generate resource table for split ''
D:\Rizwan\RN\BalanceApp\android\app\build\intermediates\res\merged\debug\values\values.xml:296: error: Error: No resource found that matches the given name (at 'android:windowBackground' with value '@drawable/launch_screen_bitmap').

:app:processDebugResources FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':app:processDebugResources'.
> com.android.ide.common.process.ProcessException: Failed to execute aapt

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

I can't seem to find a workaround, I've tried deleting <item name="android:windowBackground">@drawable/launch_screen_bitmap</item> in values.xml but it doesn't work.

Almouro commented 6 years ago

@rizwanahmed19 yes, you do need to delete that line. Maybe try to clean cd android && ./gradlew clean et build again.

But to be honest, @rizwanahmed19 @Kida007, if you guys agree, I'd rather we fix the issue for you guys instead of trying to revert the splashscreen :)

The splashscreen on Android is basically the app native background, so that's probably why you see it when opening the keyboard. The best way to prevent that is to create a separate Android activity called SplashActivity with the splash as the background. It would be responsible for launching the MainActivity. Basically, doing what is explained in this article.

Can you guys try that and check if this solves your issue, if you're comfortable enough with Android?

zibs commented 6 years ago

@Almouro I just ran into the keyboard issue independently as well - it would be great if the readme could make this more clear that there is more too it than just adding the screenshots. Maybe it could include a link to what you linked or this article which helped me in the context of react native set up a separate activity: https://medium.com/handlebar-labs/how-to-add-a-splash-screen-to-a-react-native-app-ios-and-android-30a3cec835ae

yleflour commented 5 years ago

Hello, we just revamped the generator 😁

For up to date icon and splashscreen generation please use @bam.tech/react-native-make

Your issue comes from the splash screen actually being the entire's app background. The new version is based on react-native-splash-screen and current best practices so it should solve your issue 😉