Skip to content

Android - Floating button flickers between navigation events and screen rerenders #1408

@jonathan-edgar

Description

@jonathan-edgar

Description

On Android, the Instabug floating button flickers (disappears and reappears) during navigation events and screen rerenders. This behavior doesn't occur on iOS.

Expected Behavior

The floating button should remain consistently visible during navigation transitions and screen updates.

Actual Behavior

The button briefly disappears and reappears during:

  • Navigation between screens
  • Screen rerenders
  • State changes that affect the UI

Reproduction Steps

  1. Initialize Instabug with floating button invocation
  2. Navigate between screens in a React Native app
  3. Observe the floating button flickering

Environment

  • React Native version: 0.79.0
  • Instabug React Native version: 14.3.0
  • Android OS version: and Android 15 OS Level 35 & Android13 (v13)(Level 33)
  • Device models: Pixel 8 Pro & Samsung Galaxy A42 5G (SM-A426U)

Additional Information

  • I've confirmed the initialization code only runs once (implementation attached)
  • The issue persists regardless of the floating button position
  • This flickering persists with and without Instabug.onStateChange(state)
  • Attached is a video demonstrating the behavior

Video

screen-20250701-150622.mp4

Code Implementation

export const initializeInstabug = async (
  showInstabug: boolean,
  getUserProfileSuccess?: any,
) => {
  try {
    const launchdarklyFlags = await getFeatureVariations();

    if (launchdarklyFlags?.instabug) {
      Instabug.init({
        token: INSTABUG_TOKEN,
        invocationEvents: [InvocationEvent.floatingButton],
      });
      Instabug.setReproStepsConfig({
        all: ReproStepsMode.enabled,
      });
      Instabug.setWelcomeMessageMode(WelcomeMessageMode.disabled);
      if (getUserProfileSuccess?.email) {
        Instabug.identifyUser(
          getUserProfileSuccess?.email,
          getUserProfileSuccess?.username,
        );
      }
      BugReporting.setFloatingButtonEdge(FloatingButtonPosition.right, 625);
      NetworkLogger.setEnabled(launchdarklyFlags?.instabug);
    }
  } catch (err) {
    console.log('error fetching instabug or launch darkly status', err);
  }
};

Workaround

Removing Instabug.onStateChange(state); from @react-navigation/native NavigationContainer onStateChange stops the flicker

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions