Skip to content

Commit d3bb34e

Browse files
committed
update docs
1 parent a453e49 commit d3bb34e

File tree

5 files changed

+50
-20
lines changed

5 files changed

+50
-20
lines changed

examples/react-native/__tests__/js/app-services/use-app.test.jsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// :snippet-start: app-provider
1+
// :snippet-start: use-app
22
import React from 'react';
33
import {useApp} from '@realm/react';
44
import {Credentials} from 'realm';

examples/react-native/__tests__/ts/app-services/use-app.test.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// :snippet-start: app-provider
1+
// :snippet-start: use-app
22
import React from 'react';
33
import {useApp} from '@realm/react';
44
import {Credentials} from 'realm';

source/examples/generated/react-native/js/use-app.test.snippet.app-provider.jsx renamed to source/examples/generated/react-native/js/use-app.test.snippet.use-app.jsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import React from 'react';
2-
import {useApp} from '@realm/react';
3-
import {Credentials} from 'realm';
1+
import React from "react";
2+
import { useApp } from "@realm/react";
3+
import { Credentials } from "realm";
4+
45
function MyApp() {
56
const app = useApp();
67
function logInAnonymousUser() {

source/examples/generated/react-native/ts/use-app.test.snippet.app-provider.tsx renamed to source/examples/generated/react-native/ts/use-app.test.snippet.use-app.tsx

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
import React from 'react';
2-
import {useApp} from '@realm/react';
3-
import {Credentials} from 'realm';
1+
import React from "react";
2+
import { useApp } from "@realm/react";
3+
import { Credentials } from "realm";
4+
45
function MyApp() {
56
const app = useApp();
67
function logInAnonymousUser() {

source/sdk/react-native/app-services/connect-to-app-services-app.txt

Lines changed: 40 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -28,16 +28,19 @@ To set up your App client, pass the App ID string
2828
to the ``id`` prop of the ``AppProvider``.
2929
Wrap any components that need to access the App with the ``AppProvider``.
3030

31-
TODO: new literalinclues for both examples
31+
.. tabs-realm-languages::
3232

33-
.. literalinclude:: /examples/generated/expo/AppWrapper.snippet.wrap-app-within-app-provider.tsx
34-
:language: typescript
35-
:emphasize-lines: 1, 5
33+
.. tab::
34+
:tabid: typescript
3635

37-
You can also include additional configuration in the ``AppProvider`` by passing
38-
the properties of :js-sdk:`Realm.AppConfiguration <Realm.AppConfiguration.html>` as props.
36+
.. literalinclude:: /examples/generated/react-native/ts/app-provider.test.snippet.app-provider.tsx
37+
:language: typescript
3938

40-
TODO: literalincludes for both examples
39+
.. tab::
40+
:tabid: javascript
41+
42+
.. literalinclude:: /examples/generated/react-native/js/app-provider.test.snippet.app-provider.jsx
43+
:language: javascript
4144

4245
.. _react-native-app-retrieve-client:
4346

@@ -48,15 +51,40 @@ All components wrapped within an ``AppProvider`` can access the :js-sdk:`App <Re
4851
client with the ``useApp()`` hook. Using the App, you can authenticate users
4952
and access App Services.
5053

51-
TODO: literalincludes for both examples
54+
.. tabs-realm-languages::
55+
56+
.. tab::
57+
:tabid: typescript
58+
59+
.. literalinclude:: /examples/generated/react-native/ts/use-app.test.snippet.use-app.tsx
60+
:language: typescript
5261

53-
.. literalinclude:: /examples/generated/expo/LoginComponent.snippet.useApp-hook-usage.tsx
54-
:language: typescript
55-
:emphasize-lines: 1, 7, 11
62+
.. tab::
63+
:tabid: javascript
64+
65+
.. literalinclude:: /examples/generated/react-native/js/use-app.test.snippet.use-app.jsx
66+
:language: javascript
5667

5768
.. _react-native-retrieve-client-outside-provider:
5869

5970
Retrieve App Outside the App Provider
6071
-------------------------------------
6172

62-
TODO: i don't fully grok this
73+
To retrieve an instance of the App Client from anywhere in your application,
74+
call :js-sdk:`Realm.App.getApp() <Realm.App.html#getApp>` and pass in your ``App ID``.
75+
76+
.. tabs-realm-languages::
77+
78+
.. tab::
79+
:tabid: typescript
80+
81+
.. code-block:: typescript
82+
83+
const app = Realm.App.getApp("<Your App ID>");
84+
85+
.. tab::
86+
:tabid: javascript
87+
88+
.. code-block:: javascript
89+
90+
const app = Realm.App.getApp("<Your App ID>");

0 commit comments

Comments
 (0)