From e8f8ee3c0f28b8c5751ffaef495adea0b8daf1eb Mon Sep 17 00:00:00 2001 From: Abdelhafidh Belalia <16493223+s77rt@users.noreply.github.com> Date: Tue, 29 Oct 2024 11:53:02 -0700 Subject: [PATCH] Resume frame callback on host resume (#47264) Summary: When the app goes into background the frame callback is ignored by setting the `mShouldStop` flag to `true` https://github.com/facebook/react-native/blob/3111473d571a8315d11753f8c6acddd2ba301f8f/packages/react-native/ReactAndroid/src/main/java/com/facebook/react/uimanager/events/FabricEventDispatcher.java#L174 However this flag is never reset even after the app is back on foreground. This made the `AndroidEventBeat` not ticking in as much as expected causing events not being dispatched in time. In our case the `onLayout` was not being dispatched unless we tap on screen invoking a manual tick. ## Changelog: [ANDROID] [FIXED] - Fix Frame Callback not being called after Host Resume Pull Request resolved: https://github.com/facebook/react-native/pull/47264 Test Plan: 1. Add log line `__android_log_print(ANDROID_LOG_DEBUG, "s77rt", "AndroidEventBeat::tick");` in `packages/react-native/ReactAndroid/src/main/jni/react/fabric/AndroidEventBeat.cpp` (tick method) 2. Open RN-Tester 3. Verify `AndroidEventBeat::tick` is logged for every frame 4. Put app into background 5. Verify no `AndroidEventBeat::tick` is logged 6. Open app again 7. Verify `AndroidEventBeat::tick` is logged for every frame | Before | After | |:------:|:-----:| |