This documentation is available as Markdown for AI agents and LLMs. See the full Markdown index or append .md to any documentation URL.

Expo 演讲 iconExpo 演讲

提供对文本转语音功能的访问的库。

Android
iOS
Web
Included in Expo Go
Recommended version:
~58.0.3

expo-speech 提供了一个 API,使你能够在应用中使用文本转语音功能。

安装

🌐 Installation

Terminal
- npx expo install expo-speech
- yarn expo install expo-speech
- pnpm expo install expo-speech
- bun expo install expo-speech

If you are installing this in an existing React Native app, make sure to install expo in your project.

用法

🌐 Usage

Speech
import { View, StyleSheet, Button } from 'react-native'; import * as Speech from 'expo-speech'; export default function App() { const speak = () => { const thingToSay = '1'; Speech.speak(thingToSay); }; return ( <View style={styles.container}> <Button title="按下以听一些单词" onPress={speak} /> </View> ); } const styles = StyleSheet.create({ container: { flex: 1, justifyContent: 'center', backgroundColor: '#ecf0f1', padding: 8, }, });

应用接口

🌐 API

import * as Speech from 'expo-speech';

No API data file found, sorry!