Skip to content

Conversation

coado
Copy link
Contributor

@coado coado commented Sep 2, 2025

Summary:

Following the RFC, this PR adds new DevMenuConfiguration object and extends ReactHost API for passing settings to the particular DevSupportManager. The DevMenuConfiguration includes:

  • isDevMenuEnabled,
  • isShakeGestureEnabled,
  • areKeyboardShortcutsEnabled,

Changelog:

[ANDROID][ADDED] - Add new configuration for RCTDevMenu

Test Plan:

Tested with different configuration on DevMenuConfiguration:

Click to view code
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    fullyDrawnReporter.addReporter()
    maybeUpdateBackgroundColor()

    reactDelegate?.reactHost?.let { reactHost ->
      val devMenuConfiguration = DevMenuConfiguration(
        isDevMenuEnabled = true,
        isShakeGestureEnabled = false,
        areKeyboardShortcutsEnabled = false,
      )
      reactHost.setDevMenuConfiguration(devMenuConfiguration)
    }

    // register insets listener to update margins on the ReactRootView to avoid overlap w/ system
    // bars
    reactDelegate?.reactRootView?.let { rootView ->
      val insetsType: Int =
          WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout()

      val windowInsetsListener = { view: View, windowInsets: WindowInsetsCompat ->
        val insets = windowInsets.getInsets(insetsType)

        (view.layoutParams as FrameLayout.LayoutParams).apply {
          setMargins(insets.left, insets.top, insets.right, insets.bottom)
        }

        WindowInsetsCompat.CONSUMED
      }
      ViewCompat.setOnApplyWindowInsetsListener(rootView, windowInsetsListener)
    }
  }

@meta-cla meta-cla bot added the CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. label Sep 2, 2025
@facebook-github-bot facebook-github-bot added p: Software Mansion Partner: Software Mansion Partner p: Facebook Partner: Facebook labels Sep 2, 2025
@facebook-github-bot
Copy link
Contributor

@coado has imported this pull request. If you are a Meta employee, you can view this in D81684310.

@facebook-github-bot
Copy link
Contributor

@coado has imported this pull request. If you are a Meta employee, you can view this in D81684310.

@coado coado marked this pull request as ready for review September 4, 2025 15:09
Copy link
Contributor

@cortinico cortinico left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review automatically exported from Phabricator review in Meta.

