Uploaded image for project: 'Realm JavaScript SDK'
  1. Realm JavaScript SDK
  2. RJS-2816

UserProvider doesn't unmount Login-Component

      How frequently does the bug occur?

      Always

      Description

      I have set up a React-Native-App with Expo SDK@50 and realm/@realm-react. This is the Code for my Custom-Provider:

      import { RealmProvider, AppProvider, UserProvider } from "@realm/react";
      
      // Models:
      import { ShoppingItem } from "../models/ShoppingItem";
      
      // Components:
      import Login from "../components/login";
      
      const appId = "myapp-*****";
      
      export const RealmCustomProvider = ({ children }) => {
        return (
          <AppProvider id={appId}>
            <UserProvider fallback={Login}>
              <RealmProvider schema={[ShoppingItem]}>{children}</RealmProvider>
            </UserProvider>
          </AppProvider>
        );
      };
      

      The Login-Component uses the simple following Code:

      import { useAuth, useUser } from "@realm/react";
      import { useEffect } from "react";
      import { Text, View } from "react-native";
      
      const Login = () => {
        const { logInWithAnonymous } = useAuth();
      
        const guestLogin = () => {
          logInWithAnonymous();
        };
      
        return (
          <View style={{ flex: 1, justifyContent: "center", alignItems: "center" }}>
            <Text onPress={guestLogin}>Continue as Guest</Text>
          </View>
        );
      };
      
      export default Login;
      

      After pressing the "Continue as Guest"-Button the App-Screen still shows the Login-Component. Checking the Users-Tab in the App-Services an anonymous user has been created. When reloading the App it just shows "Loading from Metro.." and gets stuck in the SplashScreen. After reinstalling or hard-closing and reopening the App the UserProvider recognizes the anonymous user and unmounts the Login-Component.

      The Error reoccurs every single time. There is no error shown in the console. I already tried to reinstall all dependencies and even setting a whole blank app up. The error even occurs when I clone the Tutorials Github repository: https://github.com/notJust-dev/TrelloClone.

      After trying to fix this error for two days I am nearly burned out and hope for some helpful responses! Thanks a lot in advance!

      Stacktrace & log output

      No response

      Can you reproduce the bug?

      Always

      Reproduction Steps

      No response

      Version

      realm: 12.8.0, @realm/react: 0.6.2

      What services are you using?

      Atlas Device Sync

      Are you using encryption?

      No

      Platform OS and version(s)

      every IOS

      Build environment

      Which debugger for React Native: ..

      Cocoapods version

      No response

            Assignee:
            Unassigned Unassigned
            Reporter:
            unitosyncbot Unito Sync Bot
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: