├── .editorconfig ├── .gitattributes ├── .github ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ └── config.yml ├── actions │ └── setup │ │ └── action.yml └── workflows │ └── ci.yml ├── .gitignore ├── .nvmrc ├── .watchmanconfig ├── .yarn ├── plugins │ └── @yarnpkg │ │ ├── plugin-interactive-tools.cjs │ │ └── plugin-workspace-tools.cjs └── releases │ └── yarn-3.6.1.cjs ├── .yarnrc.yml ├── LICENSE ├── README.md ├── Speech.podspec ├── android ├── build.gradle ├── gradle.properties └── src │ └── main │ ├── AndroidManifest.xml │ ├── AndroidManifestNew.xml │ └── java │ └── com │ └── speech │ ├── SpeechModule.kt │ ├── SpeechPackage.kt │ └── SpeechUtils.kt ├── babel.config.js ├── docs ├── CODE_OF_CONDUCT.md ├── CONTRIBUTING.md ├── USAGE.md ├── android-thumbnail.png └── ios-thumbnail.png ├── example ├── .bundle │ └── config ├── .watchmanconfig ├── Gemfile ├── Gemfile.lock ├── README.md ├── android │ ├── app │ │ ├── build.gradle │ │ ├── debug.keystore │ │ ├── proguard-rules.pro │ │ └── src │ │ │ ├── debug │ │ │ └── AndroidManifest.xml │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── speech │ │ │ │ └── example │ │ │ │ ├── MainActivity.kt │ │ │ │ └── MainApplication.kt │ │ │ └── res │ │ │ ├── drawable │ │ │ └── rn_edit_text_material.xml │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ └── settings.gradle ├── app.json ├── babel.config.js ├── index.js ├── ios │ ├── .xcode.env │ ├── Podfile │ ├── Podfile.lock │ ├── SpeechExample.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ └── SpeechExample.xcscheme │ ├── SpeechExample.xcworkspace │ │ ├── contents.xcworkspacedata │ │ └── xcshareddata │ │ │ └── IDEWorkspaceChecks.plist │ └── SpeechExample │ │ ├── AppDelegate.swift │ │ ├── Images.xcassets │ │ ├── AppIcon.appiconset │ │ │ └── Contents.json │ │ └── Contents.json │ │ ├── Info.plist │ │ ├── LaunchScreen.storyboard │ │ └── PrivacyInfo.xcprivacy ├── jest.config.js ├── metro.config.js ├── package.json ├── react-native.config.js └── src │ ├── App.tsx │ ├── components │ └── Button.tsx │ ├── styles │ └── gs.ts │ └── views │ └── RootView.tsx ├── ios ├── Speech.h └── Speech.mm ├── lefthook.yml ├── package.json ├── react-native.config.js ├── src ├── NativeSpeech.ts ├── Speech.ts ├── __tests__ │ └── index.test.tsx ├── components │ ├── HighlightedText │ │ └── index.tsx │ └── types.ts └── index.tsx ├── tsconfig.build.json ├── tsconfig.json ├── turbo.json └── yarn.lock /.editorconfig: -------------------------------------------------------------------------------- 1 | # EditorConfig helps developers define and maintain consistent 2 | # coding styles between different editors and IDEs 3 | # editorconfig.org 4 | 5 | root = true 6 | 7 | [*] 8 | 9 | indent_style = space 10 | indent_size = 2 11 | 12 | end_of_line = lf 13 | charset = utf-8 14 | trim_trailing_whitespace = true 15 | insert_final_newline = true 16 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | # specific for windows script files 3 | *.bat text eol=crlf -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug_report.yml: -------------------------------------------------------------------------------- 1 | name: 🐛 Bug report 2 | description: Report a reproducible bug or regression in this library. 3 | labels: [bug] 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | # Bug report 9 | 10 | 👋 Hi! 11 | 12 | **Please fill the following carefully before opening a new issue ❗** 13 | *(Your issue may be closed if it doesn't provide the required pieces of information)* 14 | - type: checkboxes 15 | attributes: 16 | label: Before submitting a new issue 17 | description: Please perform simple checks first. 18 | options: 19 | - label: I tested using the latest version of the library, as the bug might be already fixed. 20 | required: true 21 | - label: I tested using a [supported version](https://github.com/reactwg/react-native-releases/blob/main/docs/support.md) of react native. 22 | required: true 23 | - label: I checked for possible duplicate issues, with possible answers. 24 | required: true 25 | - type: textarea 26 | id: summary 27 | attributes: 28 | label: Bug summary 29 | description: | 30 | Provide a clear and concise description of what the bug is. 31 | If needed, you can also provide other samples: error messages / stack traces, screenshots, gifs, etc. 32 | validations: 33 | required: true 34 | - type: input 35 | id: library-version 36 | attributes: 37 | label: Library version 38 | description: What version of the library are you using? 39 | placeholder: "x.x.x" 40 | validations: 41 | required: true 42 | - type: textarea 43 | id: react-native-info 44 | attributes: 45 | label: Environment info 46 | description: Run `react-native info` in your terminal and paste the results here. 47 | render: shell 48 | validations: 49 | required: true 50 | - type: textarea 51 | id: steps-to-reproduce 52 | attributes: 53 | label: Steps to reproduce 54 | description: | 55 | You must provide a clear list of steps and code to reproduce the problem. 56 | value: | 57 | 1. … 58 | 2. … 59 | validations: 60 | required: true 61 | - type: input 62 | id: reproducible-example 63 | attributes: 64 | label: Reproducible example repository 65 | description: Please provide a link to a repository on GitHub with a reproducible example. 66 | render: js 67 | validations: 68 | required: true 69 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Feature Request 💡 4 | url: https://github.com/mhpdev-com/react-native-speech/discussions/new?category=ideas 5 | about: If you have a feature request, please create a new discussion on GitHub. 6 | - name: Discussions on GitHub 💬 7 | url: https://github.com/mhpdev-com/react-native-speech/discussions 8 | about: If this library works as promised but you need help, please ask questions there. 9 | -------------------------------------------------------------------------------- /.github/actions/setup/action.yml: -------------------------------------------------------------------------------- 1 | name: Setup 2 | description: Setup Node.js and install dependencies 3 | 4 | runs: 5 | using: composite 6 | steps: 7 | - name: Setup Node.js 8 | uses: actions/setup-node@v4 9 | with: 10 | node-version-file: .nvmrc 11 | 12 | - name: Restore dependencies 13 | id: yarn-cache 14 | uses: actions/cache/restore@v4 15 | with: 16 | path: | 17 | **/node_modules 18 | .yarn/install-state.gz 19 | key: ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }}-${{ hashFiles('**/package.json', '!node_modules/**') }} 20 | restore-keys: | 21 | ${{ runner.os }}-yarn-${{ hashFiles('yarn.lock') }} 22 | ${{ runner.os }}-yarn- 23 | 24 | - name: Install dependencies 25 | if: steps.yarn-cache.outputs.cache-hit != 'true' 26 | run: yarn install --immutable 27 | shell: bash 28 | 29 | - name: Cache dependencies 30 | if: steps.yarn-cache.outputs.cache-hit != 'true' 31 | uses: actions/cache/save@v4 32 | with: 33 | path: | 34 | **/node_modules 35 | .yarn/install-state.gz 36 | key: ${{ steps.yarn-cache.outputs.cache-primary-key }} 37 | -------------------------------------------------------------------------------- /.github/workflows/ci.yml: -------------------------------------------------------------------------------- 1 | name: CI 2 | on: 3 | push: 4 | branches: 5 | - main 6 | pull_request: 7 | branches: 8 | - main 9 | merge_group: 10 | types: 11 | - checks_requested 12 | 13 | jobs: 14 | lint: 15 | runs-on: ubuntu-latest 16 | steps: 17 | - name: Checkout 18 | uses: actions/checkout@v4 19 | 20 | - name: Setup 21 | uses: ./.github/actions/setup 22 | 23 | - name: Lint files 24 | run: yarn lint 25 | 26 | - name: Typecheck files 27 | run: yarn typecheck 28 | 29 | test: 30 | runs-on: ubuntu-latest 31 | steps: 32 | - name: Checkout 33 | uses: actions/checkout@v4 34 | 35 | - name: Setup 36 | uses: ./.github/actions/setup 37 | 38 | - name: Run unit tests 39 | run: yarn test --maxWorkers=2 --coverage 40 | 41 | build-library: 42 | runs-on: ubuntu-latest 43 | steps: 44 | - name: Checkout 45 | uses: actions/checkout@v4 46 | 47 | - name: Setup 48 | uses: ./.github/actions/setup 49 | 50 | - name: Build package 51 | run: yarn prepare 52 | 53 | build-android: 54 | runs-on: ubuntu-latest 55 | env: 56 | TURBO_CACHE_DIR: .turbo/android 57 | steps: 58 | - name: Checkout 59 | uses: actions/checkout@v4 60 | 61 | - name: Setup 62 | uses: ./.github/actions/setup 63 | 64 | - name: Cache turborepo for Android 65 | uses: actions/cache@v4 66 | with: 67 | path: ${{ env.TURBO_CACHE_DIR }} 68 | key: ${{ runner.os }}-turborepo-android-${{ hashFiles('yarn.lock') }} 69 | restore-keys: | 70 | ${{ runner.os }}-turborepo-android- 71 | 72 | - name: Check turborepo cache for Android 73 | run: | 74 | TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:android').cache.status") 75 | 76 | if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then 77 | echo "turbo_cache_hit=1" >> $GITHUB_ENV 78 | fi 79 | 80 | - name: Install JDK 81 | if: env.turbo_cache_hit != 1 82 | uses: actions/setup-java@v4 83 | with: 84 | distribution: 'zulu' 85 | java-version: '17' 86 | 87 | - name: Finalize Android SDK 88 | if: env.turbo_cache_hit != 1 89 | run: | 90 | /bin/bash -c "yes | $ANDROID_HOME/cmdline-tools/latest/bin/sdkmanager --licenses > /dev/null" 91 | 92 | - name: Cache Gradle 93 | if: env.turbo_cache_hit != 1 94 | uses: actions/cache@v4 95 | with: 96 | path: | 97 | ~/.gradle/wrapper 98 | ~/.gradle/caches 99 | key: ${{ runner.os }}-gradle-${{ hashFiles('example/android/gradle/wrapper/gradle-wrapper.properties') }} 100 | restore-keys: | 101 | ${{ runner.os }}-gradle- 102 | 103 | - name: Build example for Android 104 | env: 105 | JAVA_OPTS: "-XX:MaxHeapSize=6g" 106 | run: | 107 | yarn turbo run build:android --cache-dir="${{ env.TURBO_CACHE_DIR }}" 108 | 109 | build-ios: 110 | runs-on: macos-latest 111 | env: 112 | TURBO_CACHE_DIR: .turbo/ios 113 | steps: 114 | - name: Checkout 115 | uses: actions/checkout@v4 116 | 117 | - name: Setup 118 | uses: ./.github/actions/setup 119 | 120 | - name: Cache turborepo for iOS 121 | uses: actions/cache@v4 122 | with: 123 | path: ${{ env.TURBO_CACHE_DIR }} 124 | key: ${{ runner.os }}-turborepo-ios-${{ hashFiles('yarn.lock') }} 125 | restore-keys: | 126 | ${{ runner.os }}-turborepo-ios- 127 | 128 | - name: Check turborepo cache for iOS 129 | run: | 130 | TURBO_CACHE_STATUS=$(node -p "($(yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" --dry=json)).tasks.find(t => t.task === 'build:ios').cache.status") 131 | 132 | if [[ $TURBO_CACHE_STATUS == "HIT" ]]; then 133 | echo "turbo_cache_hit=1" >> $GITHUB_ENV 134 | fi 135 | 136 | - name: Restore cocoapods 137 | if: env.turbo_cache_hit != 1 138 | id: cocoapods-cache 139 | uses: actions/cache/restore@v4 140 | with: 141 | path: | 142 | **/ios/Pods 143 | key: ${{ runner.os }}-cocoapods-${{ hashFiles('example/ios/Podfile.lock') }} 144 | restore-keys: | 145 | ${{ runner.os }}-cocoapods- 146 | 147 | - name: Install cocoapods 148 | if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true' 149 | run: | 150 | cd example/ios 151 | pod install 152 | env: 153 | NO_FLIPPER: 1 154 | 155 | - name: Cache cocoapods 156 | if: env.turbo_cache_hit != 1 && steps.cocoapods-cache.outputs.cache-hit != 'true' 157 | uses: actions/cache/save@v4 158 | with: 159 | path: | 160 | **/ios/Pods 161 | key: ${{ steps.cocoapods-cache.outputs.cache-key }} 162 | 163 | - name: Build example for iOS 164 | run: | 165 | yarn turbo run build:ios --cache-dir="${{ env.TURBO_CACHE_DIR }}" 166 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # XDE 6 | .expo/ 7 | 8 | # VSCode 9 | .vscode/ 10 | jsconfig.json 11 | 12 | # Xcode 13 | # 14 | build/ 15 | *.pbxuser 16 | !default.pbxuser 17 | *.mode1v3 18 | !default.mode1v3 19 | *.mode2v3 20 | !default.mode2v3 21 | *.perspectivev3 22 | !default.perspectivev3 23 | xcuserdata 24 | *.xccheckout 25 | *.moved-aside 26 | DerivedData 27 | *.hmap 28 | *.ipa 29 | *.xcuserstate 30 | project.xcworkspace 31 | **/.xcode.env.local 32 | 33 | # Android/IJ 34 | # 35 | .classpath 36 | .cxx 37 | .gradle 38 | .idea 39 | .project 40 | .settings 41 | local.properties 42 | android.iml 43 | 44 | # Cocoapods 45 | # 46 | example/ios/Pods 47 | 48 | # Ruby 49 | example/vendor/ 50 | 51 | # node.js 52 | # 53 | node_modules/ 54 | npm-debug.log 55 | yarn-debug.log 56 | yarn-error.log 57 | 58 | # BUCK 59 | buck-out/ 60 | \.buckd/ 61 | android/app/libs 62 | android/keystores/debug.keystore 63 | 64 | # Yarn 65 | .yarn/* 66 | !.yarn/patches 67 | !.yarn/plugins 68 | !.yarn/releases 69 | !.yarn/sdks 70 | !.yarn/versions 71 | 72 | # Expo 73 | .expo/ 74 | 75 | # Turborepo 76 | .turbo/ 77 | 78 | # generated by bob 79 | lib/ 80 | 81 | # React Native Codegen 82 | ios/generated 83 | android/generated 84 | 85 | # React Native Nitro Modules 86 | nitrogen/ 87 | -------------------------------------------------------------------------------- /.nvmrc: -------------------------------------------------------------------------------- 1 | v20 2 | -------------------------------------------------------------------------------- /.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /.yarnrc.yml: -------------------------------------------------------------------------------- 1 | nodeLinker: node-modules 2 | nmHoistingLimits: workspaces 3 | 4 | plugins: 5 | - path: .yarn/plugins/@yarnpkg/plugin-interactive-tools.cjs 6 | spec: "@yarnpkg/plugin-interactive-tools" 7 | - path: .yarn/plugins/@yarnpkg/plugin-workspace-tools.cjs 8 | spec: "@yarnpkg/plugin-workspace-tools" 9 | 10 | yarnPath: .yarn/releases/yarn-3.6.1.cjs 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2025 Mhpdev 4 | Permission is hereby granted, free of charge, to any person obtaining a copy 5 | of this software and associated documentation files (the "Software"), to deal 6 | in the Software without restriction, including without limitation the rights 7 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 8 | copies of the Software, and to permit persons to whom the Software is 9 | furnished to do so, subject to the following conditions: 10 | 11 | The above copyright notice and this permission notice shall be included in all 12 | copies or substantial portions of the Software. 13 | 14 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 17 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 18 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 19 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 20 | SOFTWARE. 21 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-native-speech 2 | 3 | A high-performance text-to-speech library built for bare React Native and Expo, compatible with Android and iOS. It enables seamless speech management and provides events for detailed synthesis management. 4 | 5 |
6 | Documentation · Example 7 |
8 |
9 | 10 | > **Only New Architecture**: This library is currently compatible with the new architecture. If you're using React Native 0.76 or higher, it is already enabled. However, if your React Native version is between 0.68 and 0.75, you need to enable it first. [Click here if you need help enabling the new architecture](https://github.com/reactwg/react-native-new-architecture/blob/main/docs/enable-apps.md) 11 | 12 | ## Preview 13 | 14 | |
Android
|
iOS
| 15 | | :-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------: | 16 | | [Android Preview](https://github.com/user-attachments/assets/0601b827-a87a-4eb0-be28-273aa2ec5942) | [iOS Preview](https://github.com/user-attachments/assets/1579639e-049b-42f4-9795-bc56956541bd) | 17 | 18 | ## Features 19 | 20 | - 🚀 High-performance library created with Turbo Modules for both Android and iOS 21 | 22 | - 🎛️ Provides essential and useful methods for full control over synthesis 23 | 24 | - 😎 Support for `pause` and `resume`, along with `onResume` and `onPause` events, for Android too (On Android, unlike iOS—which does not natively support these features—this library implements its own handling) 25 | 26 | - 🖍️ Provides a customizable [HighlightedText](./docs/USAGE.md#highlightedtext) component to display the currently spoken text 27 | 28 | - 📡 Offers useful events for more precise control over synthesis 29 | 30 | - ✅ Completely type-safe and written in TypeScript (on the React Native side) 31 | 32 | ## Installation 33 | 34 | ### Bare React Native 35 | 36 | Install the package using either npm or Yarn: 37 | 38 | ```sh 39 | npm install @mhpdev/react-native-speech 40 | ``` 41 | 42 | Or with Yarn: 43 | 44 | ```sh 45 | yarn add @mhpdev/react-native-speech 46 | ``` 47 | 48 | ### Expo 49 | 50 | For Expo projects, follow these steps: 51 | 52 | 1. Install the package: 53 | 54 | ```sh 55 | npx expo install @mhpdev/react-native-speech 56 | ``` 57 | 58 | 2. Since it is not supported on Expo Go, run: 59 | 60 | ```sh 61 | npx expo prebuild 62 | ``` 63 | 64 | ## Usage 65 | 66 | To learn how to use the library, check out the [usage section](./docs/USAGE.md). 67 | 68 | ## Quick Start 69 | 70 | ```tsx 71 | import React from 'react'; 72 | import Speech from '@mhpdev/react-native-speech'; 73 | import {SafeAreaView, StyleSheet, Text, TouchableOpacity} from 'react-native'; 74 | 75 | const App: React.FC = () => { 76 | const onSpeakPress = () => { 77 | Speech.speak('Hello World!'); 78 | }; 79 | 80 | return ( 81 | 82 | 83 | Speak 84 | 85 | 86 | ); 87 | }; 88 | 89 | export default App; 90 | 91 | const styles = StyleSheet.create({ 92 | container: { 93 | flex: 1, 94 | alignItems: 'center', 95 | justifyContent: 'center', 96 | }, 97 | button: { 98 | padding: 12.5, 99 | borderRadius: 5, 100 | backgroundColor: 'skyblue', 101 | }, 102 | buttonText: { 103 | fontSize: 22, 104 | fontWeight: '600', 105 | }, 106 | }); 107 | ``` 108 | 109 | To become more familiar with the usage of the library, check out the [example project](./example/). 110 | 111 | ## Contributing 112 | 113 | See the [contributing guide](./docs/CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow. 114 | 115 | ## License 116 | 117 | MIT 118 | -------------------------------------------------------------------------------- /Speech.podspec: -------------------------------------------------------------------------------- 1 | require "json" 2 | 3 | package = JSON.parse(File.read(File.join(__dir__, "package.json"))) 4 | folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32' 5 | 6 | Pod::Spec.new do |s| 7 | s.name = "Speech" 8 | s.version = package["version"] 9 | s.summary = package["description"] 10 | s.homepage = package["homepage"] 11 | s.license = package["license"] 12 | s.authors = package["author"] 13 | 14 | s.platforms = { :ios => min_ios_version_supported } 15 | s.source = { :git => "https://github.com/mhpdev-com/react-native-speech.git", :tag => "#{s.version}" } 16 | 17 | s.source_files = "ios/**/*.{h,m,mm,cpp}" 18 | s.private_header_files = "ios/generated/**/*.h" 19 | 20 | # Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0. 21 | # See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79. 22 | if respond_to?(:install_modules_dependencies, true) 23 | install_modules_dependencies(s) 24 | else 25 | s.dependency "React-Core" 26 | 27 | # Don't install the dependencies when we run `pod install` in the old architecture. 28 | if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then 29 | s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1" 30 | s.pod_target_xcconfig = { 31 | "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"", 32 | "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1", 33 | "CLANG_CXX_LANGUAGE_STANDARD" => "c++17" 34 | } 35 | s.dependency "React-Codegen" 36 | s.dependency "RCT-Folly" 37 | s.dependency "RCTRequired" 38 | s.dependency "RCTTypeSafety" 39 | s.dependency "ReactCommon/turbomodule/core" 40 | end 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext.getExtOrDefault = {name -> 3 | return rootProject.ext.has(name) ? rootProject.ext.get(name) : project.properties['Speech_' + name] 4 | } 5 | 6 | repositories { 7 | google() 8 | mavenCentral() 9 | } 10 | 11 | dependencies { 12 | classpath "com.android.tools.build:gradle:8.7.2" 13 | // noinspection DifferentKotlinGradleVersion 14 | classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:${getExtOrDefault('kotlinVersion')}" 15 | } 16 | } 17 | 18 | 19 | def isNewArchitectureEnabled() { 20 | return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true" 21 | } 22 | 23 | apply plugin: "com.android.library" 24 | apply plugin: "kotlin-android" 25 | 26 | if (isNewArchitectureEnabled()) { 27 | apply plugin: "com.facebook.react" 28 | } 29 | 30 | def getExtOrIntegerDefault(name) { 31 | return rootProject.ext.has(name) ? rootProject.ext.get(name) : (project.properties["Speech_" + name]).toInteger() 32 | } 33 | 34 | def supportsNamespace() { 35 | def parsed = com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION.tokenize('.') 36 | def major = parsed[0].toInteger() 37 | def minor = parsed[1].toInteger() 38 | 39 | // Namespace support was added in 7.3.0 40 | return (major == 7 && minor >= 3) || major >= 8 41 | } 42 | 43 | android { 44 | if (supportsNamespace()) { 45 | namespace "com.speech" 46 | 47 | sourceSets { 48 | main { 49 | manifest.srcFile "src/main/AndroidManifestNew.xml" 50 | } 51 | } 52 | } 53 | 54 | compileSdkVersion getExtOrIntegerDefault("compileSdkVersion") 55 | 56 | defaultConfig { 57 | minSdkVersion getExtOrIntegerDefault("minSdkVersion") 58 | targetSdkVersion getExtOrIntegerDefault("targetSdkVersion") 59 | buildConfigField "boolean", "IS_NEW_ARCHITECTURE_ENABLED", isNewArchitectureEnabled().toString() 60 | } 61 | 62 | buildFeatures { 63 | buildConfig true 64 | } 65 | 66 | buildTypes { 67 | release { 68 | minifyEnabled false 69 | } 70 | } 71 | 72 | lintOptions { 73 | disable "GradleCompatible" 74 | } 75 | 76 | compileOptions { 77 | sourceCompatibility JavaVersion.VERSION_1_8 78 | targetCompatibility JavaVersion.VERSION_1_8 79 | } 80 | 81 | sourceSets { 82 | main { 83 | if (isNewArchitectureEnabled()) { 84 | java.srcDirs += [ 85 | "generated/java", 86 | "generated/jni" 87 | ] 88 | } 89 | } 90 | } 91 | } 92 | 93 | repositories { 94 | mavenCentral() 95 | google() 96 | } 97 | 98 | def kotlin_version = getExtOrDefault("kotlinVersion") 99 | 100 | dependencies { 101 | implementation "com.facebook.react:react-android" 102 | implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" 103 | } 104 | 105 | if (isNewArchitectureEnabled()) { 106 | react { 107 | jsRootDir = file("../src/") 108 | libraryName = "Speech" 109 | codegenJavaPackageName = "com.speech" 110 | } 111 | } 112 | -------------------------------------------------------------------------------- /android/gradle.properties: -------------------------------------------------------------------------------- 1 | Speech_kotlinVersion=2.0.21 2 | Speech_minSdkVersion=24 3 | Speech_targetSdkVersion=34 4 | Speech_compileSdkVersion=35 5 | Speech_ndkVersion=27.1.12297006 6 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | -------------------------------------------------------------------------------- /android/src/main/AndroidManifestNew.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | -------------------------------------------------------------------------------- /android/src/main/java/com/speech/SpeechModule.kt: -------------------------------------------------------------------------------- 1 | package com.speech 2 | 3 | import java.util.UUID 4 | import java.util.Locale 5 | import android.os.Build 6 | import android.os.Bundle 7 | import android.speech.tts.Voice 8 | import android.annotation.SuppressLint 9 | import android.speech.tts.TextToSpeech 10 | import com.facebook.react.bridge.Promise 11 | import com.facebook.react.bridge.Arguments 12 | import com.facebook.react.bridge.WritableMap 13 | import com.facebook.react.bridge.ReadableMap 14 | import android.speech.tts.UtteranceProgressListener 15 | import com.facebook.react.bridge.ReactApplicationContext 16 | import com.facebook.react.module.annotations.ReactModule 17 | 18 | @ReactModule(name = SpeechModule.NAME) 19 | class SpeechModule(reactContext: ReactApplicationContext) : 20 | NativeSpeechSpec(reactContext) { 21 | 22 | override fun getName(): String { 23 | return NAME 24 | } 25 | 26 | companion object { 27 | const val NAME = "Speech" 28 | 29 | @SuppressLint("ConstantLocale") 30 | private val defaultOptions: Map = mapOf( 31 | "rate" to 0.5f, 32 | "pitch" to 1.0f, 33 | "volume" to 1.0f, 34 | "language" to Locale.getDefault().toLanguageTag() 35 | ) 36 | } 37 | private val queueLock = Any() 38 | 39 | private val isSupportedPausing = Build.VERSION.SDK_INT >= Build.VERSION_CODES.O 40 | 41 | private lateinit var synthesizer: TextToSpeech 42 | 43 | private var isInitialized = false 44 | private var isInitializing = false 45 | private val pendingOperations = mutableListOf Unit, Promise>>() 46 | 47 | private var globalOptions: MutableMap = defaultOptions.toMutableMap() 48 | 49 | private var isPaused = false 50 | private var isResuming = false 51 | private var currentQueueIndex = -1 52 | private val speechQueue = mutableListOf() 53 | 54 | init { 55 | initializeTTS() 56 | } 57 | 58 | private fun processPendingOperations() { 59 | val operations = ArrayList(pendingOperations) 60 | pendingOperations.clear() 61 | for ((operation, promise) in operations) { 62 | try { 63 | operation() 64 | } catch (e: Exception) { 65 | promise.reject("speech_error", e.message ?: "Unknown error") 66 | } 67 | } 68 | } 69 | 70 | private fun rejectPendingOperations() { 71 | val operations = ArrayList(pendingOperations) 72 | pendingOperations.clear() 73 | for ((_, promise) in operations) { 74 | promise.reject("speech_error", "Failed to initialize TTS engine") 75 | } 76 | } 77 | 78 | private fun getSpeechParams(): Bundle { 79 | val params = Bundle() 80 | val volume = (globalOptions["volume"] as? Number)?.toFloat() ?: 1.0f 81 | params.putFloat(TextToSpeech.Engine.KEY_PARAM_VOLUME, volume) 82 | return params 83 | } 84 | 85 | private fun getEventData(utteranceId: String): WritableMap { 86 | return Arguments.createMap().apply { 87 | putInt("id", utteranceId.hashCode()) 88 | } 89 | } 90 | 91 | private fun getVoiceItem(voice: Voice): ReadableMap { 92 | val quality = if (voice.quality > Voice.QUALITY_NORMAL) "Enhanced" else "Default" 93 | return Arguments.createMap().apply { 94 | putString("quality", quality) 95 | putString("name", voice.name) 96 | putString("identifier", voice.name) 97 | putString("language", voice.locale.toLanguageTag()) 98 | } 99 | } 100 | 101 | private fun getUniqueID(): String { 102 | return UUID.randomUUID().toString() 103 | } 104 | 105 | private fun resetQueueState() { 106 | synchronized(queueLock) { 107 | speechQueue.clear() 108 | currentQueueIndex = -1 109 | isPaused = false 110 | isResuming = false 111 | } 112 | } 113 | 114 | private fun initializeTTS() { 115 | if (isInitializing) return 116 | isInitializing = true 117 | 118 | synthesizer = TextToSpeech(reactApplicationContext) { status -> 119 | isInitialized = status == TextToSpeech.SUCCESS 120 | isInitializing = false 121 | 122 | if (isInitialized) { 123 | synthesizer.setOnUtteranceProgressListener(object : UtteranceProgressListener() { 124 | override fun onStart(utteranceId: String) { 125 | synchronized(queueLock) { 126 | speechQueue.find { it.utteranceId == utteranceId }?.let { item -> 127 | item.status = SpeechStatus.SPEAKING 128 | if (isResuming && item.position > 0) { 129 | emitOnResume(getEventData(utteranceId)) 130 | isResuming = false 131 | } else { 132 | emitOnStart(getEventData(utteranceId)) 133 | } 134 | } 135 | } 136 | } 137 | override fun onDone(utteranceId: String) { 138 | synchronized(queueLock) { 139 | speechQueue.find { it.utteranceId == utteranceId }?.let { item -> 140 | item.status = SpeechStatus.COMPLETED 141 | emitOnFinish(getEventData(utteranceId)) 142 | if (!isPaused) { 143 | currentQueueIndex++ 144 | processNextQueueItem() 145 | } 146 | } 147 | } 148 | } 149 | override fun onError(utteranceId: String) { 150 | synchronized(queueLock) { 151 | speechQueue.find { it.utteranceId == utteranceId }?.let { item -> 152 | item.status = SpeechStatus.ERROR 153 | emitOnError(getEventData(utteranceId)) 154 | if (!isPaused) { 155 | currentQueueIndex++ 156 | processNextQueueItem() 157 | } 158 | } 159 | } 160 | } 161 | override fun onStop(utteranceId: String, interrupted: Boolean) { 162 | synchronized(queueLock) { 163 | speechQueue.find { it.utteranceId == utteranceId }?.let { item -> 164 | if (isPaused) { 165 | item.status = SpeechStatus.PAUSED 166 | emitOnPause(getEventData(utteranceId)) 167 | } else { 168 | item.status = SpeechStatus.COMPLETED 169 | emitOnStopped(getEventData(utteranceId)) 170 | } 171 | } 172 | } 173 | } 174 | override fun onRangeStart(utteranceId: String, start: Int, end: Int, frame: Int) { 175 | synchronized(queueLock) { 176 | speechQueue.find { it.utteranceId == utteranceId }?.let { item -> 177 | item.position = item.offset + start 178 | val data = getEventData(utteranceId).apply { 179 | putInt("length", end - start) 180 | putInt("location", item.position) 181 | } 182 | emitOnProgress(data) 183 | } 184 | } 185 | } 186 | }) 187 | applyGlobalOptions() 188 | processPendingOperations() 189 | } else { 190 | rejectPendingOperations() 191 | } 192 | } 193 | } 194 | 195 | private fun ensureInitialized(promise: Promise, operation: () -> Unit) { 196 | when { 197 | isInitialized -> { 198 | try { 199 | operation() 200 | } catch (e: Exception) { 201 | promise.reject("speech_error", e.message ?: "Unknown error") 202 | } 203 | } 204 | isInitializing -> { 205 | pendingOperations.add(Pair(operation, promise)) 206 | } 207 | else -> { 208 | pendingOperations.add(Pair(operation, promise)) 209 | initializeTTS() 210 | } 211 | } 212 | } 213 | 214 | private fun applyGlobalOptions() { 215 | globalOptions["language"]?.let { 216 | val locale = Locale.forLanguageTag(it as String) 217 | synthesizer.setLanguage(locale) 218 | } 219 | globalOptions["pitch"]?.let { 220 | synthesizer.setPitch(it as Float) 221 | } 222 | globalOptions["rate"]?.let { 223 | synthesizer.setSpeechRate(it as Float) 224 | } 225 | globalOptions["voice"]?.let { voiceId -> 226 | synthesizer.voices?.forEach { voice -> 227 | if (voice.name == voiceId) { 228 | synthesizer.setVoice(voice) 229 | return@forEach 230 | } 231 | } 232 | } 233 | } 234 | 235 | private fun applyOptions(options: Map) { 236 | val tempOptions = globalOptions.toMutableMap().apply { 237 | putAll(options) 238 | } 239 | tempOptions["language"]?.let { 240 | val locale = Locale.forLanguageTag(it as String) 241 | synthesizer.setLanguage(locale) 242 | } 243 | tempOptions["pitch"]?.let { 244 | synthesizer.setPitch(it as Float) 245 | } 246 | tempOptions["rate"]?.let { 247 | synthesizer.setSpeechRate(it as Float) 248 | } 249 | tempOptions["voice"]?.let { voiceId -> 250 | synthesizer.voices?.forEach { voice -> 251 | if (voice.name == voiceId) { 252 | synthesizer.setVoice(voice) 253 | return@forEach 254 | } 255 | } 256 | } 257 | } 258 | 259 | private fun getValidatedOptions(options: ReadableMap): Map { 260 | val validated = mutableMapOf() 261 | if (options.hasKey("voice")) { 262 | validated["voice"] = options.getString("voice") ?: "" 263 | } 264 | if (options.hasKey("language")) { 265 | validated["language"] = options.getString("language") 266 | ?: Locale.getDefault().toLanguageTag() 267 | } 268 | if (options.hasKey("pitch")) { 269 | validated["pitch"] = options.getDouble("pitch").toFloat().coerceIn(0.1f, 2.0f) 270 | } 271 | if (options.hasKey("volume")) { 272 | validated["volume"] = options.getDouble("volume").toFloat().coerceIn(0f, 1.0f) 273 | } 274 | if (options.hasKey("rate")) { 275 | validated["rate"] = options.getDouble("rate").toFloat().coerceIn(0.1f, 2.0f) 276 | } 277 | return validated 278 | } 279 | 280 | private fun processNextQueueItem() { 281 | synchronized(queueLock) { 282 | if (isPaused) return 283 | 284 | if (currentQueueIndex in 0 until speechQueue.size) { 285 | val item = speechQueue[currentQueueIndex] 286 | if (item.status == SpeechStatus.PENDING || item.status == SpeechStatus.PAUSED) { 287 | applyOptions(item.options) 288 | val params = getSpeechParams() 289 | val textToSpeak: String 290 | 291 | if (item.status == SpeechStatus.PAUSED) { 292 | item.offset = item.position 293 | textToSpeak = item.text.substring(item.offset) 294 | isResuming = true 295 | } else { 296 | item.offset = 0 297 | textToSpeak = item.text 298 | } 299 | val queueMode = if (isResuming) TextToSpeech.QUEUE_FLUSH else TextToSpeech.QUEUE_ADD 300 | synthesizer.speak(textToSpeak, queueMode, params, item.utteranceId) 301 | 302 | if (currentQueueIndex == speechQueue.size - 1) { 303 | applyGlobalOptions() 304 | } 305 | } else { 306 | currentQueueIndex++ 307 | processNextQueueItem() 308 | } 309 | } else { 310 | currentQueueIndex = -1 311 | applyGlobalOptions() 312 | } 313 | } 314 | } 315 | 316 | override fun initialize(options: ReadableMap) { 317 | val newOptions = globalOptions.toMutableMap() 318 | newOptions.putAll(getValidatedOptions(options)) 319 | globalOptions = newOptions 320 | applyGlobalOptions() 321 | } 322 | 323 | override fun reset() { 324 | globalOptions = defaultOptions.toMutableMap() 325 | applyGlobalOptions() 326 | } 327 | 328 | override fun getAvailableVoices(language: String?, promise: Promise) { 329 | ensureInitialized(promise) { 330 | val voicesArray = Arguments.createArray() 331 | val voices = synthesizer.voices 332 | 333 | if (voices == null) { 334 | promise.resolve(voicesArray) 335 | return@ensureInitialized 336 | } 337 | if (language != null) { 338 | val lowercaseLanguage = language.lowercase() 339 | voices.forEach { voice -> 340 | val voiceLanguage = voice.locale.toLanguageTag().lowercase() 341 | if (voiceLanguage.startsWith(lowercaseLanguage)) { 342 | voicesArray.pushMap(getVoiceItem(voice)) 343 | } 344 | } 345 | } else { 346 | voices.forEach { voice -> 347 | voicesArray.pushMap(getVoiceItem(voice)) 348 | } 349 | } 350 | promise.resolve(voicesArray) 351 | } 352 | } 353 | 354 | override fun isSpeaking(promise: Promise) { 355 | ensureInitialized(promise) { 356 | promise.resolve(synthesizer.isSpeaking || isPaused) 357 | } 358 | } 359 | 360 | override fun stop(promise: Promise) { 361 | ensureInitialized(promise) { 362 | if (synthesizer.isSpeaking || isPaused) { 363 | synthesizer.stop() 364 | synchronized(queueLock) { 365 | if (currentQueueIndex in speechQueue.indices) { 366 | val item = speechQueue[currentQueueIndex] 367 | emitOnStopped(getEventData(item.utteranceId)) 368 | } 369 | resetQueueState() 370 | } 371 | } 372 | promise.resolve(null) 373 | } 374 | } 375 | 376 | override fun pause(promise: Promise) { 377 | ensureInitialized(promise) { 378 | if (!isSupportedPausing || isPaused || !synthesizer.isSpeaking || speechQueue.isEmpty()) { 379 | promise.resolve(false) 380 | } else { 381 | isPaused = true 382 | synthesizer.stop() 383 | promise.resolve(true) 384 | } 385 | } 386 | } 387 | 388 | override fun resume(promise: Promise) { 389 | ensureInitialized(promise) { 390 | if (!isSupportedPausing || !isPaused || speechQueue.isEmpty() || currentQueueIndex < 0) { 391 | promise.resolve(false) 392 | return@ensureInitialized 393 | } 394 | synchronized(queueLock) { 395 | val pausedItemIndex = speechQueue.indexOfFirst { it.status == SpeechStatus.PAUSED } 396 | if (pausedItemIndex >= 0) { 397 | currentQueueIndex = pausedItemIndex 398 | isPaused = false 399 | processNextQueueItem() 400 | promise.resolve(true) 401 | } else { 402 | isPaused = false 403 | promise.resolve(false) 404 | } 405 | } 406 | } 407 | } 408 | 409 | override fun speak(text: String?, promise: Promise) { 410 | if (text == null) { 411 | promise.reject("speech_error", "Text cannot be null") 412 | return 413 | } 414 | ensureInitialized(promise) { 415 | val utteranceId = getUniqueID() 416 | val queueItem = SpeechQueueItem(text = text, options = emptyMap(), utteranceId = utteranceId) 417 | synchronized(queueLock) { 418 | speechQueue.add(queueItem) 419 | if (!synthesizer.isSpeaking && !isPaused) { 420 | currentQueueIndex = speechQueue.size - 1 421 | processNextQueueItem() 422 | } 423 | } 424 | promise.resolve(null) 425 | } 426 | } 427 | 428 | override fun speakWithOptions(text: String?, options: ReadableMap, promise: Promise) { 429 | if (text == null) { 430 | promise.reject("speech_error", "Text cannot be null") 431 | return 432 | } 433 | ensureInitialized(promise) { 434 | val utteranceId = getUniqueID() 435 | val validatedOptions = getValidatedOptions(options) 436 | val queueItem = SpeechQueueItem(text = text, options = validatedOptions, utteranceId = utteranceId) 437 | synchronized(queueLock) { 438 | speechQueue.add(queueItem) 439 | if (!synthesizer.isSpeaking && !isPaused) { 440 | currentQueueIndex = speechQueue.size - 1 441 | processNextQueueItem() 442 | } 443 | } 444 | promise.resolve(null) 445 | } 446 | } 447 | 448 | override fun invalidate() { 449 | super.invalidate() 450 | if (::synthesizer.isInitialized) { 451 | synthesizer.stop() 452 | synthesizer.shutdown() 453 | resetQueueState() 454 | } 455 | } 456 | } 457 | -------------------------------------------------------------------------------- /android/src/main/java/com/speech/SpeechPackage.kt: -------------------------------------------------------------------------------- 1 | package com.speech 2 | 3 | import com.facebook.react.BaseReactPackage 4 | import com.facebook.react.bridge.NativeModule 5 | import com.facebook.react.bridge.ReactApplicationContext 6 | import com.facebook.react.module.model.ReactModuleInfo 7 | import com.facebook.react.module.model.ReactModuleInfoProvider 8 | import java.util.HashMap 9 | 10 | class SpeechPackage : BaseReactPackage() { 11 | override fun getModule(name: String, reactContext: ReactApplicationContext): NativeModule? { 12 | return if (name == SpeechModule.NAME) { 13 | SpeechModule(reactContext) 14 | } else { 15 | null 16 | } 17 | } 18 | 19 | override fun getReactModuleInfoProvider(): ReactModuleInfoProvider { 20 | return ReactModuleInfoProvider { 21 | val moduleInfos: MutableMap = HashMap() 22 | moduleInfos[SpeechModule.NAME] = ReactModuleInfo( 23 | SpeechModule.NAME, 24 | SpeechModule.NAME, 25 | false, // canOverrideExistingModule 26 | false, // needsEagerInit 27 | false, // isCxxModule 28 | true // isTurboModule 29 | ) 30 | moduleInfos 31 | } 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /android/src/main/java/com/speech/SpeechUtils.kt: -------------------------------------------------------------------------------- 1 | package com.speech 2 | 3 | data class SpeechQueueItem( 4 | val text: String, 5 | val options: Map, 6 | val utteranceId: String, 7 | var position: Int = 0, 8 | var offset: Int = 0, 9 | var status: SpeechStatus = SpeechStatus.PENDING 10 | ) 11 | 12 | enum class SpeechStatus { 13 | PENDING, 14 | SPEAKING, 15 | PAUSED, 16 | COMPLETED, 17 | ERROR 18 | } -------------------------------------------------------------------------------- /babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:react-native-builder-bob/babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /docs/CODE_OF_CONDUCT.md: -------------------------------------------------------------------------------- 1 | 2 | # Contributor Covenant Code of Conduct 3 | 4 | ## Our Pledge 5 | 6 | We as members, contributors, and leaders pledge to make participation in our 7 | community a harassment-free experience for everyone, regardless of age, body 8 | size, visible or invisible disability, ethnicity, sex characteristics, gender 9 | identity and expression, level of experience, education, socio-economic status, 10 | nationality, personal appearance, race, caste, color, religion, or sexual 11 | identity and orientation. 12 | 13 | We pledge to act and interact in ways that contribute to an open, welcoming, 14 | diverse, inclusive, and healthy community. 15 | 16 | ## Our Standards 17 | 18 | Examples of behavior that contributes to a positive environment for our 19 | community include: 20 | 21 | * Demonstrating empathy and kindness toward other people 22 | * Being respectful of differing opinions, viewpoints, and experiences 23 | * Giving and gracefully accepting constructive feedback 24 | * Accepting responsibility and apologizing to those affected by our mistakes, 25 | and learning from the experience 26 | * Focusing on what is best not just for us as individuals, but for the overall 27 | community 28 | 29 | Examples of unacceptable behavior include: 30 | 31 | * The use of sexualized language or imagery, and sexual attention or advances of 32 | any kind 33 | * Trolling, insulting or derogatory comments, and personal or political attacks 34 | * Public or private harassment 35 | * Publishing others' private information, such as a physical or email address, 36 | without their explicit permission 37 | * Other conduct which could reasonably be considered inappropriate in a 38 | professional setting 39 | 40 | ## Enforcement Responsibilities 41 | 42 | Community leaders are responsible for clarifying and enforcing our standards of 43 | acceptable behavior and will take appropriate and fair corrective action in 44 | response to any behavior that they deem inappropriate, threatening, offensive, 45 | or harmful. 46 | 47 | Community leaders have the right and responsibility to remove, edit, or reject 48 | comments, commits, code, wiki edits, issues, and other contributions that are 49 | not aligned to this Code of Conduct, and will communicate reasons for moderation 50 | decisions when appropriate. 51 | 52 | ## Scope 53 | 54 | This Code of Conduct applies within all community spaces, and also applies when 55 | an individual is officially representing the community in public spaces. 56 | Examples of representing our community include using an official e-mail address, 57 | posting via an official social media account, or acting as an appointed 58 | representative at an online or offline event. 59 | 60 | ## Enforcement 61 | 62 | Instances of abusive, harassing, or otherwise unacceptable behavior may be 63 | reported to the community leaders responsible for enforcement at 64 | [INSERT CONTACT METHOD]. 65 | All complaints will be reviewed and investigated promptly and fairly. 66 | 67 | All community leaders are obligated to respect the privacy and security of the 68 | reporter of any incident. 69 | 70 | ## Enforcement Guidelines 71 | 72 | Community leaders will follow these Community Impact Guidelines in determining 73 | the consequences for any action they deem in violation of this Code of Conduct: 74 | 75 | ### 1. Correction 76 | 77 | **Community Impact**: Use of inappropriate language or other behavior deemed 78 | unprofessional or unwelcome in the community. 79 | 80 | **Consequence**: A private, written warning from community leaders, providing 81 | clarity around the nature of the violation and an explanation of why the 82 | behavior was inappropriate. A public apology may be requested. 83 | 84 | ### 2. Warning 85 | 86 | **Community Impact**: A violation through a single incident or series of 87 | actions. 88 | 89 | **Consequence**: A warning with consequences for continued behavior. No 90 | interaction with the people involved, including unsolicited interaction with 91 | those enforcing the Code of Conduct, for a specified period of time. This 92 | includes avoiding interactions in community spaces as well as external channels 93 | like social media. Violating these terms may lead to a temporary or permanent 94 | ban. 95 | 96 | ### 3. Temporary Ban 97 | 98 | **Community Impact**: A serious violation of community standards, including 99 | sustained inappropriate behavior. 100 | 101 | **Consequence**: A temporary ban from any sort of interaction or public 102 | communication with the community for a specified period of time. No public or 103 | private interaction with the people involved, including unsolicited interaction 104 | with those enforcing the Code of Conduct, is allowed during this period. 105 | Violating these terms may lead to a permanent ban. 106 | 107 | ### 4. Permanent Ban 108 | 109 | **Community Impact**: Demonstrating a pattern of violation of community 110 | standards, including sustained inappropriate behavior, harassment of an 111 | individual, or aggression toward or disparagement of classes of individuals. 112 | 113 | **Consequence**: A permanent ban from any sort of public interaction within the 114 | community. 115 | 116 | ## Attribution 117 | 118 | This Code of Conduct is adapted from the [Contributor Covenant][homepage], 119 | version 2.1, available at 120 | [https://www.contributor-covenant.org/version/2/1/code_of_conduct.html][v2.1]. 121 | 122 | Community Impact Guidelines were inspired by 123 | [Mozilla's code of conduct enforcement ladder][Mozilla CoC]. 124 | 125 | For answers to common questions about this code of conduct, see the FAQ at 126 | [https://www.contributor-covenant.org/faq][FAQ]. Translations are available at 127 | [https://www.contributor-covenant.org/translations][translations]. 128 | 129 | [homepage]: https://www.contributor-covenant.org 130 | [v2.1]: https://www.contributor-covenant.org/version/2/1/code_of_conduct.html 131 | [Mozilla CoC]: https://github.com/mozilla/diversity 132 | [FAQ]: https://www.contributor-covenant.org/faq 133 | [translations]: https://www.contributor-covenant.org/translations 134 | -------------------------------------------------------------------------------- /docs/CONTRIBUTING.md: -------------------------------------------------------------------------------- 1 | # Contributing 2 | 3 | Contributions are always welcome, no matter how large or small! 4 | 5 | We want this community to be friendly and respectful to each other. Please follow it in all your interactions with the project. Before contributing, please read the [code of conduct](./docs/CODE_OF_CONDUCT.md). 6 | 7 | ## Development workflow 8 | 9 | This project is a monorepo managed using [Yarn workspaces](https://yarnpkg.com/features/workspaces). It contains the following packages: 10 | 11 | - The library package in the root directory. 12 | - An example app in the `example/` directory. 13 | 14 | To get started with the project, run `yarn` in the root directory to install the required dependencies for each package: 15 | 16 | ```sh 17 | yarn 18 | ``` 19 | 20 | > Since the project relies on Yarn workspaces, you cannot use [`npm`](https://github.com/npm/cli) for development. 21 | 22 | The [example app](/example/) demonstrates usage of the library. You need to run it to test any changes you make. 23 | 24 | It is configured to use the local version of the library, so any changes you make to the library's source code will be reflected in the example app. Changes to the library's JavaScript code will be reflected in the example app without a rebuild, but native code changes will require a rebuild of the example app. 25 | 26 | If you want to use Android Studio or XCode to edit the native code, you can open the `example/android` or `example/ios` directories respectively in those editors. To edit the Objective-C or Swift files, open `example/ios/SpeechExample.xcworkspace` in XCode and find the source files at `Pods > Development Pods > react-native-speech`. 27 | 28 | To edit the Java or Kotlin files, open `example/android` in Android studio and find the source files at `react-native-speech` under `Android`. 29 | 30 | You can use various commands from the root directory to work with the project. 31 | 32 | To start the packager: 33 | 34 | ```sh 35 | yarn example start 36 | ``` 37 | 38 | To run the example app on Android: 39 | 40 | ```sh 41 | yarn example android 42 | ``` 43 | 44 | To run the example app on iOS: 45 | 46 | ```sh 47 | yarn example ios 48 | ``` 49 | 50 | To confirm that the app is running with the new architecture, you can check the Metro logs for a message like this: 51 | 52 | ```sh 53 | Running "SpeechExample" with {"fabric":true,"initialProps":{"concurrentRoot":true},"rootTag":1} 54 | ``` 55 | 56 | Note the `"fabric":true` and `"concurrentRoot":true` properties. 57 | 58 | Make sure your code passes TypeScript and ESLint. Run the following to verify: 59 | 60 | ```sh 61 | yarn typecheck 62 | yarn lint 63 | ``` 64 | 65 | To fix formatting errors, run the following: 66 | 67 | ```sh 68 | yarn lint --fix 69 | ``` 70 | 71 | Remember to add tests for your change if possible. Run the unit tests by: 72 | 73 | ```sh 74 | yarn test 75 | ``` 76 | 77 | ### Commit message convention 78 | 79 | We follow the [conventional commits specification](https://www.conventionalcommits.org/en) for our commit messages: 80 | 81 | - `fix`: bug fixes, e.g. fix crash due to deprecated method. 82 | - `feat`: new features, e.g. add new method to the module. 83 | - `refactor`: code refactor, e.g. migrate from class components to hooks. 84 | - `docs`: changes into documentation, e.g. add usage example for the module.. 85 | - `test`: adding or updating tests, e.g. add integration tests using detox. 86 | - `chore`: tooling changes, e.g. change CI config. 87 | 88 | Our pre-commit hooks verify that your commit message matches this format when committing. 89 | 90 | ### Linting and tests 91 | 92 | [ESLint](https://eslint.org/), [Prettier](https://prettier.io/), [TypeScript](https://www.typescriptlang.org/) 93 | 94 | We use [TypeScript](https://www.typescriptlang.org/) for type checking, [ESLint](https://eslint.org/) with [Prettier](https://prettier.io/) for linting and formatting the code, and [Jest](https://jestjs.io/) for testing. 95 | 96 | Our pre-commit hooks verify that the linter and tests pass when committing. 97 | 98 | ### Publishing to npm 99 | 100 | We use [release-it](https://github.com/release-it/release-it) to make it easier to publish new versions. It handles common tasks like bumping version based on semver, creating tags and releases etc. 101 | 102 | To publish new versions, run the following: 103 | 104 | ```sh 105 | yarn release 106 | ``` 107 | 108 | ### Scripts 109 | 110 | The `package.json` file contains various scripts for common tasks: 111 | 112 | - `yarn`: setup project by installing dependencies. 113 | - `yarn typecheck`: type-check files with TypeScript. 114 | - `yarn lint`: lint files with ESLint. 115 | - `yarn test`: run unit tests with Jest. 116 | - `yarn example start`: start the Metro server for the example app. 117 | - `yarn example android`: run the example app on Android. 118 | - `yarn example ios`: run the example app on iOS. 119 | 120 | ### Sending a pull request 121 | 122 | > **Working on your first pull request?** You can learn how from this _free_ series: [How to Contribute to an Open Source Project on GitHub](https://app.egghead.io/playlists/how-to-contribute-to-an-open-source-project-on-github). 123 | 124 | When you're sending a pull request: 125 | 126 | - Prefer small pull requests focused on one change. 127 | - Verify that linters and tests are passing. 128 | - Review the documentation to make sure it looks good. 129 | - Follow the pull request template when opening a pull request. 130 | - For pull requests that change the API or implementation, discuss with maintainers first by opening an issue. 131 | -------------------------------------------------------------------------------- /docs/USAGE.md: -------------------------------------------------------------------------------- 1 | # React Native Speech Usage Guide 2 | 3 | - [React Native Speech Usage Guide](#react-native-speech-usage-guide) 4 | - [Installation](#installation) 5 | - [Bare React Native](#bare-react-native) 6 | - [Expo](#expo) 7 | - [API Overview](#api-overview) 8 | - [Getting Available Voices](#getting-available-voices) 9 | - [Initializing Global Speech Options](#initializing-global-speech-options) 10 | - [Resetting Speech Options](#resetting-speech-options) 11 | - [Speaking Text](#speaking-text) 12 | - [Speaking Text with Custom Options](#speaking-text-with-custom-options) 13 | - [Controlling Speech](#controlling-speech) 14 | - [**Stop Speech**](#stop-speech) 15 | - [**Pause Speech**](#pause-speech) 16 | - [**Resume Speech**](#resume-speech) 17 | - [**Check if Speaking**](#check-if-speaking) 18 | - [Event Callbacks](#event-callbacks) 19 | - [**onError**](#onerror) 20 | - [**onStart**](#onstart) 21 | - [**onFinish**](#onfinish) 22 | - [**onPause**](#onpause) 23 | - [**onResume**](#onresume) 24 | - [**onStopped**](#onstopped) 25 | - [**onProgress**](#onprogress) 26 | - [HighlightedText](#highlightedtext) 27 | - [Importing the Component](#importing-the-component) 28 | - [Properties](#properties) 29 | - [Example](#example) 30 | - [Example Application](#example-application) 31 | 32 | --- 33 | 34 | ## Installation 35 | 36 | ### Bare React Native 37 | 38 | Install the package using either npm or Yarn: 39 | 40 | ```sh 41 | npm install @mhpdev/react-native-speech 42 | ``` 43 | 44 | Or with Yarn: 45 | 46 | ```sh 47 | yarn add @mhpdev/react-native-speech 48 | ``` 49 | 50 | ### Expo 51 | 52 | For Expo projects, follow these steps: 53 | 54 | 1. Install the package: 55 | 56 | ```sh 57 | npx expo install @mhpdev/react-native-speech 58 | ``` 59 | 60 | 2. Since it is not supported on Expo Go, run: 61 | 62 | ```sh 63 | npx expo prebuild 64 | ``` 65 | 66 | --- 67 | 68 | ## API Overview 69 | 70 | For text-to-speech, the library exports the `Speech` class, which provides methods for speech synthesis and event handling: 71 | 72 | ```tsx 73 | import Speech from '@mhpdev/react-native-speech'; 74 | ``` 75 | 76 | --- 77 | 78 | ### Getting Available Voices 79 | 80 | Retrieve a list of all available voices on the device. Optionally, you can filter voices by providing a language code or tag ([IETF BCP 47 language tag](https://www.techonthenet.com/js/language_tags.php)). 81 | 82 | **API Definition:** 83 | 84 | ```ts 85 | Speech.getAvailableVoices(language?: string): Promise 86 | ``` 87 | 88 | **VoiceProps:** 89 | 90 | - `name`: The name of the voice. 91 | - `identifier`: The unique identifier for the voice. 92 | - `language`: The language tag (e.g., `'en-US'`, `'fr-FR'`). 93 | - `quality`: The quality level of the voice (`'Default'` or `'Enhanced'`). 94 | 95 | **Example Usage:** 96 | 97 | ```ts 98 | // Retrieve all voices 99 | Speech.getAvailableVoices().then(voices => { 100 | console.log('Available voices:', voices); 101 | }); 102 | 103 | // Retrieve only English voices 104 | Speech.getAvailableVoices('en').then(voices => { 105 | console.log('English voices:', voices); 106 | }); 107 | 108 | // Retrieve only English (US) voices 109 | Speech.getAvailableVoices('en-US').then(voices => { 110 | console.log('English (US) voices:', voices); 111 | }); 112 | ``` 113 | 114 | --- 115 | 116 | ### Initializing Global Speech Options 117 | 118 | Set global speech options that apply to all speech synthesis calls. 119 | 120 | **API Definition:** 121 | 122 | ```ts 123 | Speech.initialize(options: VoiceOptions): void 124 | ``` 125 | 126 | **VoiceOptions Properties:** 127 | 128 | - `language`: Language code or IETF BCP 47 language tag (e.g., `'en-US'`, `'fr-FR'`). 129 | - `volume`: Volume level (from `0.0` to `1.0`). 130 | - `voice`: Specific voice identifier to use. 131 | - `pitch`: Pitch multiplier (Android: `0.1`–`2.0`; iOS: `0.5`–`2.0`). 132 | - `rate`: Speech rate (Android: `0.1`–`2.0`; iOS: varies based on `AVSpeechUtterance` limits). 133 | 134 | **Example Usage:** 135 | 136 | ```ts 137 | Speech.initialize({ 138 | language: 'en-US', 139 | volume: 1.0, 140 | pitch: 1.2, 141 | rate: 0.8, 142 | }); 143 | ``` 144 | 145 | --- 146 | 147 | ### Resetting Speech Options 148 | 149 | Reset all global speech options to their default values. 150 | 151 | **API Definition:** 152 | 153 | ```ts 154 | Speech.reset(): void 155 | ``` 156 | 157 | **Example Usage:** 158 | 159 | ```ts 160 | Speech.reset(); 161 | ``` 162 | 163 | --- 164 | 165 | ### Speaking Text 166 | 167 | Speak a given text using the current global settings. 168 | 169 | **API Definition:** 170 | 171 | ```ts 172 | Speech.speak(text: string): Promise 173 | ``` 174 | 175 | **Example Usage:** 176 | 177 | ```ts 178 | Speech.speak('Hello, world!'); 179 | ``` 180 | 181 | --- 182 | 183 | ### Speaking Text with Custom Options 184 | 185 | Override global options for a specific utterance. 186 | 187 | **API Definition:** 188 | 189 | ```ts 190 | Speech.speakWithOptions(text: string, options: VoiceOptions): Promise 191 | ``` 192 | 193 | **Example Usage:** 194 | 195 | ```ts 196 | Speech.speakWithOptions('Hello!', { 197 | language: 'en-US', 198 | pitch: 1.5, 199 | rate: 0.8, 200 | }); 201 | ``` 202 | 203 | --- 204 | 205 | ### Controlling Speech 206 | 207 | #### **Stop Speech** 208 | 209 | Immediately stops any ongoing or in queue speech synthesis. 210 | 211 | ```ts 212 | Speech.stop().then(() => console.log('Speech stopped')); 213 | ``` 214 | 215 | #### **Pause Speech** 216 | 217 | > **Note:** On Android, API 26+ (Android 8+) required. 218 | 219 | ```ts 220 | Speech.pause().then(isPaused => { 221 | console.log(isPaused ? 'Speech paused' : 'Nothing to pause'); 222 | }); 223 | ``` 224 | 225 | #### **Resume Speech** 226 | 227 | > **Note:** On Android, API 26+ (Android 8+) required. 228 | 229 | ```ts 230 | Speech.resume().then(isResumed => { 231 | console.log(isResumed ? 'Speech resumed' : 'Nothing to resume'); 232 | }); 233 | ``` 234 | 235 | #### **Check if Speaking** 236 | 237 | Determine if speech synthesis is currently active. 238 | 239 | ```ts 240 | Speech.isSpeaking().then(isSpeaking => { 241 | console.log(isSpeaking ? 'Currently speaking or paused' : 'Not speaking'); 242 | }); 243 | ``` 244 | 245 | --- 246 | 247 | ### Event Callbacks 248 | 249 | Subscribe to event callbacks for speech synthesis lifecycle monitoring. 250 | 251 | #### **onError** 252 | 253 | Triggers when an error occurs. 254 | 255 | ```ts 256 | const errorSubscription = Speech.onError(({id}) => { 257 | console.error(`Speech error (ID: ${id})`); 258 | }); 259 | 260 | //Cleanup 261 | errorSubscription.remove(); 262 | ``` 263 | 264 | #### **onStart** 265 | 266 | Triggers when speech starts. 267 | 268 | ```ts 269 | const startSubscription = Speech.onStart(({id}) => { 270 | console.log(`Speech started (ID: ${id})`); 271 | }); 272 | 273 | //Cleanup 274 | startSubscription.remove(); 275 | ``` 276 | 277 | #### **onFinish** 278 | 279 | Triggers when speech completes. 280 | 281 | ```ts 282 | const finishSubscription = Speech.onFinish(({id}) => { 283 | console.log(`Speech finished (ID: ${id})`); 284 | }); 285 | 286 | //Cleanup 287 | finishSubscription.remove(); 288 | ``` 289 | 290 | #### **onPause** 291 | 292 | Triggers when speech paused. 293 | 294 | > **Note:** On Android, API 26+ (Android 8+) required. 295 | 296 | ```ts 297 | const pauseSubscription = Speech.onPause(({id}) => { 298 | console.log(`Speech paused (ID: ${id})`); 299 | }); 300 | 301 | //Cleanup 302 | pauseSubscription.remove(); 303 | ``` 304 | 305 | #### **onResume** 306 | 307 | Triggers when speech resumed. 308 | 309 | > **Note:** On Android, API 26+ (Android 8+) required. 310 | 311 | ```ts 312 | const resumeSubscription = Speech.onResume(({id}) => { 313 | console.log(`Speech resumed (ID: ${id})`); 314 | }); 315 | 316 | //Cleanup 317 | resumeSubscription.remove(); 318 | ``` 319 | 320 | #### **onStopped** 321 | 322 | Triggers when speech is stopped. 323 | 324 | ```ts 325 | const stoppedSubscription = Speech.onStopped(({id}) => { 326 | console.log(`Speech stopped (ID: ${id})`); 327 | }); 328 | 329 | //Cleanup 330 | stoppedSubscription.remove(); 331 | ``` 332 | 333 | #### **onProgress** 334 | 335 | > **Note:** On Android, API 26+ (Android 8+) required. 336 | 337 | **Callback Parameters:** 338 | 339 | - `id`: The uttenrance identifier 340 | - `length`: The text being spoken length 341 | - `location`: The current position in the spoken text 342 | 343 | ```ts 344 | const progressSubscription = Speech.onProgress(({id, location, length}) => { 345 | console.log( 346 | `Speech ${id} progress, current word length: ${length}, current char position: ${location}`, 347 | ); 348 | }); 349 | 350 | //Cleanup 351 | progressSubscription.remove(); 352 | ``` 353 | 354 | --- 355 | 356 | ## HighlightedText 357 | 358 | The `HighlightedText` component allows you to display text with customizable highlighted segments. This is especially useful for emphasizing parts of text (e.g., the currently synthesized text). In addition to the specialized properties listed below, the component accepts all standard React Native `` props. 359 | 360 | ### Importing the Component 361 | 362 | ```tsx 363 | import {HighlightedText} from '@mhpdev/react-native-speech'; 364 | ``` 365 | 366 | ### Properties 367 | 368 | - **text** 369 | _Type:_ `string` 370 | The full text content to be displayed. 371 | 372 | - **highlightedStyle** 373 | _Type:_ `StyleProp` 374 | The base style applied to all highlighted segments. This style can be overridden by segment-specific styles defined in the `highlights` prop. 375 | 376 | - **highlights** 377 | _Type:_ `Array<{ start: number; end: number; style?: StyleProp }>` 378 | An array of objects that define which parts of the text should be highlighted. Each object must include: 379 | 380 | - **start**: The starting character index of the segment. 381 | - **end**: The ending character index of the segment. 382 | - **style** (optional): Custom style for this particular segment. 383 | 384 | - **onHighlightedPress** 385 | _Type:_ `(segment: { text: string; start: number; end: number }) => void` 386 | A callback function that is invoked when a highlighted segment is pressed. The function receives an object containing: 387 | - **text**: The text content of the pressed segment. 388 | - **start**: The starting index of the segment. 389 | - **end**: The ending index of the segment. 390 | 391 | ### Example 392 | 393 | ```tsx 394 | import React from 'react'; 395 | import { 396 | HighlightedText, 397 | type HighlightedSegmentProps, 398 | type HighlightedSegmentArgs, 399 | } from '@mhpdev/react-native-speech'; 400 | import {Alert, SafeAreaView, StyleSheet} from 'react-native'; 401 | 402 | const TEXT = 'This is a sample text where some parts are highlighted.'; 403 | 404 | const ExampleHighlightedText: React.FC = () => { 405 | const highlights: Array = [ 406 | {start: 10, end: 21}, 407 | {start: 43, end: 54, style: styles.customHighlightedStyle}, 408 | ]; 409 | 410 | const onHighlightedPress = React.useCallback( 411 | ({text, start, end}: HighlightedSegmentArgs) => 412 | Alert.alert( 413 | 'Highlighted Segment', 414 | `Segment "${text}" starts at ${start} and ends at ${end}`, 415 | ), 416 | [], 417 | ); 418 | 419 | return ( 420 | 421 | 428 | 429 | ); 430 | }; 431 | 432 | const styles = StyleSheet.create({ 433 | container: { 434 | padding: 16, 435 | }, 436 | text: { 437 | fontSize: 16, 438 | }, 439 | highlighted: { 440 | backgroundColor: 'yellow', 441 | fontWeight: 'bold', 442 | }, 443 | customHighlightedStyle: { 444 | color: 'white', 445 | backgroundColor: 'blue', 446 | }, 447 | }); 448 | 449 | export default ExampleHighlightedText; 450 | ``` 451 | 452 | To learn more about how to use the component, [check out here](../example/src/views/RootView.tsx). 453 | 454 | ## Example Application 455 | 456 | Check out the [example project](../example/). 457 | -------------------------------------------------------------------------------- /docs/android-thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhpdev-com/react-native-speech/35a0f7868fe9241c5acf2795c841fab942852976/docs/android-thumbnail.png -------------------------------------------------------------------------------- /docs/ios-thumbnail.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhpdev-com/react-native-speech/35a0f7868fe9241c5acf2795c841fab942852976/docs/ios-thumbnail.png -------------------------------------------------------------------------------- /example/.bundle/config: -------------------------------------------------------------------------------- 1 | BUNDLE_PATH: "vendor/bundle" 2 | BUNDLE_FORCE_RUBY_PLATFORM: 1 3 | -------------------------------------------------------------------------------- /example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /example/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version 4 | ruby ">= 2.6.10" 5 | 6 | # Exclude problematic versions of cocoapods and activesupport that causes build failures. 7 | gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1' 8 | gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0' 9 | gem 'xcodeproj', '< 1.26.0' 10 | gem 'concurrent-ruby', '< 1.3.4' 11 | -------------------------------------------------------------------------------- /example/Gemfile.lock: -------------------------------------------------------------------------------- 1 | GEM 2 | remote: https://rubygems.org/ 3 | specs: 4 | CFPropertyList (3.0.7) 5 | base64 6 | nkf 7 | rexml 8 | activesupport (7.2.2.1) 9 | base64 10 | benchmark (>= 0.3) 11 | bigdecimal 12 | concurrent-ruby (~> 1.0, >= 1.3.1) 13 | connection_pool (>= 2.2.5) 14 | drb 15 | i18n (>= 1.6, < 2) 16 | logger (>= 1.4.2) 17 | minitest (>= 5.1) 18 | securerandom (>= 0.3) 19 | tzinfo (~> 2.0, >= 2.0.5) 20 | addressable (2.8.7) 21 | public_suffix (>= 2.0.2, < 7.0) 22 | algoliasearch (1.27.5) 23 | httpclient (~> 2.8, >= 2.8.3) 24 | json (>= 1.5.1) 25 | atomos (0.1.3) 26 | base64 (0.2.0) 27 | benchmark (0.4.0) 28 | bigdecimal (3.1.9) 29 | claide (1.1.0) 30 | cocoapods (1.15.2) 31 | addressable (~> 2.8) 32 | claide (>= 1.0.2, < 2.0) 33 | cocoapods-core (= 1.15.2) 34 | cocoapods-deintegrate (>= 1.0.3, < 2.0) 35 | cocoapods-downloader (>= 2.1, < 3.0) 36 | cocoapods-plugins (>= 1.0.0, < 2.0) 37 | cocoapods-search (>= 1.0.0, < 2.0) 38 | cocoapods-trunk (>= 1.6.0, < 2.0) 39 | cocoapods-try (>= 1.1.0, < 2.0) 40 | colored2 (~> 3.1) 41 | escape (~> 0.0.4) 42 | fourflusher (>= 2.3.0, < 3.0) 43 | gh_inspector (~> 1.0) 44 | molinillo (~> 0.8.0) 45 | nap (~> 1.0) 46 | ruby-macho (>= 2.3.0, < 3.0) 47 | xcodeproj (>= 1.23.0, < 2.0) 48 | cocoapods-core (1.15.2) 49 | activesupport (>= 5.0, < 8) 50 | addressable (~> 2.8) 51 | algoliasearch (~> 1.0) 52 | concurrent-ruby (~> 1.1) 53 | fuzzy_match (~> 2.0.4) 54 | nap (~> 1.0) 55 | netrc (~> 0.11) 56 | public_suffix (~> 4.0) 57 | typhoeus (~> 1.0) 58 | cocoapods-deintegrate (1.0.5) 59 | cocoapods-downloader (2.1) 60 | cocoapods-plugins (1.0.0) 61 | nap 62 | cocoapods-search (1.0.1) 63 | cocoapods-trunk (1.6.0) 64 | nap (>= 0.8, < 2.0) 65 | netrc (~> 0.11) 66 | cocoapods-try (1.2.0) 67 | colored2 (3.1.2) 68 | concurrent-ruby (1.3.3) 69 | connection_pool (2.5.0) 70 | drb (2.2.1) 71 | escape (0.0.4) 72 | ethon (0.16.0) 73 | ffi (>= 1.15.0) 74 | ffi (1.17.1) 75 | fourflusher (2.3.1) 76 | fuzzy_match (2.0.4) 77 | gh_inspector (1.1.3) 78 | httpclient (2.9.0) 79 | mutex_m 80 | i18n (1.14.7) 81 | concurrent-ruby (~> 1.0) 82 | json (2.10.1) 83 | logger (1.6.6) 84 | minitest (5.25.4) 85 | molinillo (0.8.0) 86 | mutex_m (0.3.0) 87 | nanaimo (0.3.0) 88 | nap (1.1.0) 89 | netrc (0.11.0) 90 | nkf (0.2.0) 91 | public_suffix (4.0.7) 92 | rexml (3.4.1) 93 | ruby-macho (2.5.1) 94 | securerandom (0.4.1) 95 | typhoeus (1.4.1) 96 | ethon (>= 0.9.0) 97 | tzinfo (2.0.6) 98 | concurrent-ruby (~> 1.0) 99 | xcodeproj (1.25.1) 100 | CFPropertyList (>= 2.3.3, < 4.0) 101 | atomos (~> 0.1.3) 102 | claide (>= 1.0.2, < 2.0) 103 | colored2 (~> 3.1) 104 | nanaimo (~> 0.3.0) 105 | rexml (>= 3.3.6, < 4.0) 106 | 107 | PLATFORMS 108 | ruby 109 | 110 | DEPENDENCIES 111 | activesupport (>= 6.1.7.5, != 7.1.0) 112 | cocoapods (>= 1.13, != 1.15.1, != 1.15.0) 113 | concurrent-ruby (< 1.3.4) 114 | xcodeproj (< 1.26.0) 115 | 116 | RUBY VERSION 117 | ruby 3.3.5p100 118 | 119 | BUNDLED WITH 120 | 2.5.18 121 | -------------------------------------------------------------------------------- /example/README.md: -------------------------------------------------------------------------------- 1 | This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli). 2 | 3 | # Getting Started 4 | 5 | > **Note**: Make sure you have completed the [Set Up Your Environment](https://reactnative.dev/docs/set-up-your-environment) guide before proceeding. 6 | 7 | ## Step 1: Start Metro 8 | 9 | First, you will need to run **Metro**, the JavaScript build tool for React Native. 10 | 11 | To start the Metro dev server, run the following command from the root of your React Native project: 12 | 13 | ```sh 14 | # Using npm 15 | npm start 16 | 17 | # OR using Yarn 18 | yarn start 19 | ``` 20 | 21 | ## Step 2: Build and run your app 22 | 23 | With Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app: 24 | 25 | ### Android 26 | 27 | ```sh 28 | # Using npm 29 | npm run android 30 | 31 | # OR using Yarn 32 | yarn android 33 | ``` 34 | 35 | ### iOS 36 | 37 | For iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps). 38 | 39 | The first time you create a new project, run the Ruby bundler to install CocoaPods itself: 40 | 41 | ```sh 42 | bundle install 43 | ``` 44 | 45 | Then, and every time you update your native dependencies, run: 46 | 47 | ```sh 48 | bundle exec pod install 49 | ``` 50 | 51 | For more information, please visit [CocoaPods Getting Started guide](https://guides.cocoapods.org/using/getting-started.html). 52 | 53 | ```sh 54 | # Using npm 55 | npm run ios 56 | 57 | # OR using Yarn 58 | yarn ios 59 | ``` 60 | 61 | If everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device. 62 | 63 | This is one way to run your app — you can also build it directly from Android Studio or Xcode. 64 | 65 | ## Step 3: Modify your app 66 | 67 | Now that you have successfully run the app, let's make changes! 68 | 69 | Open `App.tsx` in your text editor of choice and make some changes. When you save, your app will automatically update and reflect these changes — this is powered by [Fast Refresh](https://reactnative.dev/docs/fast-refresh). 70 | 71 | When you want to forcefully reload, for example to reset the state of your app, you can perform a full reload: 72 | 73 | - **Android**: Press the R key twice or select **"Reload"** from the **Dev Menu**, accessed via Ctrl + M (Windows/Linux) or Cmd ⌘ + M (macOS). 74 | - **iOS**: Press R in iOS Simulator. 75 | 76 | ## Congratulations! :tada: 77 | 78 | You've successfully run and modified your React Native App. :partying_face: 79 | 80 | ### Now what? 81 | 82 | - If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps). 83 | - If you're curious to learn more about React Native, check out the [docs](https://reactnative.dev/docs/getting-started). 84 | 85 | # Troubleshooting 86 | 87 | If you're having issues getting the above steps to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page. 88 | 89 | # Learn More 90 | 91 | To learn more about React Native, take a look at the following resources: 92 | 93 | - [React Native Website](https://reactnative.dev) - learn more about React Native. 94 | - [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment. 95 | - [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**. 96 | - [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts. 97 | - [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native. 98 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | apply plugin: "org.jetbrains.kotlin.android" 3 | apply plugin: "com.facebook.react" 4 | 5 | /** 6 | * This is the configuration block to customize your React Native Android app. 7 | * By default you don't need to apply any configuration, just uncomment the lines you need. 8 | */ 9 | react { 10 | /* Folders */ 11 | // The root of your project, i.e. where "package.json" lives. Default is '../..' 12 | // root = file("../../") 13 | // The folder where the react-native NPM package is. Default is ../../node_modules/react-native 14 | // reactNativeDir = file("../../node_modules/react-native") 15 | // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen 16 | // codegenDir = file("../../node_modules/@react-native/codegen") 17 | // The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js 18 | // cliFile = file("../../node_modules/react-native/cli.js") 19 | 20 | /* Variants */ 21 | // The list of variants to that are debuggable. For those we're going to 22 | // skip the bundling of the JS bundle and the assets. By default is just 'debug'. 23 | // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants. 24 | // debuggableVariants = ["liteDebug", "prodDebug"] 25 | 26 | /* Bundling */ 27 | // A list containing the node command and its flags. Default is just 'node'. 28 | // nodeExecutableAndArgs = ["node"] 29 | // 30 | // The command to run when bundling. By default is 'bundle' 31 | // bundleCommand = "ram-bundle" 32 | // 33 | // The path to the CLI configuration file. Default is empty. 34 | // bundleConfig = file(../rn-cli.config.js) 35 | // 36 | // The name of the generated asset file containing your JS bundle 37 | // bundleAssetName = "MyApplication.android.bundle" 38 | // 39 | // The entry file for bundle generation. Default is 'index.android.js' or 'index.js' 40 | // entryFile = file("../js/MyApplication.android.js") 41 | // 42 | // A list of extra flags to pass to the 'bundle' commands. 43 | // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle 44 | // extraPackagerArgs = [] 45 | 46 | /* Hermes Commands */ 47 | // The hermes compiler command to run. By default it is 'hermesc' 48 | // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc" 49 | // 50 | // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map" 51 | // hermesFlags = ["-O", "-output-source-map"] 52 | 53 | /* Autolinking */ 54 | autolinkLibrariesWithApp() 55 | } 56 | 57 | /** 58 | * Set this to true to Run Proguard on Release builds to minify the Java bytecode. 59 | */ 60 | def enableProguardInReleaseBuilds = false 61 | 62 | /** 63 | * The preferred build flavor of JavaScriptCore (JSC) 64 | * 65 | * For example, to use the international variant, you can use: 66 | * `def jscFlavor = io.github.react-native-community:jsc-android-intl:2026004.+` 67 | * 68 | * The international variant includes ICU i18n library and necessary data 69 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that 70 | * give correct results when using with locales other than en-US. Note that 71 | * this variant is about 6MiB larger per architecture than default. 72 | */ 73 | def jscFlavor = 'io.github.react-native-community:jsc-android:2026004.+' 74 | 75 | android { 76 | ndkVersion rootProject.ext.ndkVersion 77 | buildToolsVersion rootProject.ext.buildToolsVersion 78 | compileSdk rootProject.ext.compileSdkVersion 79 | 80 | namespace "speech.example" 81 | defaultConfig { 82 | applicationId "speech.example" 83 | minSdkVersion rootProject.ext.minSdkVersion 84 | targetSdkVersion rootProject.ext.targetSdkVersion 85 | versionCode 1 86 | versionName "1.0" 87 | } 88 | signingConfigs { 89 | debug { 90 | storeFile file('debug.keystore') 91 | storePassword 'android' 92 | keyAlias 'androiddebugkey' 93 | keyPassword 'android' 94 | } 95 | } 96 | buildTypes { 97 | debug { 98 | signingConfig signingConfigs.debug 99 | } 100 | release { 101 | // Caution! In production, you need to generate your own keystore file. 102 | // see https://reactnative.dev/docs/signed-apk-android. 103 | signingConfig signingConfigs.debug 104 | minifyEnabled enableProguardInReleaseBuilds 105 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 106 | } 107 | } 108 | } 109 | 110 | dependencies { 111 | // The version of react-native is set by the React Native Gradle Plugin 112 | implementation("com.facebook.react:react-android") 113 | 114 | if (hermesEnabled.toBoolean()) { 115 | implementation("com.facebook.react:hermes-android") 116 | } else { 117 | implementation jscFlavor 118 | } 119 | } 120 | 121 | def isNewArchitectureEnabled() { 122 | return rootProject.hasProperty("newArchEnabled") && rootProject.getProperty("newArchEnabled") == "true" 123 | } 124 | 125 | if (isNewArchitectureEnabled()) { 126 | // Since our library doesn't invoke codegen automatically we need to do it here. 127 | tasks.register('invokeLibraryCodegen', Exec) { 128 | workingDir "$rootDir/../../" 129 | def isWindows = System.getProperty('os.name').toLowerCase().contains('windows') 130 | 131 | if (isWindows) { 132 | commandLine 'cmd', '/c', 'npx bob build --target codegen' 133 | } else { 134 | commandLine 'sh', '-c', 'npx bob build --target codegen' 135 | } 136 | } 137 | preBuild.dependsOn invokeLibraryCodegen 138 | } -------------------------------------------------------------------------------- /example/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhpdev-com/react-native-speech/35a0f7868fe9241c5acf2795c841fab942852976/example/android/app/debug.keystore -------------------------------------------------------------------------------- /example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | -------------------------------------------------------------------------------- /example/android/app/src/debug/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 9 | 10 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 13 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/speech/example/MainActivity.kt: -------------------------------------------------------------------------------- 1 | package speech.example 2 | 3 | import com.facebook.react.ReactActivity 4 | import com.facebook.react.ReactActivityDelegate 5 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled 6 | import com.facebook.react.defaults.DefaultReactActivityDelegate 7 | 8 | class MainActivity : ReactActivity() { 9 | 10 | /** 11 | * Returns the name of the main component registered from JavaScript. This is used to schedule 12 | * rendering of the component. 13 | */ 14 | override fun getMainComponentName(): String = "SpeechExample" 15 | 16 | /** 17 | * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate] 18 | * which allows you to enable New Architecture with a single boolean flags [fabricEnabled] 19 | */ 20 | override fun createReactActivityDelegate(): ReactActivityDelegate = 21 | DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled) 22 | } 23 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/speech/example/MainApplication.kt: -------------------------------------------------------------------------------- 1 | package speech.example 2 | 3 | import android.app.Application 4 | import com.facebook.react.PackageList 5 | import com.facebook.react.ReactApplication 6 | import com.facebook.react.ReactHost 7 | import com.facebook.react.ReactNativeHost 8 | import com.facebook.react.ReactPackage 9 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load 10 | import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost 11 | import com.facebook.react.defaults.DefaultReactNativeHost 12 | import com.facebook.react.soloader.OpenSourceMergedSoMapping 13 | import com.facebook.soloader.SoLoader 14 | 15 | class MainApplication : Application(), ReactApplication { 16 | 17 | override val reactNativeHost: ReactNativeHost = 18 | object : DefaultReactNativeHost(this) { 19 | override fun getPackages(): List = 20 | PackageList(this).packages.apply { 21 | // Packages that cannot be autolinked yet can be added manually here, for example: 22 | // add(MyReactNativePackage()) 23 | } 24 | 25 | override fun getJSMainModuleName(): String = "index" 26 | 27 | override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG 28 | 29 | override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED 30 | override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED 31 | } 32 | 33 | override val reactHost: ReactHost 34 | get() = getDefaultReactHost(applicationContext, reactNativeHost) 35 | 36 | override fun onCreate() { 37 | super.onCreate() 38 | SoLoader.init(this, OpenSourceMergedSoMapping) 39 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) { 40 | // If you opted-in for the New Architecture, we load the native entry point for this app. 41 | load() 42 | } 43 | } 44 | } 45 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/drawable/rn_edit_text_material.xml: -------------------------------------------------------------------------------- 1 | 2 | 16 | 22 | 23 | 24 | 33 | 34 | 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhpdev-com/react-native-speech/35a0f7868fe9241c5acf2795c841fab942852976/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhpdev-com/react-native-speech/35a0f7868fe9241c5acf2795c841fab942852976/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhpdev-com/react-native-speech/35a0f7868fe9241c5acf2795c841fab942852976/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhpdev-com/react-native-speech/35a0f7868fe9241c5acf2795c841fab942852976/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhpdev-com/react-native-speech/35a0f7868fe9241c5acf2795c841fab942852976/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhpdev-com/react-native-speech/35a0f7868fe9241c5acf2795c841fab942852976/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhpdev-com/react-native-speech/35a0f7868fe9241c5acf2795c841fab942852976/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhpdev-com/react-native-speech/35a0f7868fe9241c5acf2795c841fab942852976/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhpdev-com/react-native-speech/35a0f7868fe9241c5acf2795c841fab942852976/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhpdev-com/react-native-speech/35a0f7868fe9241c5acf2795c841fab942852976/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | SpeechExample 3 | 4 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 8 | 9 | 10 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | buildscript { 2 | ext { 3 | buildToolsVersion = "35.0.0" 4 | minSdkVersion = 24 5 | compileSdkVersion = 35 6 | targetSdkVersion = 35 7 | ndkVersion = "27.1.12297006" 8 | kotlinVersion = "2.0.21" 9 | } 10 | repositories { 11 | google() 12 | mavenCentral() 13 | } 14 | dependencies { 15 | classpath("com.android.tools.build:gradle") 16 | classpath("com.facebook.react:react-native-gradle-plugin") 17 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin") 18 | } 19 | } 20 | 21 | apply plugin: "com.facebook.react.rootproject" 22 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m 13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | # AndroidX package structure to make it clearer which packages are bundled with the 21 | # Android operating system, and which are packaged with your app's APK 22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn 23 | android.useAndroidX=true 24 | 25 | # Use this property to specify which architecture you want to build. 26 | # You can also override it from the CLI using 27 | # ./gradlew -PreactNativeArchitectures=x86_64 28 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64 29 | 30 | # Use this property to enable support to the new architecture. 31 | # This will allow you to use TurboModules and the Fabric render in 32 | # your application. You should enable this flag either if you want 33 | # to write custom TurboModules/Fabric components OR use libraries that 34 | # are providing them. 35 | newArchEnabled=true 36 | 37 | # Use this property to enable or disable the Hermes JS engine. 38 | # If set to false, you will be using JSC instead. 39 | hermesEnabled=true 40 | 41 | newArchEnabled=true -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/mhpdev-com/react-native-speech/35a0f7868fe9241c5acf2795c841fab942852976/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.12-all.zip 4 | networkTimeout=10000 5 | validateDistributionUrl=true 6 | zipStoreBase=GRADLE_USER_HOME 7 | zipStorePath=wrapper/dists 8 | -------------------------------------------------------------------------------- /example/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/bin/sh 2 | 3 | # 4 | # Copyright © 2015-2021 the original authors. 5 | # 6 | # Licensed under the Apache License, Version 2.0 (the "License"); 7 | # you may not use this file except in compliance with the License. 8 | # You may obtain a copy of the License at 9 | # 10 | # https://www.apache.org/licenses/LICENSE-2.0 11 | # 12 | # Unless required by applicable law or agreed to in writing, software 13 | # distributed under the License is distributed on an "AS IS" BASIS, 14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 15 | # See the License for the specific language governing permissions and 16 | # limitations under the License. 17 | # 18 | # SPDX-License-Identifier: Apache-2.0 19 | # 20 | 21 | ############################################################################## 22 | # 23 | # Gradle start up script for POSIX generated by Gradle. 24 | # 25 | # Important for running: 26 | # 27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is 28 | # noncompliant, but you have some other compliant shell such as ksh or 29 | # bash, then to run this script, type that shell name before the whole 30 | # command line, like: 31 | # 32 | # ksh Gradle 33 | # 34 | # Busybox and similar reduced shells will NOT work, because this script 35 | # requires all of these POSIX shell features: 36 | # * functions; 37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}», 38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»; 39 | # * compound commands having a testable exit status, especially «case»; 40 | # * various built-in commands including «command», «set», and «ulimit». 41 | # 42 | # Important for patching: 43 | # 44 | # (2) This script targets any POSIX shell, so it avoids extensions provided 45 | # by Bash, Ksh, etc; in particular arrays are avoided. 46 | # 47 | # The "traditional" practice of packing multiple parameters into a 48 | # space-separated string is a well documented source of bugs and security 49 | # problems, so this is (mostly) avoided, by progressively accumulating 50 | # options in "$@", and eventually passing that to Java. 51 | # 52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS, 53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly; 54 | # see the in-line comments for details. 55 | # 56 | # There are tweaks for specific operating systems such as AIX, CygWin, 57 | # Darwin, MinGW, and NonStop. 58 | # 59 | # (3) This script is generated from the Groovy template 60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt 61 | # within the Gradle project. 62 | # 63 | # You can find Gradle at https://github.com/gradle/gradle/. 64 | # 65 | ############################################################################## 66 | 67 | # Attempt to set APP_HOME 68 | 69 | # Resolve links: $0 may be a link 70 | app_path=$0 71 | 72 | # Need this for daisy-chained symlinks. 73 | while 74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path 75 | [ -h "$app_path" ] 76 | do 77 | ls=$( ls -ld "$app_path" ) 78 | link=${ls#*' -> '} 79 | case $link in #( 80 | /*) app_path=$link ;; #( 81 | *) app_path=$APP_HOME$link ;; 82 | esac 83 | done 84 | 85 | # This is normally unused 86 | # shellcheck disable=SC2034 87 | APP_BASE_NAME=${0##*/} 88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036) 89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s\n' "$PWD" ) || exit 90 | 91 | # Use the maximum available, or set MAX_FD != -1 to use that value. 92 | MAX_FD=maximum 93 | 94 | warn () { 95 | echo "$*" 96 | } >&2 97 | 98 | die () { 99 | echo 100 | echo "$*" 101 | echo 102 | exit 1 103 | } >&2 104 | 105 | # OS specific support (must be 'true' or 'false'). 106 | cygwin=false 107 | msys=false 108 | darwin=false 109 | nonstop=false 110 | case "$( uname )" in #( 111 | CYGWIN* ) cygwin=true ;; #( 112 | Darwin* ) darwin=true ;; #( 113 | MSYS* | MINGW* ) msys=true ;; #( 114 | NONSTOP* ) nonstop=true ;; 115 | esac 116 | 117 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 118 | 119 | 120 | # Determine the Java command to use to start the JVM. 121 | if [ -n "$JAVA_HOME" ] ; then 122 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 123 | # IBM's JDK on AIX uses strange locations for the executables 124 | JAVACMD=$JAVA_HOME/jre/sh/java 125 | else 126 | JAVACMD=$JAVA_HOME/bin/java 127 | fi 128 | if [ ! -x "$JAVACMD" ] ; then 129 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 130 | 131 | Please set the JAVA_HOME variable in your environment to match the 132 | location of your Java installation." 133 | fi 134 | else 135 | JAVACMD=java 136 | if ! command -v java >/dev/null 2>&1 137 | then 138 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 139 | 140 | Please set the JAVA_HOME variable in your environment to match the 141 | location of your Java installation." 142 | fi 143 | fi 144 | 145 | # Increase the maximum file descriptors if we can. 146 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then 147 | case $MAX_FD in #( 148 | max*) 149 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked. 150 | # shellcheck disable=SC2039,SC3045 151 | MAX_FD=$( ulimit -H -n ) || 152 | warn "Could not query maximum file descriptor limit" 153 | esac 154 | case $MAX_FD in #( 155 | '' | soft) :;; #( 156 | *) 157 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked. 158 | # shellcheck disable=SC2039,SC3045 159 | ulimit -n "$MAX_FD" || 160 | warn "Could not set maximum file descriptor limit to $MAX_FD" 161 | esac 162 | fi 163 | 164 | # Collect all arguments for the java command, stacking in reverse order: 165 | # * args from the command line 166 | # * the main class name 167 | # * -classpath 168 | # * -D...appname settings 169 | # * --module-path (only if needed) 170 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables. 171 | 172 | # For Cygwin or MSYS, switch paths to Windows format before running java 173 | if "$cygwin" || "$msys" ; then 174 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" ) 175 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" ) 176 | 177 | JAVACMD=$( cygpath --unix "$JAVACMD" ) 178 | 179 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 180 | for arg do 181 | if 182 | case $arg in #( 183 | -*) false ;; # don't mess with options #( 184 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath 185 | [ -e "$t" ] ;; #( 186 | *) false ;; 187 | esac 188 | then 189 | arg=$( cygpath --path --ignore --mixed "$arg" ) 190 | fi 191 | # Roll the args list around exactly as many times as the number of 192 | # args, so each arg winds up back in the position where it started, but 193 | # possibly modified. 194 | # 195 | # NB: a `for` loop captures its iteration list before it begins, so 196 | # changing the positional parameters here affects neither the number of 197 | # iterations, nor the values presented in `arg`. 198 | shift # remove old arg 199 | set -- "$@" "$arg" # push replacement arg 200 | done 201 | fi 202 | 203 | 204 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 205 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"' 206 | 207 | # Collect all arguments for the java command: 208 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments, 209 | # and any embedded shellness will be escaped. 210 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be 211 | # treated as '${Hostname}' itself on the command line. 212 | 213 | set -- \ 214 | "-Dorg.gradle.appname=$APP_BASE_NAME" \ 215 | -classpath "$CLASSPATH" \ 216 | org.gradle.wrapper.GradleWrapperMain \ 217 | "$@" 218 | 219 | # Stop when "xargs" is not available. 220 | if ! command -v xargs >/dev/null 2>&1 221 | then 222 | die "xargs is not available" 223 | fi 224 | 225 | # Use "xargs" to parse quoted args. 226 | # 227 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed. 228 | # 229 | # In Bash we could simply go: 230 | # 231 | # readarray ARGS < <( xargs -n1 <<<"$var" ) && 232 | # set -- "${ARGS[@]}" "$@" 233 | # 234 | # but POSIX shell has neither arrays nor command substitution, so instead we 235 | # post-process each arg (as a line of input to sed) to backslash-escape any 236 | # character that might be a shell metacharacter, then use eval to reverse 237 | # that process (while maintaining the separation between arguments), and wrap 238 | # the whole thing up as a single "set" statement. 239 | # 240 | # This will of course break if any of these variables contains a newline or 241 | # an unmatched quote. 242 | # 243 | 244 | eval "set -- $( 245 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" | 246 | xargs -n1 | 247 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' | 248 | tr '\n' ' ' 249 | )" '"$@"' 250 | 251 | exec "$JAVACMD" "$@" 252 | -------------------------------------------------------------------------------- /example/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @rem 2 | @rem Copyright 2015 the original author or authors. 3 | @rem 4 | @rem Licensed under the Apache License, Version 2.0 (the "License"); 5 | @rem you may not use this file except in compliance with the License. 6 | @rem You may obtain a copy of the License at 7 | @rem 8 | @rem https://www.apache.org/licenses/LICENSE-2.0 9 | @rem 10 | @rem Unless required by applicable law or agreed to in writing, software 11 | @rem distributed under the License is distributed on an "AS IS" BASIS, 12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 | @rem See the License for the specific language governing permissions and 14 | @rem limitations under the License. 15 | @rem 16 | @rem SPDX-License-Identifier: Apache-2.0 17 | @rem 18 | 19 | @if "%DEBUG%"=="" @echo off 20 | @rem ########################################################################## 21 | @rem 22 | @rem Gradle startup script for Windows 23 | @rem 24 | @rem ########################################################################## 25 | 26 | @rem Set local scope for the variables with windows NT shell 27 | if "%OS%"=="Windows_NT" setlocal 28 | 29 | set DIRNAME=%~dp0 30 | if "%DIRNAME%"=="" set DIRNAME=. 31 | @rem This is normally unused 32 | set APP_BASE_NAME=%~n0 33 | set APP_HOME=%DIRNAME% 34 | 35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter. 36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi 37 | 38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m" 40 | 41 | @rem Find java.exe 42 | if defined JAVA_HOME goto findJavaFromJavaHome 43 | 44 | set JAVA_EXE=java.exe 45 | %JAVA_EXE% -version >NUL 2>&1 46 | if %ERRORLEVEL% equ 0 goto execute 47 | 48 | echo. 1>&2 49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2 50 | echo. 1>&2 51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 52 | echo location of your Java installation. 1>&2 53 | 54 | goto fail 55 | 56 | :findJavaFromJavaHome 57 | set JAVA_HOME=%JAVA_HOME:"=% 58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 59 | 60 | if exist "%JAVA_EXE%" goto execute 61 | 62 | echo. 1>&2 63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2 64 | echo. 1>&2 65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2 66 | echo location of your Java installation. 1>&2 67 | 68 | goto fail 69 | 70 | :execute 71 | @rem Setup the command line 72 | 73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 74 | 75 | 76 | @rem Execute Gradle 77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %* 78 | 79 | :end 80 | @rem End local scope for the variables with windows NT shell 81 | if %ERRORLEVEL% equ 0 goto mainEnd 82 | 83 | :fail 84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 85 | rem the _cmd.exe /c_ return code! 86 | set EXIT_CODE=%ERRORLEVEL% 87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1 88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% 89 | exit /b %EXIT_CODE% 90 | 91 | :mainEnd 92 | if "%OS%"=="Windows_NT" endlocal 93 | 94 | :omega 95 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") } 2 | plugins { id("com.facebook.react.settings") } 3 | extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() } 4 | rootProject.name = 'speech.example' 5 | include ':app' 6 | includeBuild('../node_modules/@react-native/gradle-plugin') 7 | -------------------------------------------------------------------------------- /example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "SpeechExample", 3 | "displayName": "SpeechExample" 4 | } 5 | -------------------------------------------------------------------------------- /example/babel.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const {getConfig} = require('react-native-builder-bob/babel-config'); 3 | const pkg = require('../package.json'); 4 | 5 | const root = path.resolve(__dirname, '..'); 6 | 7 | module.exports = getConfig( 8 | { 9 | presets: ['module:@react-native/babel-preset'], 10 | }, 11 | {root, pkg}, 12 | ); 13 | -------------------------------------------------------------------------------- /example/index.js: -------------------------------------------------------------------------------- 1 | import {AppRegistry} from 'react-native'; 2 | import App from './src/App'; 3 | import {name as appName} from './app.json'; 4 | 5 | AppRegistry.registerComponent(appName, () => App); 6 | -------------------------------------------------------------------------------- /example/ios/.xcode.env: -------------------------------------------------------------------------------- 1 | # This `.xcode.env` file is versioned and is used to source the environment 2 | # used when running script phases inside Xcode. 3 | # To customize your local environment, you can create an `.xcode.env.local` 4 | # file that is not versioned. 5 | 6 | # NODE_BINARY variable contains the PATH to the node executable. 7 | # 8 | # Customize the NODE_BINARY variable here. 9 | # For example, to use nvm with brew, add the following line 10 | # . "$(brew --prefix nvm)/nvm.sh" --no-use 11 | export NODE_BINARY=$(command -v node) 12 | -------------------------------------------------------------------------------- /example/ios/Podfile: -------------------------------------------------------------------------------- 1 | ENV['RCT_NEW_ARCH_ENABLED'] = '1' 2 | 3 | # Resolve react_native_pods.rb with node to allow for hoisting 4 | require Pod::Executable.execute_command('node', ['-p', 5 | 'require.resolve( 6 | "react-native/scripts/react_native_pods.rb", 7 | {paths: [process.argv[1]]}, 8 | )', __dir__]).strip 9 | 10 | platform :ios, min_ios_version_supported 11 | prepare_react_native_project! 12 | 13 | linkage = ENV['USE_FRAMEWORKS'] 14 | if linkage != nil 15 | Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green 16 | use_frameworks! :linkage => linkage.to_sym 17 | end 18 | 19 | target 'SpeechExample' do 20 | config = use_native_modules! 21 | 22 | use_react_native!( 23 | :path => config[:reactNativePath], 24 | # An absolute path to your application root. 25 | :app_path => "#{Pod::Config.instance.installation_root}/.." 26 | ) 27 | 28 | 29 | pre_install do |installer| 30 | system("cd ../../ && npx bob build --target codegen") 31 | end 32 | 33 | post_install do |installer| 34 | # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202 35 | react_native_post_install( 36 | installer, 37 | config[:reactNativePath], 38 | :mac_catalyst_enabled => false, 39 | # :ccache_enabled => true 40 | ) 41 | end 42 | end 43 | -------------------------------------------------------------------------------- /example/ios/SpeechExample.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 54; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 0C80B921A6F3F58F76C31292 /* libPods-SpeechExample.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DCACB8F33CDC322A6C60F78 /* libPods-SpeechExample.a */; }; 11 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; }; 12 | 761780ED2CA45674006654EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761780EC2CA45674006654EE /* AppDelegate.swift */; }; 13 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; }; 14 | B195123ED1FF280162A16999 /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */; }; 15 | D0CA3C1E2D76524F00117C65 /* AVFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = D0CA3C1D2D76524F00117C65 /* AVFoundation.framework */; }; 16 | /* End PBXBuildFile section */ 17 | 18 | /* Begin PBXFileReference section */ 19 | 13B07F961A680F5B00A75B9A /* SpeechExample.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = SpeechExample.app; sourceTree = BUILT_PRODUCTS_DIR; }; 20 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = SpeechExample/Images.xcassets; sourceTree = ""; }; 21 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = SpeechExample/Info.plist; sourceTree = ""; }; 22 | 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = SpeechExample/PrivacyInfo.xcprivacy; sourceTree = ""; }; 23 | 3B4392A12AC88292D35C810B /* Pods-SpeechExample.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SpeechExample.debug.xcconfig"; path = "Target Support Files/Pods-SpeechExample/Pods-SpeechExample.debug.xcconfig"; sourceTree = ""; }; 24 | 5709B34CF0A7D63546082F79 /* Pods-SpeechExample.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-SpeechExample.release.xcconfig"; path = "Target Support Files/Pods-SpeechExample/Pods-SpeechExample.release.xcconfig"; sourceTree = ""; }; 25 | 5DCACB8F33CDC322A6C60F78 /* libPods-SpeechExample.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-SpeechExample.a"; sourceTree = BUILT_PRODUCTS_DIR; }; 26 | 761780EC2CA45674006654EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = SpeechExample/AppDelegate.swift; sourceTree = ""; }; 27 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = SpeechExample/LaunchScreen.storyboard; sourceTree = ""; }; 28 | D0CA3C1D2D76524F00117C65 /* AVFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AVFoundation.framework; path = System/Library/Frameworks/AVFoundation.framework; sourceTree = SDKROOT; }; 29 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; }; 30 | /* End PBXFileReference section */ 31 | 32 | /* Begin PBXFrameworksBuildPhase section */ 33 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = { 34 | isa = PBXFrameworksBuildPhase; 35 | buildActionMask = 2147483647; 36 | files = ( 37 | D0CA3C1E2D76524F00117C65 /* AVFoundation.framework in Frameworks */, 38 | 0C80B921A6F3F58F76C31292 /* libPods-SpeechExample.a in Frameworks */, 39 | ); 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXFrameworksBuildPhase section */ 43 | 44 | /* Begin PBXGroup section */ 45 | 13B07FAE1A68108700A75B9A /* SpeechExample */ = { 46 | isa = PBXGroup; 47 | children = ( 48 | 13B07FB51A68108700A75B9A /* Images.xcassets */, 49 | 761780EC2CA45674006654EE /* AppDelegate.swift */, 50 | 13B07FB61A68108700A75B9A /* Info.plist */, 51 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */, 52 | 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */, 53 | ); 54 | name = SpeechExample; 55 | sourceTree = ""; 56 | }; 57 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = { 58 | isa = PBXGroup; 59 | children = ( 60 | D0CA3C1D2D76524F00117C65 /* AVFoundation.framework */, 61 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */, 62 | 5DCACB8F33CDC322A6C60F78 /* libPods-SpeechExample.a */, 63 | ); 64 | name = Frameworks; 65 | sourceTree = ""; 66 | }; 67 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = { 68 | isa = PBXGroup; 69 | children = ( 70 | ); 71 | name = Libraries; 72 | sourceTree = ""; 73 | }; 74 | 83CBB9F61A601CBA00E9B192 = { 75 | isa = PBXGroup; 76 | children = ( 77 | 13B07FAE1A68108700A75B9A /* SpeechExample */, 78 | 832341AE1AAA6A7D00B99B32 /* Libraries */, 79 | 83CBBA001A601CBA00E9B192 /* Products */, 80 | 2D16E6871FA4F8E400B85C8A /* Frameworks */, 81 | BBD78D7AC51CEA395F1C20DB /* Pods */, 82 | ); 83 | indentWidth = 2; 84 | sourceTree = ""; 85 | tabWidth = 2; 86 | usesTabs = 0; 87 | }; 88 | 83CBBA001A601CBA00E9B192 /* Products */ = { 89 | isa = PBXGroup; 90 | children = ( 91 | 13B07F961A680F5B00A75B9A /* SpeechExample.app */, 92 | ); 93 | name = Products; 94 | sourceTree = ""; 95 | }; 96 | BBD78D7AC51CEA395F1C20DB /* Pods */ = { 97 | isa = PBXGroup; 98 | children = ( 99 | 3B4392A12AC88292D35C810B /* Pods-SpeechExample.debug.xcconfig */, 100 | 5709B34CF0A7D63546082F79 /* Pods-SpeechExample.release.xcconfig */, 101 | ); 102 | path = Pods; 103 | sourceTree = ""; 104 | }; 105 | /* End PBXGroup section */ 106 | 107 | /* Begin PBXNativeTarget section */ 108 | 13B07F861A680F5B00A75B9A /* SpeechExample */ = { 109 | isa = PBXNativeTarget; 110 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "SpeechExample" */; 111 | buildPhases = ( 112 | C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */, 113 | 13B07F871A680F5B00A75B9A /* Sources */, 114 | 13B07F8C1A680F5B00A75B9A /* Frameworks */, 115 | 13B07F8E1A680F5B00A75B9A /* Resources */, 116 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 117 | 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */, 118 | E235C05ADACE081382539298 /* [CP] Copy Pods Resources */, 119 | ); 120 | buildRules = ( 121 | ); 122 | dependencies = ( 123 | ); 124 | name = SpeechExample; 125 | productName = SpeechExample; 126 | productReference = 13B07F961A680F5B00A75B9A /* SpeechExample.app */; 127 | productType = "com.apple.product-type.application"; 128 | }; 129 | /* End PBXNativeTarget section */ 130 | 131 | /* Begin PBXProject section */ 132 | 83CBB9F71A601CBA00E9B192 /* Project object */ = { 133 | isa = PBXProject; 134 | attributes = { 135 | LastUpgradeCheck = 1210; 136 | TargetAttributes = { 137 | 13B07F861A680F5B00A75B9A = { 138 | LastSwiftMigration = 1120; 139 | }; 140 | }; 141 | }; 142 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "SpeechExample" */; 143 | compatibilityVersion = "Xcode 12.0"; 144 | developmentRegion = en; 145 | hasScannedForEncodings = 0; 146 | knownRegions = ( 147 | en, 148 | Base, 149 | ); 150 | mainGroup = 83CBB9F61A601CBA00E9B192; 151 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */; 152 | projectDirPath = ""; 153 | projectRoot = ""; 154 | targets = ( 155 | 13B07F861A680F5B00A75B9A /* SpeechExample */, 156 | ); 157 | }; 158 | /* End PBXProject section */ 159 | 160 | /* Begin PBXResourcesBuildPhase section */ 161 | 13B07F8E1A680F5B00A75B9A /* Resources */ = { 162 | isa = PBXResourcesBuildPhase; 163 | buildActionMask = 2147483647; 164 | files = ( 165 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */, 166 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */, 167 | B195123ED1FF280162A16999 /* PrivacyInfo.xcprivacy in Resources */, 168 | ); 169 | runOnlyForDeploymentPostprocessing = 0; 170 | }; 171 | /* End PBXResourcesBuildPhase section */ 172 | 173 | /* Begin PBXShellScriptBuildPhase section */ 174 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = { 175 | isa = PBXShellScriptBuildPhase; 176 | buildActionMask = 2147483647; 177 | files = ( 178 | ); 179 | inputPaths = ( 180 | "$(SRCROOT)/.xcode.env.local", 181 | "$(SRCROOT)/.xcode.env", 182 | ); 183 | name = "Bundle React Native code and images"; 184 | outputPaths = ( 185 | ); 186 | runOnlyForDeploymentPostprocessing = 0; 187 | shellPath = /bin/sh; 188 | shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n"; 189 | }; 190 | 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = { 191 | isa = PBXShellScriptBuildPhase; 192 | buildActionMask = 2147483647; 193 | files = ( 194 | ); 195 | inputFileListPaths = ( 196 | "${PODS_ROOT}/Target Support Files/Pods-SpeechExample/Pods-SpeechExample-frameworks-${CONFIGURATION}-input-files.xcfilelist", 197 | ); 198 | name = "[CP] Embed Pods Frameworks"; 199 | outputFileListPaths = ( 200 | "${PODS_ROOT}/Target Support Files/Pods-SpeechExample/Pods-SpeechExample-frameworks-${CONFIGURATION}-output-files.xcfilelist", 201 | ); 202 | runOnlyForDeploymentPostprocessing = 0; 203 | shellPath = /bin/sh; 204 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-SpeechExample/Pods-SpeechExample-frameworks.sh\"\n"; 205 | showEnvVarsInLog = 0; 206 | }; 207 | C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */ = { 208 | isa = PBXShellScriptBuildPhase; 209 | buildActionMask = 2147483647; 210 | files = ( 211 | ); 212 | inputFileListPaths = ( 213 | ); 214 | inputPaths = ( 215 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock", 216 | "${PODS_ROOT}/Manifest.lock", 217 | ); 218 | name = "[CP] Check Pods Manifest.lock"; 219 | outputFileListPaths = ( 220 | ); 221 | outputPaths = ( 222 | "$(DERIVED_FILE_DIR)/Pods-SpeechExample-checkManifestLockResult.txt", 223 | ); 224 | runOnlyForDeploymentPostprocessing = 0; 225 | shellPath = /bin/sh; 226 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n"; 227 | showEnvVarsInLog = 0; 228 | }; 229 | E235C05ADACE081382539298 /* [CP] Copy Pods Resources */ = { 230 | isa = PBXShellScriptBuildPhase; 231 | buildActionMask = 2147483647; 232 | files = ( 233 | ); 234 | inputFileListPaths = ( 235 | "${PODS_ROOT}/Target Support Files/Pods-SpeechExample/Pods-SpeechExample-resources-${CONFIGURATION}-input-files.xcfilelist", 236 | ); 237 | name = "[CP] Copy Pods Resources"; 238 | outputFileListPaths = ( 239 | "${PODS_ROOT}/Target Support Files/Pods-SpeechExample/Pods-SpeechExample-resources-${CONFIGURATION}-output-files.xcfilelist", 240 | ); 241 | runOnlyForDeploymentPostprocessing = 0; 242 | shellPath = /bin/sh; 243 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-SpeechExample/Pods-SpeechExample-resources.sh\"\n"; 244 | showEnvVarsInLog = 0; 245 | }; 246 | /* End PBXShellScriptBuildPhase section */ 247 | 248 | /* Begin PBXSourcesBuildPhase section */ 249 | 13B07F871A680F5B00A75B9A /* Sources */ = { 250 | isa = PBXSourcesBuildPhase; 251 | buildActionMask = 2147483647; 252 | files = ( 253 | 761780ED2CA45674006654EE /* AppDelegate.swift in Sources */, 254 | ); 255 | runOnlyForDeploymentPostprocessing = 0; 256 | }; 257 | /* End PBXSourcesBuildPhase section */ 258 | 259 | /* Begin XCBuildConfiguration section */ 260 | 13B07F941A680F5B00A75B9A /* Debug */ = { 261 | isa = XCBuildConfiguration; 262 | baseConfigurationReference = 3B4392A12AC88292D35C810B /* Pods-SpeechExample.debug.xcconfig */; 263 | buildSettings = { 264 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 265 | CLANG_ENABLE_MODULES = YES; 266 | CURRENT_PROJECT_VERSION = 1; 267 | DEVELOPMENT_TEAM = ZB72KN377U; 268 | ENABLE_BITCODE = NO; 269 | INFOPLIST_FILE = SpeechExample/Info.plist; 270 | IPHONEOS_DEPLOYMENT_TARGET = 15.1; 271 | LD_RUNPATH_SEARCH_PATHS = ( 272 | "$(inherited)", 273 | "@executable_path/Frameworks", 274 | ); 275 | MARKETING_VERSION = 1.0; 276 | OTHER_LDFLAGS = ( 277 | "$(inherited)", 278 | "-ObjC", 279 | "-lc++", 280 | ); 281 | PRODUCT_BUNDLE_IDENTIFIER = com.mhpdev.rn.speech; 282 | PRODUCT_NAME = SpeechExample; 283 | SWIFT_OPTIMIZATION_LEVEL = "-Onone"; 284 | SWIFT_VERSION = 5.0; 285 | VERSIONING_SYSTEM = "apple-generic"; 286 | }; 287 | name = Debug; 288 | }; 289 | 13B07F951A680F5B00A75B9A /* Release */ = { 290 | isa = XCBuildConfiguration; 291 | baseConfigurationReference = 5709B34CF0A7D63546082F79 /* Pods-SpeechExample.release.xcconfig */; 292 | buildSettings = { 293 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; 294 | CLANG_ENABLE_MODULES = YES; 295 | CURRENT_PROJECT_VERSION = 1; 296 | DEVELOPMENT_TEAM = ZB72KN377U; 297 | INFOPLIST_FILE = SpeechExample/Info.plist; 298 | IPHONEOS_DEPLOYMENT_TARGET = 15.1; 299 | LD_RUNPATH_SEARCH_PATHS = ( 300 | "$(inherited)", 301 | "@executable_path/Frameworks", 302 | ); 303 | MARKETING_VERSION = 1.0; 304 | OTHER_LDFLAGS = ( 305 | "$(inherited)", 306 | "-ObjC", 307 | "-lc++", 308 | ); 309 | PRODUCT_BUNDLE_IDENTIFIER = com.mhpdev.rn.speech; 310 | PRODUCT_NAME = SpeechExample; 311 | SWIFT_VERSION = 5.0; 312 | VERSIONING_SYSTEM = "apple-generic"; 313 | }; 314 | name = Release; 315 | }; 316 | 83CBBA201A601CBA00E9B192 /* Debug */ = { 317 | isa = XCBuildConfiguration; 318 | buildSettings = { 319 | ALWAYS_SEARCH_USER_PATHS = NO; 320 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 321 | CLANG_CXX_LANGUAGE_STANDARD = "c++20"; 322 | CLANG_CXX_LIBRARY = "libc++"; 323 | CLANG_ENABLE_MODULES = YES; 324 | CLANG_ENABLE_OBJC_ARC = YES; 325 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 326 | CLANG_WARN_BOOL_CONVERSION = YES; 327 | CLANG_WARN_COMMA = YES; 328 | CLANG_WARN_CONSTANT_CONVERSION = YES; 329 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 330 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 331 | CLANG_WARN_EMPTY_BODY = YES; 332 | CLANG_WARN_ENUM_CONVERSION = YES; 333 | CLANG_WARN_INFINITE_RECURSION = YES; 334 | CLANG_WARN_INT_CONVERSION = YES; 335 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 336 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 337 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 338 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 339 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 340 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 341 | CLANG_WARN_STRICT_PROTOTYPES = YES; 342 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 343 | CLANG_WARN_UNREACHABLE_CODE = YES; 344 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 345 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 346 | COPY_PHASE_STRIP = NO; 347 | ENABLE_STRICT_OBJC_MSGSEND = YES; 348 | ENABLE_TESTABILITY = YES; 349 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = ""; 350 | GCC_C_LANGUAGE_STANDARD = gnu99; 351 | GCC_DYNAMIC_NO_PIC = NO; 352 | GCC_NO_COMMON_BLOCKS = YES; 353 | GCC_OPTIMIZATION_LEVEL = 0; 354 | GCC_PREPROCESSOR_DEFINITIONS = ( 355 | "DEBUG=1", 356 | "$(inherited)", 357 | ); 358 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 359 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 360 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 361 | GCC_WARN_UNDECLARED_SELECTOR = YES; 362 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 363 | GCC_WARN_UNUSED_FUNCTION = YES; 364 | GCC_WARN_UNUSED_VARIABLE = YES; 365 | IPHONEOS_DEPLOYMENT_TARGET = 15.1; 366 | LD_RUNPATH_SEARCH_PATHS = ( 367 | /usr/lib/swift, 368 | "$(inherited)", 369 | ); 370 | LIBRARY_SEARCH_PATHS = ( 371 | "\"$(SDKROOT)/usr/lib/swift\"", 372 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 373 | "\"$(inherited)\"", 374 | ); 375 | MTL_ENABLE_DEBUG_INFO = YES; 376 | ONLY_ACTIVE_ARCH = YES; 377 | OTHER_CPLUSPLUSFLAGS = ( 378 | "$(OTHER_CFLAGS)", 379 | "-DFOLLY_NO_CONFIG", 380 | "-DFOLLY_MOBILE=1", 381 | "-DFOLLY_USE_LIBCPP=1", 382 | "-DFOLLY_CFG_NO_COROUTINES=1", 383 | "-DFOLLY_HAVE_CLOCK_GETTIME=1", 384 | ); 385 | OTHER_LDFLAGS = ( 386 | "$(inherited)", 387 | " ", 388 | ); 389 | REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; 390 | SDKROOT = iphoneos; 391 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG"; 392 | USE_HERMES = true; 393 | }; 394 | name = Debug; 395 | }; 396 | 83CBBA211A601CBA00E9B192 /* Release */ = { 397 | isa = XCBuildConfiguration; 398 | buildSettings = { 399 | ALWAYS_SEARCH_USER_PATHS = NO; 400 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES; 401 | CLANG_CXX_LANGUAGE_STANDARD = "c++20"; 402 | CLANG_CXX_LIBRARY = "libc++"; 403 | CLANG_ENABLE_MODULES = YES; 404 | CLANG_ENABLE_OBJC_ARC = YES; 405 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES; 406 | CLANG_WARN_BOOL_CONVERSION = YES; 407 | CLANG_WARN_COMMA = YES; 408 | CLANG_WARN_CONSTANT_CONVERSION = YES; 409 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES; 410 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 411 | CLANG_WARN_EMPTY_BODY = YES; 412 | CLANG_WARN_ENUM_CONVERSION = YES; 413 | CLANG_WARN_INFINITE_RECURSION = YES; 414 | CLANG_WARN_INT_CONVERSION = YES; 415 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES; 416 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES; 417 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES; 418 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 419 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES; 420 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES; 421 | CLANG_WARN_STRICT_PROTOTYPES = YES; 422 | CLANG_WARN_SUSPICIOUS_MOVE = YES; 423 | CLANG_WARN_UNREACHABLE_CODE = YES; 424 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 425 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer"; 426 | COPY_PHASE_STRIP = YES; 427 | ENABLE_NS_ASSERTIONS = NO; 428 | ENABLE_STRICT_OBJC_MSGSEND = YES; 429 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = ""; 430 | GCC_C_LANGUAGE_STANDARD = gnu99; 431 | GCC_NO_COMMON_BLOCKS = YES; 432 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 433 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 434 | GCC_WARN_UNDECLARED_SELECTOR = YES; 435 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 436 | GCC_WARN_UNUSED_FUNCTION = YES; 437 | GCC_WARN_UNUSED_VARIABLE = YES; 438 | IPHONEOS_DEPLOYMENT_TARGET = 15.1; 439 | LD_RUNPATH_SEARCH_PATHS = ( 440 | /usr/lib/swift, 441 | "$(inherited)", 442 | ); 443 | LIBRARY_SEARCH_PATHS = ( 444 | "\"$(SDKROOT)/usr/lib/swift\"", 445 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"", 446 | "\"$(inherited)\"", 447 | ); 448 | MTL_ENABLE_DEBUG_INFO = NO; 449 | OTHER_CPLUSPLUSFLAGS = ( 450 | "$(OTHER_CFLAGS)", 451 | "-DFOLLY_NO_CONFIG", 452 | "-DFOLLY_MOBILE=1", 453 | "-DFOLLY_USE_LIBCPP=1", 454 | "-DFOLLY_CFG_NO_COROUTINES=1", 455 | "-DFOLLY_HAVE_CLOCK_GETTIME=1", 456 | ); 457 | OTHER_LDFLAGS = ( 458 | "$(inherited)", 459 | " ", 460 | ); 461 | REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native"; 462 | SDKROOT = iphoneos; 463 | USE_HERMES = true; 464 | VALIDATE_PRODUCT = YES; 465 | }; 466 | name = Release; 467 | }; 468 | /* End XCBuildConfiguration section */ 469 | 470 | /* Begin XCConfigurationList section */ 471 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "SpeechExample" */ = { 472 | isa = XCConfigurationList; 473 | buildConfigurations = ( 474 | 13B07F941A680F5B00A75B9A /* Debug */, 475 | 13B07F951A680F5B00A75B9A /* Release */, 476 | ); 477 | defaultConfigurationIsVisible = 0; 478 | defaultConfigurationName = Release; 479 | }; 480 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "SpeechExample" */ = { 481 | isa = XCConfigurationList; 482 | buildConfigurations = ( 483 | 83CBBA201A601CBA00E9B192 /* Debug */, 484 | 83CBBA211A601CBA00E9B192 /* Release */, 485 | ); 486 | defaultConfigurationIsVisible = 0; 487 | defaultConfigurationName = Release; 488 | }; 489 | /* End XCConfigurationList section */ 490 | }; 491 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */; 492 | } 493 | -------------------------------------------------------------------------------- /example/ios/SpeechExample.xcodeproj/xcshareddata/xcschemes/SpeechExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 33 | 39 | 40 | 41 | 42 | 43 | 53 | 55 | 61 | 62 | 63 | 64 | 70 | 72 | 78 | 79 | 80 | 81 | 83 | 84 | 87 | 88 | 89 | -------------------------------------------------------------------------------- /example/ios/SpeechExample.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 9 | 10 | 11 | -------------------------------------------------------------------------------- /example/ios/SpeechExample.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDEDidComputeMac32BitWarning 6 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/ios/SpeechExample/AppDelegate.swift: -------------------------------------------------------------------------------- 1 | import UIKit 2 | import React 3 | import React_RCTAppDelegate 4 | import ReactAppDependencyProvider 5 | 6 | @main 7 | class AppDelegate: RCTAppDelegate { 8 | override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool { 9 | self.moduleName = "SpeechExample" 10 | self.dependencyProvider = RCTAppDependencyProvider() 11 | 12 | // You can add your custom initial props in the dictionary below. 13 | // They will be passed down to the ViewController used by React Native. 14 | self.initialProps = [:] 15 | 16 | return super.application(application, didFinishLaunchingWithOptions: launchOptions) 17 | } 18 | 19 | override func sourceURL(for bridge: RCTBridge) -> URL? { 20 | self.bundleURL() 21 | } 22 | 23 | override func bundleURL() -> URL? { 24 | #if DEBUG 25 | RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index") 26 | #else 27 | Bundle.main.url(forResource: "main", withExtension: "jsbundle") 28 | #endif 29 | } 30 | } 31 | -------------------------------------------------------------------------------- /example/ios/SpeechExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "scale" : "2x", 6 | "size" : "20x20" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "scale" : "3x", 11 | "size" : "20x20" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "scale" : "2x", 16 | "size" : "29x29" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "scale" : "3x", 21 | "size" : "29x29" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "scale" : "2x", 26 | "size" : "40x40" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "scale" : "3x", 31 | "size" : "40x40" 32 | }, 33 | { 34 | "idiom" : "iphone", 35 | "scale" : "2x", 36 | "size" : "60x60" 37 | }, 38 | { 39 | "idiom" : "iphone", 40 | "scale" : "3x", 41 | "size" : "60x60" 42 | }, 43 | { 44 | "idiom" : "ios-marketing", 45 | "scale" : "1x", 46 | "size" : "1024x1024" 47 | } 48 | ], 49 | "info" : { 50 | "author" : "xcode", 51 | "version" : 1 52 | } 53 | } 54 | -------------------------------------------------------------------------------- /example/ios/SpeechExample/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /example/ios/SpeechExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | SpeechExample 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | $(MARKETING_VERSION) 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | $(CURRENT_PROJECT_VERSION) 25 | LSRequiresIPhoneOS 26 | 27 | NSAppTransportSecurity 28 | 29 | NSAllowsArbitraryLoads 30 | 31 | NSAllowsLocalNetworking 32 | 33 | 34 | NSLocationWhenInUseUsageDescription 35 | 36 | UILaunchStoryboardName 37 | LaunchScreen 38 | UIRequiredDeviceCapabilities 39 | 40 | arm64 41 | 42 | UISupportedInterfaceOrientations 43 | 44 | UIInterfaceOrientationPortrait 45 | UIInterfaceOrientationLandscapeLeft 46 | UIInterfaceOrientationLandscapeRight 47 | 48 | UIViewControllerBasedStatusBarAppearance 49 | 50 | 51 | 52 | -------------------------------------------------------------------------------- /example/ios/SpeechExample/LaunchScreen.storyboard: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 24 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | 44 | 45 | 46 | 47 | 48 | -------------------------------------------------------------------------------- /example/ios/SpeechExample/PrivacyInfo.xcprivacy: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | NSPrivacyAccessedAPITypes 6 | 7 | 8 | NSPrivacyAccessedAPIType 9 | NSPrivacyAccessedAPICategoryFileTimestamp 10 | NSPrivacyAccessedAPITypeReasons 11 | 12 | C617.1 13 | 14 | 15 | 16 | NSPrivacyAccessedAPIType 17 | NSPrivacyAccessedAPICategoryUserDefaults 18 | NSPrivacyAccessedAPITypeReasons 19 | 20 | CA92.1 21 | 22 | 23 | 24 | NSPrivacyAccessedAPIType 25 | NSPrivacyAccessedAPICategorySystemBootTime 26 | NSPrivacyAccessedAPITypeReasons 27 | 28 | 35F9.1 29 | 30 | 31 | 32 | NSPrivacyCollectedDataTypes 33 | 34 | NSPrivacyTracking 35 | 36 | 37 | 38 | -------------------------------------------------------------------------------- /example/jest.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | preset: 'react-native', 3 | }; 4 | -------------------------------------------------------------------------------- /example/metro.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const {getDefaultConfig} = require('@react-native/metro-config'); 3 | const {getConfig} = require('react-native-builder-bob/metro-config'); 4 | const pkg = require('../package.json'); 5 | 6 | const root = path.resolve(__dirname, '..'); 7 | 8 | /** 9 | * Metro configuration 10 | * https://facebook.github.io/metro/docs/configuration 11 | * 12 | * @type {import('metro-config').MetroConfig} 13 | */ 14 | module.exports = getConfig(getDefaultConfig(__dirname), { 15 | root, 16 | pkg, 17 | project: __dirname, 18 | }); 19 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-speech-example", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "android": "react-native run-android", 7 | "ios": "react-native run-ios --simulator=\"iPhone 16 Pro Max\"", 8 | "start": "react-native start", 9 | "build:android": "react-native build-android --extra-params \"--no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a\"", 10 | "build:ios": "react-native build-ios --scheme SpeechExample --mode Debug --extra-params \"-sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO\"" 11 | }, 12 | "dependencies": { 13 | "react": "19.0.0", 14 | "react-native": "0.78.0", 15 | "react-native-full-responsive": "^2.4.1", 16 | "react-native-safe-area-context": "^5.3.0" 17 | }, 18 | "devDependencies": { 19 | "@babel/core": "^7.25.2", 20 | "@babel/preset-env": "^7.25.3", 21 | "@babel/runtime": "^7.25.0", 22 | "@react-native-community/cli": "15.0.1", 23 | "@react-native-community/cli-platform-android": "15.0.1", 24 | "@react-native-community/cli-platform-ios": "15.0.1", 25 | "@react-native/babel-preset": "0.78.0", 26 | "@react-native/metro-config": "0.78.0", 27 | "@react-native/typescript-config": "0.78.0", 28 | "react-native-builder-bob": "^0.36.0" 29 | }, 30 | "engines": { 31 | "node": ">=18" 32 | } 33 | } 34 | -------------------------------------------------------------------------------- /example/react-native.config.js: -------------------------------------------------------------------------------- 1 | const path = require('path'); 2 | const pkg = require('../package.json'); 3 | 4 | module.exports = { 5 | project: { 6 | ios: { 7 | automaticPodsInstallation: true, 8 | }, 9 | }, 10 | dependencies: { 11 | [pkg.name]: { 12 | root: path.join(__dirname, '..'), 13 | platforms: { 14 | // Codegen script incorrectly fails without this 15 | // So we explicitly specify the platforms with empty object 16 | ios: {}, 17 | android: {}, 18 | }, 19 | }, 20 | }, 21 | }; 22 | -------------------------------------------------------------------------------- /example/src/App.tsx: -------------------------------------------------------------------------------- 1 | import RootView from './views/RootView'; 2 | import {FRProvider} from 'react-native-full-responsive'; 3 | import {SafeAreaProvider} from 'react-native-safe-area-context'; 4 | 5 | export default function App() { 6 | return ( 7 | 8 | 9 | 10 | 11 | 12 | ); 13 | } 14 | -------------------------------------------------------------------------------- /example/src/components/Button.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {gs} from '../styles/gs'; 3 | import {Text, TouchableOpacity, type TouchableOpacityProps} from 'react-native'; 4 | 5 | export interface ButtonProps extends TouchableOpacityProps { 6 | label: string; 7 | } 8 | 9 | const Button: React.FC = ({label, disabled, ...rest}) => { 10 | return ( 11 | 15 | {label} 16 | 17 | ); 18 | }; 19 | 20 | export default Button; 21 | -------------------------------------------------------------------------------- /example/src/styles/gs.ts: -------------------------------------------------------------------------------- 1 | import {createRStyle} from 'react-native-full-responsive'; 2 | 3 | export const gs = createRStyle({ 4 | flex: { 5 | flex: 1, 6 | }, 7 | disabled: { 8 | opacity: 0.6, 9 | }, 10 | button: { 11 | flex: 1, 12 | height: '35rs', 13 | borderRadius: '5rs', 14 | alignItems: 'center', 15 | justifyContent: 'center', 16 | backgroundColor: 'skyblue', 17 | }, 18 | buttonText: { 19 | color: '#000000', 20 | fontSize: '14rs', 21 | fontWeight: '600', 22 | }, 23 | title: { 24 | fontSize: '18rs', 25 | fontWeight: '700', 26 | marginBottom: '10rs', 27 | textAlign: 'center', 28 | }, 29 | paragraph: { 30 | fontSize: '14rs', 31 | lineHeight: '22rs', 32 | textAlign: 'justify', 33 | }, 34 | p10: { 35 | padding: '10rs', 36 | }, 37 | row: { 38 | columnGap: '5rs', 39 | flexDirection: 'row', 40 | }, 41 | }); 42 | -------------------------------------------------------------------------------- /example/src/views/RootView.tsx: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {gs} from '../styles/gs'; 3 | import Button from '../components/Button'; 4 | import {Alert, StyleSheet, Text, View} from 'react-native'; 5 | import {SafeAreaView} from 'react-native-safe-area-context'; 6 | import Speech, { 7 | HighlightedText, 8 | type HighlightedSegmentArgs, 9 | type HighlightedSegmentProps, 10 | } from '@mhpdev/react-native-speech'; 11 | 12 | const Introduction = 13 | "This high-performance text-to-speech library is built for bare React Native and Expo, compatible with Android and iOS's new architecture (default from React Native 0.76). It enables seamless speech management with start, pause, resume, and stop controls, and provides events for detailed synthesis management."; 14 | 15 | const RootView: React.FC = () => { 16 | const [isPaused, setIsPaused] = React.useState(false); 17 | 18 | const [isStarted, setIsStarted] = React.useState(false); 19 | 20 | const [highlights, setHighlights] = React.useState< 21 | Array 22 | >([]); 23 | 24 | React.useEffect(() => { 25 | const onSpeechEnd = () => { 26 | setIsStarted(false); 27 | setIsPaused(false); 28 | setHighlights([]); 29 | }; 30 | 31 | const startSubscription = Speech.onStart(({id}) => { 32 | console.log(`Speech ${id} started`); 33 | }); 34 | const finishSubscription = Speech.onFinish(({id}) => { 35 | onSpeechEnd(); 36 | console.log(`Speech ${id} finished`); 37 | }); 38 | const pauseSubscription = Speech.onPause(({id}) => { 39 | setIsPaused(true); 40 | console.log(`Speech ${id} paused`); 41 | }); 42 | const resumeSubscription = Speech.onResume(({id}) => { 43 | console.log(`Speech ${id} resumed`); 44 | }); 45 | const stoppedSubscription = Speech.onStopped(({id}) => { 46 | onSpeechEnd(); 47 | console.log(`Speech ${id} stopped`); 48 | }); 49 | const progressSubscription = Speech.onProgress(({id, location, length}) => { 50 | setHighlights([ 51 | { 52 | start: location, 53 | end: location + length, 54 | }, 55 | ]); 56 | console.log( 57 | `Speech ${id} progress, current word length: ${length}, current char position: ${location}`, 58 | ); 59 | }); 60 | 61 | // (async () => { 62 | // const enVoices = await Speech.getAvailableVoices('en-us'); 63 | // Speech.initialize({ 64 | // rate: 0.5, 65 | // volume: 1, 66 | // voice: enVoices[3]?.identifier, 67 | // }); 68 | // })(); 69 | 70 | return () => { 71 | startSubscription.remove(); 72 | finishSubscription.remove(); 73 | pauseSubscription.remove(); 74 | resumeSubscription.remove(); 75 | stoppedSubscription.remove(); 76 | progressSubscription.remove(); 77 | }; 78 | }, []); 79 | 80 | const onStartPress = React.useCallback(() => { 81 | setIsStarted(true); 82 | Speech.speak(Introduction); 83 | }, []); 84 | 85 | const onResumePress = React.useCallback(() => { 86 | setIsPaused(false); 87 | Speech.resume(); 88 | }, []); 89 | 90 | const onHighlightedPress = React.useCallback( 91 | ({text, start, end}: HighlightedSegmentArgs) => 92 | Alert.alert( 93 | 'Highlighted', 94 | `The current segment is "${text}", starting at ${start} and ending at ${end}`, 95 | ), 96 | [], 97 | ); 98 | 99 | return ( 100 | 101 | 102 | Introduction 103 | 110 | 111 | 112 |