Skip to content
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

Flickering in splash screen on iOS #30729

Open
johnsiah opened this issue Jul 31, 2024 · 7 comments
Open

Flickering in splash screen on iOS #30729

johnsiah opened this issue Jul 31, 2024 · 7 comments
Labels
Development Builds needs review Issue is ready to be reviewed by a maintainer

Comments

@johnsiah
Copy link

Summary

There's a flickering in the splash screen on IOS when the expo-dev-client package is added, if the expo-dev-client package is being removed then the issue is gone.

Below is the reproduction of the issue on a new expo project using a development build.

Flickering.IOS.expo-dev-client.mp4

Managed or bare workflow?

managed

What platform(s) does this occur on?

iOS

Package versions

"expo": "~51.0.22"
"expo-dev-client": "^4.0.21"

Environment

expo-env-info 1.2.0 environment info:
    System:
      OS: macOS 14.6
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 20.16.0 - ~/.nvm/versions/node/v20.16.0/bin/node
      Yarn: 1.22.19 - /opt/homebrew/bin/yarn
      npm: 10.8.1 - ~/.nvm/versions/node/v20.16.0/bin/npm
      Watchman: 2024.06.24.00 - /opt/homebrew/bin/watchman
    Managers:
      CocoaPods: 1.15.2 - /opt/homebrew/bin/pod
    SDKs:
      iOS SDK:
        Platforms: DriverKit 23.5, iOS 17.5, macOS 14.5, tvOS 17.5, visionOS 1.2, watchOS 10.5
    IDEs:
      Android Studio: 2023.2 AI-232.10300.40.2321.11567975
      Xcode: 15.4/15F31d - /usr/bin/xcodebuild
    npmPackages:
      expo: ~51.0.22 => 51.0.22 
      react: 18.2.0 => 18.2.0 
      react-dom: 18.2.0 => 18.2.0 
      react-native: 0.74.3 => 0.74.3 
    npmGlobalPackages:
      eas-cli: 10.2.1
    Expo Workflow: bare

Reproducible demo

  1. Create a new Expo project
  2. Configure as development build
  3. Add expo-dev-client
  4. npm run ios

Stacktrace (if a crash is involved)

No response

@johnsiah johnsiah added Development Builds needs validation Issue needs to be validated labels Jul 31, 2024
@expo-bot expo-bot added needs review Issue is ready to be reviewed by a maintainer and removed needs validation Issue needs to be validated labels Jul 31, 2024
@brentvatne
Copy link
Member

hey there! what you are seeing is the following:

  • the splash screen is displayed when you launch the app
  • the splash screen is then hidden and the app is loaded, bundling begins

we aren't actually showing the splash screen for the app outside of the initial launch, the flickering (splash -> black background -> your app) is the app loading.

cc @alanjhughes to verify that we display splash appropriately in expo-dev-client in the sdk 52 changes

@johnsiah
Copy link
Author

johnsiah commented Aug 8, 2024

Yes, and this only happens after expo-dev-client is added. It seems like the splash screen somehow gets displayed wrongly when the bundle begins. Any update on this?

@brentvatne
Copy link
Member

@johnsiah - this shouldn't impact any production use case, so we aren't prioritizing it at the moment, but @alanjhughes will verify that it will be resolved by sdk 52

@johnsiah
Copy link
Author

@brentvatne got it. By the way, we also saw this reproducible in the production app when we built the production profile. Exactly the same as the demo video display above.

@brentvatne
Copy link
Member

@johnsiah - can you elaborate on what you mean by that? in #30729 (comment) i mentioned that the splash screen shows as expected on the initial app launch, it just doesn't show when you reload within expo-dev-client. if your splash screen is just hiding too early, you may need to delay hiding it manually and hide it when you know your app is ready. eg: https://docs.expo.dev/versions/latest/sdk/splash-screen/#usage

@johnsiah
Copy link
Author

@brentvatne Note that the bare expo project for testing this issue doesn't install the expo-splash-screen yet, just a basic expo new project setup adding expo-dev-client.

The reason for not adding expo-splash-screen is that we'll be using a library like react-native-bootsplash for the splash screen. I've tried using back expo-splash-screen and it seems like it fixed the issue, but if we were to choose an alternative library or manual splash screen handling or even not adding splash screen at all, it seems like there's some logic in expo-splash-screen sort of handling this expo-dev-client issue reported above.

More interesting is that when I build a release internal preview using the profile below, it should be building a release build but the same flickering is still there.

// eas.json
  "build": {
    "preview": {
      "distribution": "internal"
    }
  },

Pasting all my dependencies here for more clarity.

  "dependencies": {
    "expo": "51.0.28",
    "expo-build-properties": "~0.12.5",
    "expo-dev-client": "4.0.23",
    "expo-status-bar": "~1.12.1",
    "react": "18.2.0",
    "react-dom": "18.2.0",
    "react-native": "0.74.5"
  },
  "devDependencies": {
    "@babel/core": "^7.20.0"
  },

@matthieugicquel
Copy link

matthieugicquel commented Sep 9, 2024

The same black flicker/flash is reproducible in production scenarios.

Here's a minimal repro: https://github.com/matthieugicquel/bootsplash-black-flash

The minimal setup to have the issue seems to be (I usually don't notice a black flicker with just this):

  • react-native-bootsplash setup according to their docs (this includes disabling autolinking for expo-splash-screen
  • release build
  • expo-updates installed, enabled, with checkAutomatically: "ON_LOAD" (the default value)

To make the black screen visible every time, you can add:

  • fallbackToCacheTimeout: 10000 (this is included in the repro above)
  • and a slow network (I use the network link conditions option in proxyman)

Another way to make the flicker more noticeable seems to be to add other packages that do some work during app init (eg react-native-unistyles).

@brentvatne Is there anything I can do to help debug/fix this?

Additional info on tests I made:

  • This whole flickering happens before any of the app's JS code runs
  • Upgrading to RN 0.75 according to the official expo guide doesn't solve the issue
  • In a debug build, where I see the issue when I have expo-dev-client some other native deps, the screen seems to become black approximately at the time the log "Running application main ..." appears, and until after customizeRootView is called
Simulator.Screen.Recording.-.iPhone.15.-.2024-09-09.at.17.31.12.mp4

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development Builds needs review Issue is ready to be reviewed by a maintainer
Projects
None yet
Development

No branches or pull requests

4 participants