diff --git a/packages/realm-react/CHANGELOG.md b/packages/realm-react/CHANGELOG.md index e131f56330..10e965f48b 100644 --- a/packages/realm-react/CHANGELOG.md +++ b/packages/realm-react/CHANGELOG.md @@ -11,14 +11,10 @@ * None ### Compatibility -* React Native >= v0.71.4 -* Realm Studio v14.0.0. -* File format: generates Realms with format v23 (reads and upgrades file format v5 or later for non-synced Realm, upgrades file format v10 or later for synced Realms). +* Realm >= 11.0.0 ### Internal - - - +* Added more documentation to provider params. ## 0.5.2 (2023-08-09) diff --git a/packages/realm-react/src/AppProvider.tsx b/packages/realm-react/src/AppProvider.tsx index f6abb95fc1..5a2f1762dc 100644 --- a/packages/realm-react/src/AppProvider.tsx +++ b/packages/realm-react/src/AppProvider.tsx @@ -52,8 +52,12 @@ const AuthOperationProvider: React.FC = ({ children }) => { * https://www.mongodb.com/docs/realm-sdks/js/latest/Realm.App.html#~AppConfiguration */ type AppProviderProps = Realm.AppConfiguration & { - children: React.ReactNode; + /** + * A ref to the App instance. This is useful if you need to access the App + * instance outside of a component that uses the App hooks. + */ appRef?: React.MutableRefObject; + children: React.ReactNode; }; /** diff --git a/packages/realm-react/src/RealmProvider.tsx b/packages/realm-react/src/RealmProvider.tsx index 9c0b3191f4..879fcd8b41 100644 --- a/packages/realm-react/src/RealmProvider.tsx +++ b/packages/realm-react/src/RealmProvider.tsx @@ -26,8 +26,19 @@ type PartialRealmConfiguration = Omit, "sync"> & { }; type ProviderProps = PartialRealmConfiguration & { + /** + * The fallback component to render if the Realm is not opened. + */ fallback?: React.ComponentType | React.ReactElement | null | undefined; + /** + * If false, Realm will not be closed when the component unmounts. + * @default true + */ closeOnUnmount?: boolean; + /** + * A ref to the Realm instance. This is useful if you need to access the Realm + * instance outside of a component that uses the Realm hooks. + */ realmRef?: React.MutableRefObject; children: React.ReactNode; }; diff --git a/packages/realm-react/src/UserProvider.tsx b/packages/realm-react/src/UserProvider.tsx index 8f4bfd0244..c1de07fd9a 100644 --- a/packages/realm-react/src/UserProvider.tsx +++ b/packages/realm-react/src/UserProvider.tsx @@ -26,7 +26,10 @@ import { useApp } from "./AppProvider"; export const UserContext = createContext(null); type UserProviderProps = { - // Optional fallback component to render when unauthenticated + /** + * The fallback component to render if there is no authorized user. This can be used + * to render a login screen or another component which will log the user in. + */ fallback?: React.ComponentType | React.ReactElement | null | undefined; children: React.ReactNode; };