coado added a commit to coado/react-native that referenced this pull request Sep 11, 2025
Summary:
Following the [RFC](react-native-community/discussions-and-proposals#925), this PR adds new `DevMenuConfiguration` object and extends `ReactHost` API for passing settings to the particular `DevSupportManager`.  The `DevMenuConfiguration` includes:

- isDevMenuEnabled,
- isShakeGestureEnabled,
- areKeyboardShortcutsEnabled,

## Changelog:

[ANDROID][ADDED] - Add new configuration for `RCTDevMenu`


Test Plan:
Tested with different configuration on `DevMenuConfiguration`:

<details>
<summary>Click to view code</summary>

```kt
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    fullyDrawnReporter.addReporter()
    maybeUpdateBackgroundColor()

    reactDelegate?.reactHost?.let { reactHost ->
      val devMenuConfiguration = DevMenuConfiguration(
        isDevMenuEnabled = true,
        isShakeGestureEnabled = false,
        areKeyboardShortcutsEnabled = false,
      )
      reactHost.setDevMenuConfiguration(devMenuConfiguration)
    }

    // register insets listener to update margins on the ReactRootView to avoid overlap w/ system
    // bars
    reactDelegate?.reactRootView?.let { rootView ->
      val insetsType: Int =
          WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout()

      val windowInsetsListener = { view: View, windowInsets: WindowInsetsCompat ->
        val insets = windowInsets.getInsets(insetsType)

        (view.layoutParams as FrameLayout.LayoutParams).apply {
          setMargins(insets.left, insets.top, insets.right, insets.bottom)
        }

        WindowInsetsCompat.CONSUMED
      }
      ViewCompat.setOnApplyWindowInsetsListener(rootView, windowInsetsListener)
    }
  }
```

</details>

Reviewed By: vzaidman

Differential Revision: D81684310

Pulled By: coado
@facebook-github-bot
Copy link
Contributor

This pull request was exported from Phabricator. Differential Revision: D81684310

@facebook-github-bot
Copy link
Contributor

@coado has imported this pull request. If you are a Meta employee, you can view this in D81684310.

coado added a commit to coado/react-native that referenced this pull request Sep 15, 2025
Summary:
Following the [RFC](react-native-community/discussions-and-proposals#925), this PR adds new `DevMenuConfiguration` object and extends `ReactHost` API for passing settings to the particular `DevSupportManager`.  The `DevMenuConfiguration` includes:

- isDevMenuEnabled,
- isShakeGestureEnabled,
- areKeyboardShortcutsEnabled,

## Changelog:

[ANDROID][ADDED] - Add new configuration for `RCTDevMenu`


Test Plan:
Tested with different configuration on `DevMenuConfiguration`:

<details>
<summary>Click to view code</summary>

```kt
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    fullyDrawnReporter.addReporter()
    maybeUpdateBackgroundColor()

    reactDelegate?.reactHost?.let { reactHost ->
      val devMenuConfiguration = DevMenuConfiguration(
        isDevMenuEnabled = true,
        isShakeGestureEnabled = false,
        areKeyboardShortcutsEnabled = false,
      )
      reactHost.setDevMenuConfiguration(devMenuConfiguration)
    }

    // register insets listener to update margins on the ReactRootView to avoid overlap w/ system
    // bars
    reactDelegate?.reactRootView?.let { rootView ->
      val insetsType: Int =
          WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout()

      val windowInsetsListener = { view: View, windowInsets: WindowInsetsCompat ->
        val insets = windowInsets.getInsets(insetsType)

        (view.layoutParams as FrameLayout.LayoutParams).apply {
          setMargins(insets.left, insets.top, insets.right, insets.bottom)
        }

        WindowInsetsCompat.CONSUMED
      }
      ViewCompat.setOnApplyWindowInsetsListener(rootView, windowInsetsListener)
    }
  }
```

</details>

Reviewed By: vzaidman

Differential Revision: D81684310

Pulled By: coado
@facebook-github-bot
Copy link
Contributor

@coado has exported this pull request. If you are a Meta employee, you can view the originating diff in D81684310.

coado added a commit to coado/react-native that referenced this pull request Sep 15, 2025
Summary:
Following the [RFC](react-native-community/discussions-and-proposals#925), this PR adds new `DevMenuConfiguration` object and extends `ReactHost` API for passing settings to the particular `DevSupportManager`.  The `DevMenuConfiguration` includes:

- isDevMenuEnabled,
- isShakeGestureEnabled,
- areKeyboardShortcutsEnabled,

## Changelog:

[ANDROID][ADDED] - Add new configuration for `RCTDevMenu`


Test Plan:
Tested with different configuration on `DevMenuConfiguration`:

<details>
<summary>Click to view code</summary>

```kt
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    fullyDrawnReporter.addReporter()
    maybeUpdateBackgroundColor()

    reactDelegate?.reactHost?.let { reactHost ->
      val devMenuConfiguration = DevMenuConfiguration(
        isDevMenuEnabled = true,
        isShakeGestureEnabled = false,
        areKeyboardShortcutsEnabled = false,
      )
      reactHost.setDevMenuConfiguration(devMenuConfiguration)
    }

    // register insets listener to update margins on the ReactRootView to avoid overlap w/ system
    // bars
    reactDelegate?.reactRootView?.let { rootView ->
      val insetsType: Int =
          WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout()

      val windowInsetsListener = { view: View, windowInsets: WindowInsetsCompat ->
        val insets = windowInsets.getInsets(insetsType)

        (view.layoutParams as FrameLayout.LayoutParams).apply {
          setMargins(insets.left, insets.top, insets.right, insets.bottom)
        }

        WindowInsetsCompat.CONSUMED
      }
      ViewCompat.setOnApplyWindowInsetsListener(rootView, windowInsetsListener)
    }
  }
```

</details>

Reviewed By: vzaidman

Differential Revision: D81684310

Pulled By: coado
@facebook-github-bot
Copy link
Contributor

@coado has exported this pull request. If you are a Meta employee, you can view the originating diff in D81684310.

Summary:
Following the [RFC](react-native-community/discussions-and-proposals#925), this PR adds new `DevMenuConfiguration` object and extends `ReactHost` API for passing settings to the particular `DevSupportManager`.  The `DevMenuConfiguration` includes:

- isDevMenuEnabled,
- isShakeGestureEnabled,
- areKeyboardShortcutsEnabled,

## Changelog:

[ANDROID][ADDED] - Add new configuration for `RCTDevMenu`


Test Plan:
Tested with different configuration on `DevMenuConfiguration`:

<details>
<summary>Click to view code</summary>

```kt
override fun onCreate(savedInstanceState: Bundle?) {
    super.onCreate(savedInstanceState)

    fullyDrawnReporter.addReporter()
    maybeUpdateBackgroundColor()

    reactDelegate?.reactHost?.let { reactHost ->
      val devMenuConfiguration = DevMenuConfiguration(
        isDevMenuEnabled = true,
        isShakeGestureEnabled = false,
        areKeyboardShortcutsEnabled = false,
      )
      reactHost.setDevMenuConfiguration(devMenuConfiguration)
    }

    // register insets listener to update margins on the ReactRootView to avoid overlap w/ system
    // bars
    reactDelegate?.reactRootView?.let { rootView ->
      val insetsType: Int =
          WindowInsetsCompat.Type.systemBars() or WindowInsetsCompat.Type.displayCutout()

      val windowInsetsListener = { view: View, windowInsets: WindowInsetsCompat ->
        val insets = windowInsets.getInsets(insetsType)

        (view.layoutParams as FrameLayout.LayoutParams).apply {
          setMargins(insets.left, insets.top, insets.right, insets.bottom)
        }

        WindowInsetsCompat.CONSUMED
      }
      ViewCompat.setOnApplyWindowInsetsListener(rootView, windowInsetsListener)
    }
  }
```

</details>

Differential Revision: D81684310

Pulled By: coado
@facebook-github-bot
Copy link
Contributor

@coado has exported this pull request. If you are a Meta employee, you can view the originating diff in D81684310.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
CLA Signed This label is managed by the Facebook bot. Authors need to sign the CLA before a PR can be reviewed. fb-exported meta-exported p: Facebook Partner: Facebook p: Software Mansion Partner: Software Mansion Partner
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants