@@ -374,6 +374,30 @@ public class SampleTurboModule(private val context: ReactApplicationContext) :
374374 PickUpToMedia .Request (limit, PickVisualMediaRequest (visualMediaType(mimeType))))
375375 }
376376
377+ /* *
378+ * Starts a second, distinct Activity in the same task to exercise multi-Activity navigation.
379+ * With two ReactActivities alive, the new one resumes *before* the old one is destroyed, and the
380+ * old one's onHostDestroy is dropped entirely -- the exact ordering that forces
381+ * [com.facebook.react.activityresult.ReactActivityResultCallerImpl] to rebind launchers to the
382+ * current Activity's registry instead of staying attached to the previous (still-alive or dead)
383+ * one. Launched by class name so this sample module needs no compile-time dependency on the app.
384+ */
385+ @DoNotStrip
386+ @Suppress(" unused" )
387+ override fun startSecondActivity () {
388+ val activity = context.currentActivity
389+ if (activity == null ) {
390+ Toast .makeText(context, " No current Activity to launch from" , Toast .LENGTH_LONG ).show()
391+ return
392+ }
393+ // The data URI deep-links the new surface straight to the picker example via Linking; the
394+ // explicit class name keeps this an in-app navigation regardless of intent filters.
395+ val intent =
396+ Intent (Intent .ACTION_VIEW , Uri .parse(" rntester://example/PhotoPickerAndroid" ))
397+ .setClassName(activity, " ${activity.packageName} .RNTesterSecondActivity" )
398+ activity.startActivity(intent)
399+ }
400+
377401 private fun log (method : String , input : Any? , output : Any? ) {
378402 toast?.cancel()
379403 val message = StringBuilder (" Method :" )
0 commit comments