Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
package com.mendix.developerapp

import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener
import com.facebook.react.internal.featureflags.ReactNativeFeatureFlags
import com.facebook.react.internal.featureflags.ReactNativeNewArchitectureFeatureFlagsDefaults
import com.mendix.developerapp.loading.BundleDownloadListenerHolder
import com.mendix.developerapp.sampelapps.SampleAppsManager
import com.mendix.developerapp.splashscreen.SplashScreenPresenter
Expand All @@ -18,6 +20,31 @@ class MainApplication : BaseApplication() {
var splashImagePath = splashBackground(backgroundImage)
}

override fun onCreate() {
// MendixReactApplication.onCreate() runs SoLoader.init() and then
// DefaultNewArchitectureEntryPoint.load(), which itself calls
// ReactNativeFeatureFlags.override(...) exactly once. So by the time we
// return from super.onCreate() the native lib is loaded AND the flags have
// already been overridden once.
super.onCreate()

// Enable the React Native DevTools (Fusebox) CDP backend in release builds.
// In release, InspectorFlags reads ReactNativeFeatureFlags.fuseboxEnabledRelease()
// (defaults to false), which bakes a "legacy" vs "fusebox" inspector target id into
// the device registration. Without this, the dev menu's "Open DevTools" registers as
// a legacy target and Metro's /open-debugger can't find a fusebox target to open
// (silent no-op). We use dangerouslyForceOverride (not override) because the flags
// were already overridden by load(); a second override() would throw. This must run
// before the inspector first reads the flag (i.e. before connecting to the packager),
// which onCreate satisfies. We extend the New Architecture defaults so bridgeless /
// Fabric / TurboModules stay enabled.
ReactNativeFeatureFlags.dangerouslyForceOverride(
object : ReactNativeNewArchitectureFeatureFlagsDefaults() {
override fun fuseboxEnabledRelease(): Boolean = true
}
)
}

val bundleDownloadListenerHolder = BundleDownloadListenerHolder()

override val devBundleDownloadListener: DevBundleDownloadListener
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ open class MendixProjectFragmentBase : MendixBaseFragment() {

viewModel.status.observe(viewLifecycleOwner) {
if (it === ProjectLoaderViewModel.STATUS_SUCCESS) {
// Surface RN's "Open DevTools" item in the dev menu. isDeviceDebugEnabled
// defaults to ReactBuildConfig.DEBUG (false in release) and is in-memory only,
// so it must be set each launch once the React instance (and thus the
// DevSupportManager) exists. Safely no-ops when dev support is off (devSettings null).
currentDevSupportManager?.devSettings?.isDeviceDebugEnabled = true
RNBootSplash.init(requireActivity(), R.style.BootTheme)
}else{
RNBootSplash.hide(requireActivity());
Expand Down