title: React Native Kiosk Mode
body: <p>I have a rather basic React Native app. I want to conditionally lock/unlock the app based on the component that is being rendered. For example, I want to lock the app (in kiosk mode) if the <code>Player</code> component is rendered and then unlock the app if it's not (or unmounting).</p>
  <pre><code>render(){
    return(
     &lt;&gt;
        {this.state.showPlayer === false &amp;&amp; &lt;Connect /&gt;}
        {this.state.showPlayer === true &amp;&amp; &lt;Player /&gt;}
     &lt;/&gt;
    )
  }
  </code></pre>
  <p>I have reviewed the documentation for setting the lock here: <a href="https://developer.android.com/work/dpc/dedicated-devices/lock-task-mode#start_lock_task_mode" rel="nofollow noreferrer">https://developer.android.com/work/dpc/dedicated-devices/lock-task-mode#start_lock_task_mode</a></p>
  <p>Here is the code:</p>
  <pre><code>// Set an option to turn on lock task mode when starting the activity.
  ActivityOptions options = ActivityOptions.makeBasic();
  options.setLockTaskEnabled(true);
  
  // Start our kiosk app's main activity with our lock task mode option.
  PackageManager packageManager = context.getPackageManager();
  Intent launchIntent = packageManager.getLaunchIntentForPackage(KIOSK_PACKAGE);
  if (launchIntent != null) {
    context.startActivity(launchIntent, options.toBundle());
  }
  </code></pre>
  <p>I am not sure how to configure this as I'm rather new to the React Native and Android space. Any help would be appreciated.</p>