Skip to content

Unexpected useTransition behavior on iOS #1

@joshuayoes

Description

@joshuayoes

This repository implements the React docs example of the useTransition hook in React Native on version 0.72.0-rc.1.

This demo tap the Posts (slow) button and then the Contacts button. According the docs, tapping the Contacts button should show the ContactTab view on the next render and skip committing the render of the PostsTab view.

On Web and Android, only 2 renders happen, skipping the slow PostsTab render tree. However, on iOS, 4 renders happen, synchronously blocking the next render until the slow PostsTab render tree is commited.

Demos

Web Android iOS
use-transition-web.mov
use-transition-android.mov
use-transition-ios.mov

Profiles

Android

Using npx react-devtools, you can see that Android only renders twice.

  1. Initial Render
  2. ContactTab render

The "Posts (slow)" view is not committed to the render tree because the "Contact" view finishes rendering first. See React DevTools profile export for more information.

profile-android-1

profile-android-2

iOS

On iOS, this example shows 4 renders.

  1. Initial Render
  2. PostsTab render
  3. onClick props change to TabButton
  4. ContactTab render

See React DevTools profile export for more information.

profile-ios-1

profile-ios-2

profile-ios-3

profile-ios-4

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions