Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .cspell-wordlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -180,3 +180,4 @@ nˈɛvəɹ
ˈɛniwˌʌn
ˈɛls
Synchronizable
stringifying
31 changes: 29 additions & 2 deletions docs/docs/01-fundamentals/01-getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,32 +38,59 @@ For supported React Native and Expo versions, see the [Compatibility table](../0

## Installation

Installation is pretty straightforward, just use your favorite package manager.
Installation is pretty straightforward, use your package manager of choice to install the package and some peer dependencies required to streamline model downloads. If you want to implement your custom model fetching logic, see [this document](../08-resource-fetcher/02-custom-adapter.md).

<Tabs>
<TabItem value="npm" label="NPM">

```
npm install react-native-executorch
# For Expo projects
npm install react-native-executorch-expo-resource-fetcher
# For bare React Native projects
npm install react-native-executorch-bare-resource-fetcher
```

</TabItem>
<TabItem value="pnpm" label="PNPM">

```
pnpm install react-native-executorch
# For Expo projects
pnpm install react-native-executorch-expo-resource-fetcher
# For bare React Native projects
pnpm install react-native-executorch-bare-resource-fetcher

```

</TabItem>
<TabItem value="yarn" label="YARN">

```
yarn add react-native-executorch
# For Expo projects
yarn install react-native-executorch-expo-resource-fetcher
# For bare React Native projects
yarn install react-native-executorch-bare-resource-fetcher
```

</TabItem>
</Tabs>

:::warning
Before using any other API, you must call `initExecutorch` with a resource fetcher adapter at the entry point of your app:

```js
import { initExecutorch } from 'react-native-executorch';
import { ExpoResourceFetcher } from 'react-native-executorch-expo-resource-fetcher';
// or BareResourceFetcher for Expo projects

initExecutorch({ resourceFetcher: ExpoResourceFetcher });
```

Calling any library API without initializing first will throw a `ResourceFetcherAdapterNotInitialized` error.
:::

Our library offers support for both bare React Native and Expo projects. Please follow the instructions from [Loading models section](./02-loading-models.md) to make sure you setup your project correctly. We encourage you to use Expo project if possible. If you are planning to migrate from bare React Native to Expo project, the link (https://docs.expo.dev/bare/installing-expo-modules/) offers a guidance on setting up Expo Modules in a bare React Native environment.

If you plan on using your models via require() instead of fetching them from a url, you also need to add following lines to your `metro.config.js`:
Expand All @@ -89,7 +116,7 @@ Because we are using ExecuTorch under the hood, you won't be able to build iOS a
Running the app with the library:

```bash
yarn run expo:<ios | android> -d
yarn <ios | android> -d
```

## Supporting new models in React Native ExecuTorch
Expand Down
218 changes: 0 additions & 218 deletions docs/docs/05-utilities/resource-fetcher.md

This file was deleted.

Loading
Loading