Skip to content

[Question] Why ReactInstanceManager needs to be initialized on main thread? #786

@Kshitij09-sc

Description

@Kshitij09-sc

Introduction

I noticed ReactInstanceManager methods have @ThreadConfined(UI) and has assertions around same. Wanted to understand why do we need to initialize this on main thread?

Details

https://github.com/facebook/react-native/blob/d94c4c46f27139d68d5303d0dafe106c4c685ea6/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/ReactInstanceManager.java#L1117

Discussion points

  • Can we move this to background thread and think of other ways of thread confinement and safety?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions