Skip to content
Merged
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
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Fixed

- We fixed an intermittent issue where Make it Native could fail to load the app with an "Unable to load script" error, because the Metro bundler was checked at the emulator default address (`10.0.2.2:8081`) instead of the address of the Mendix app.

## [v0.5.3] - 2026-09-15

- We migrated iOS to the UIKit scene-based life cycle.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,15 @@ class MendixInitializer(
MxConfiguration.runtimeUrl = runtimeUrl
MxConfiguration.warningsFilter = mendixApp.warningsFilter

// The packager host must be stored BEFORE any reload: the Metro check made when the instance
// is recreated uses the stored host (see MendixBridgelessDevSupportManager.isPackagerRunning).
if (hasRNDeveloperSupport) setupDeveloperApp(runtimeUrl, mendixApp)

// Reload only if there's already a running instance.
if (reactHost.currentReactContext != null) {
reactHost.reload("Clean start for new Mendix app")
}
if (clearData) clearData(context.application)
if (hasRNDeveloperSupport) setupDeveloperApp(runtimeUrl, mendixApp)
}

fun onDestroy() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import com.facebook.react.devsupport.DevSupportManagerBase
import com.facebook.react.devsupport.ReactInstanceDevHelper
import com.facebook.react.devsupport.interfaces.DevBundleDownloadListener
import com.facebook.react.devsupport.interfaces.DevLoadingViewManager
import com.facebook.react.devsupport.interfaces.PackagerStatusCallback
import com.facebook.react.devsupport.interfaces.PausedInDebuggerOverlayManager
import com.facebook.react.devsupport.interfaces.RedBoxHandler
import com.facebook.react.packagerconnection.RequestHandler
import com.mendix.mendixnative.config.AppPreferences

/**
* A public DevSupportManager implementation for Mendix apps in bridgeless mode.
Expand Down Expand Up @@ -43,8 +45,29 @@ class MendixBridgelessDevSupportManager(
devLoadingViewManager,
pausedInDebuggerOverlayManager,
) {
private val mxContext: Context = applicationContext

override val uniqueTag: String get() = "MendixBridgeless"

/**
* React Native's [com.facebook.react.packagerconnection.PackagerConnectionSettings] caches the
* resolved debug server host in a static field. When nothing is stored yet, a background read
* (e.g. opening the packager websocket when this manager is created) resolves the emulator
* default (10.0.2.2:8081) and writes it to that cache after we have already set the host for
* the Mendix app, overwriting it. Metro would then be reported as not running and
* [com.facebook.react.runtime.ReactHostImpl] falls back to the asset bundle, which doesn't exist
* in developer builds ("Unable to load script").
*
* Re-apply the host Mendix stored for this app right before the check so it always wins.
*/
override fun isPackagerRunning(callback: PackagerStatusCallback) {
val storedHost = AppPreferences(mxContext).metroBundlerHost
if (storedHost.isNotEmpty()) {
devSettings.packagerConnectionSettings.debugServerHost = storedHost
}
super.isPackagerRunning(callback)
}

override fun handleReloadJS() {
UiThreadUtil.assertOnUiThread()
hideRedboxDialog()
Expand Down
Loading