Skip to content

Commit

Permalink
Expand jsdoc for provider params
Browse files Browse the repository at this point in the history
  • Loading branch information
takameyer committed Aug 23, 2023
1 parent 3adbb74 commit 7a563e4
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
8 changes: 2 additions & 6 deletions packages/realm-react/CHANGELOG.md
Expand Up @@ -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
<!-- * Either mention core version or upgrade -->
<!-- * Using Realm Core vX.Y.Z -->
<!-- * Upgraded Realm Core from vX.Y.Z to vA.B.C -->
* Added more documentation to provider params.

## 0.5.2 (2023-08-09)

Expand Down
6 changes: 5 additions & 1 deletion packages/realm-react/src/AppProvider.tsx
Expand Up @@ -52,8 +52,12 @@ const AuthOperationProvider: React.FC<AuthOperationProps> = ({ 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<Realm.App | null>;
children: React.ReactNode;
};

/**
Expand Down
11 changes: 11 additions & 0 deletions packages/realm-react/src/RealmProvider.tsx
Expand Up @@ -26,8 +26,19 @@ type PartialRealmConfiguration = Omit<Partial<Realm.Configuration>, "sync"> & {
};

type ProviderProps = PartialRealmConfiguration & {
/**
* The fallback component to render if the Realm is not opened.
*/
fallback?: React.ComponentType<unknown> | 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<Realm | null>;
children: React.ReactNode;
};
Expand Down
5 changes: 4 additions & 1 deletion packages/realm-react/src/UserProvider.tsx
Expand Up @@ -26,7 +26,10 @@ import { useApp } from "./AppProvider";
export const UserContext = createContext<Realm.User | null>(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<unknown> | React.ReactElement | null | undefined;
children: React.ReactNode;
};
Expand Down

0 comments on commit 7a563e4

Please sign in to comment.