Realm in react native using Expo Router

Hello,
I’m new to the forum so I don’t know if the right place to ask.
I’m trying to develop my first app using the realm sdk implementing it in an expo app. The thing is it always gibes me the erro: ERROR Error: Realm context not found. Did you call useRealm() within a ?

When I use a single realm at the root of my project I can send data to my cluster, but if I move it into a more nested screen that it gives me this error. Keep in mind that I always have this in the screen
import { useQuery, useRealm } from “@realm/react”;

and then inside the definition of the screen I use the realm so for example:

const hatching = () => {
const [name, setName] = useState(“”);
const [commonName, setCommonName] = useState(“”);
const [species, setSpecies] = useState(“”);

const realm = useRealm();

My question is:
could it be because I’m using the new expo routing system (v2) or is it because I use the RealmProvider that gives me access to only one realm by default. That’s tricky to me, I haven’t fully understand if passing multiple schemas like this actually expose multiple realms:

const indexPage = () => {
return (


<RealmProvider
schema={[Profile, Animal]}
sync={{ flexible: true }}
>




);
};

Thanks a lot if someone could provide me with additional info, I think the Realm Docs are a bit tricky but maybe the problem is with compatibility with expo.

Best regards

This should help Realm Database, Expo SDK 49 and Expo Router Getting Started - DEV Community