Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: make react-native-audio-api a peer dependency #126

Merged
merged 4 commits into from
Mar 7, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ https://docs.swmansion.com/react-native-executorch
```bash
# Install the package
yarn add react-native-executorch
# This dependency is needed for loading audio in STT
yarn add react-native-audio-api
cd ios && pod install && cd ..
```

Expand Down
11 changes: 9 additions & 2 deletions docs/docs/fundamentals/getting-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,27 +16,30 @@ React Native ExecuTorch is our way of bringing ExecuTorch into the React Native

## Installation

Installation is pretty straightforward, just use your favorite package manager.
Installation is pretty straightforward, just use your favorite package manager. We use React Native Audio API as a peer dependency to make it possible to load audio for Speech To Text.

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

npm install react-native-executorch
npm install react-native-audio-api

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

pnpm install react-native-executorch
pnpm install react-native-audio-api

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

yarn add react-native-executorch
yarn add react-native-audio-api

</TabItem>
</Tabs>

If you plan on adding your models to the assets instead of fetching them from a url, you also need to add following lines to your `metro.config.js`:
If you plan on using your models via require() insteadf of fetching them from a url, you also need to add following lines to your `metro.config.js`:

```json
// metro.config.js
Expand All @@ -52,6 +55,10 @@ This allows us to use binaries, such as exported models or tokenizers for LLMs.
When using Expo, please note that you need to use a custom development build of your app, not the standard Expo Go app. This is because we rely on native modules, which Expo Go doesn’t support.
:::

:::caution
If you encountered an error that native modules for React Native Audio API were not installed, please make sure to install react-native-audio-api.
:::
Comment on lines +59 to +60
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
If you encountered an error that native modules for React Native Audio API were not installed, please make sure to install react-native-audio-api.
:::
If you encountered an error that native modules for React Native Audio API were not installed, please make sure to run `yarn add react-native-audio-api`.
:::

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure if I think its better, not everyone uses yarn

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use yarn above in docs, that's why i opted for this, but it is not necessary


:::info
Because we are using ExecuTorch under the hood, you won't be able to build iOS app for release with simulator selected as the target device. Make sure to test release builds on real devices.
:::
Expand Down
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@
"prettier": "^3.0.3",
"react": "18.3.1",
"react-native": "^0.76.1",
"react-native-audio-api": "0.4.13",
"react-native-builder-bob": "^0.30.2",
"turbo": "^1.10.7",
"typescript": "^5.2.2"
Expand All @@ -85,7 +86,8 @@
},
"peerDependencies": {
"react": "*",
"react-native": "*"
"react-native": "*",
"react-native-audio-api": "*"
},
"workspaces": [
"example"
Expand Down Expand Up @@ -198,7 +200,6 @@
"expo-file-system": "^18.0.10",
"react": "18.3.1",
"react-native": "0.76.7",
"react-native-audio-api": "0.4.11",
"react-native-live-audio-stream": "^1.1.1"
}
}
13 changes: 8 additions & 5 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11596,13 +11596,15 @@ __metadata:
languageName: node
linkType: hard

"react-native-audio-api@npm:0.4.11":
version: 0.4.11
resolution: "react-native-audio-api@npm:0.4.11"
"react-native-audio-api@npm:0.4.13":
version: 0.4.13
resolution: "react-native-audio-api@npm:0.4.13"
peerDependencies:
react: "*"
react-native: "*"
checksum: 7e80da3fc61881f61dcb676da6dcf0255ee2ea2d35ee39b40d8a329efdc0e5dd483cd2f820cba0b014042f9118d4c1a3d12456d3cab8de6cceda751df3b5e885
bin:
setup-rn-audio-api-web: scripts/setup-rn-audio-api-web.js
checksum: 9a5db4626a0663224cdcdc957ed5176df9ed65df9f58bf06c5eae2a91895b7ee0f0a632ecaa79b23ef7536983485cea2720ca46201e2e690548f400b66970ff6
languageName: node
linkType: hard

Expand Down Expand Up @@ -11662,14 +11664,15 @@ __metadata:
prettier: ^3.0.3
react: 18.3.1
react-native: ^0.76.1
react-native-audio-api: 0.4.11
react-native-audio-api: 0.4.13
react-native-builder-bob: ^0.30.2
react-native-live-audio-stream: ^1.1.1
turbo: ^1.10.7
typescript: ^5.2.2
peerDependencies:
react: "*"
react-native: "*"
react-native-audio-api: "*"
languageName: unknown
linkType: soft

Expand Down
Loading