title: Using Firebase Custom Claims to conditionally render a UI in React Native
body: <p>I'm currently building a react native project with firebase and I would like to use the custom claims to conditionally render a Navigator.
  Looking at the firebase documentation the example they give is:</p>
  <pre><code>firebase.auth().currentUser.getIdTokenResult()
    .then((idTokenResult) =&gt; {
       // Confirm the user is an Admin.
       if (!!idTokenResult.claims.admin) {
         // Show admin UI.
         showAdminUI();
       } else {
         // Show regular user UI.
         showRegularUI();
       }
    })
    .catch((error) =&gt; {
      console.log(error);
    });
  
  </code></pre>
  <p>So trying to convert it to react native this is what I came up with:</p>
  <pre><code>export default function UINav () {
  return firebase
      .auth()
      .currentUser.getIdTokenResult()
      .then((tokenResult) =&gt; {
        if (tokenResult.claims.admin) {
          return (
            &lt;NavigationContainer&gt;
              &lt;Stack.Navigator
                mode=&quot;modal&quot;
              &gt;
                &lt;Stack.Screen
                  name=&quot;Admin&quot;
                  component={AdminNavigator}
                /&gt;
              &lt;/Stack.Navigator&gt;
            &lt;/NavigationContainer&gt;
          )
        } else {
          return (
            &lt;NavigationContainer&gt;
              &lt;Stack.Navigator
                mode=&quot;modal&quot;
              &gt;
                &lt;&gt;
                  &lt;Stack.Screen
                    name=&quot;User&quot;
                    component={UserNavigator}
                  /&gt;
                &lt;/&gt;
              &lt;/Stack.Navigator&gt;
            &lt;/NavigationContainer&gt;
          )
        }
      })
  
  }
  </code></pre>
  <p>The error I'm getting is:</p>
  <blockquote>
  <p>Error: Objects are not valid as a React child (found: object with keys {_U, _V, _W, _X}). If you meant to render a collection of children, use an array instead.</p>
  </blockquote>
  <p>Any help would be appreciated :)</p>