@@ -59,22 +59,27 @@ Provider has different props you can use for configuration.
59
59
The most common BaseConfiguration properties used are:
60
60
61
61
- ``schema?: (RealmObjectConstructor<AnyRealmObject> | ObjectSchema)[]``
62
+
62
63
Specifies all the object schemas in this Realm. Required when first creating a Realm.
63
64
If omitted, the schema will be read from the existing Realm file.
64
65
65
66
- ``sync?: SyncConfiguration``
67
+
66
68
Configures a synced realm.
67
69
68
70
``RealmProvider`` has more props that define its behavior:
69
71
70
72
- ``fallback?: React.ComponentType<unknown> | React.ReactElement | null | undefined``
73
+
71
74
The fallback component to render while the Realm is opening.
72
75
73
76
- ``closeOnUnmount?: boolean``
77
+
74
78
Default is ``true``. If set to ``false``, realm will not close when the
75
79
component unmounts.
76
80
77
81
- ``realmRef?: React.MutableRefObject<Realm | null>``
82
+
78
83
A ref to the realm instance. This is useful if you need to access the realm
79
84
instance outside of the scope of the realm.
80
85
@@ -89,12 +94,14 @@ Provider has different props you can use for configuration.
89
94
The most common AppConfiguration property used is:
90
95
91
96
- ``id: string``
97
+
92
98
Specifies the App ID.
93
99
94
100
.. tab:: UserProvider Props
95
101
:tabid: user-provider-props
96
102
97
103
- ``fallback?: React.ComponentType<unknown> | React.ReactElement | null | undefined``
104
+
98
105
The fallback component to render if there is no authorized user. This can be
99
106
used to render a log in screen or otherwise handle authentication.
100
107
@@ -145,7 +152,8 @@ to configure a realm or exposing more than one realm, refer to their respective
145
152
You *must* nest the Providers and app components as shown below to ensure each component
146
153
has access to its required context:
147
154
148
- [Code example here]
155
+ .. literalinclude:: /examples/generated/react-native/ts/configure-realm-sync.test.snippet.configure-realm-sync-full.tsx
156
+ :language: javascript
149
157
150
158
.. tab:: Configure realm without sync
151
159
:tabid: configure-non-sync-realm
@@ -163,7 +171,8 @@ to configure a realm or exposing more than one realm, refer to their respective
163
171
Once your ``RealmProvider`` has been configured, nest your app components within it to
164
172
give them access to the realm opened.
165
173
166
- [code example - unsynced]
174
+ .. literalinclude:: /examples/generated/react-native/ts/configure-realm-local.test.snippet.configure-realm.tsx
175
+ :language: typescript
167
176
168
177
169
178
Working with Providers using Hooks
0 commit comments