diff --git a/1224/react-native-sound.md b/1224/react-native-sound.md new file mode 100644 index 0000000000000000000000000000000000000000..33e760292ad0de64f78f56606d3c4a375d25619a --- /dev/null +++ b/1224/react-native-sound.md @@ -0,0 +1,337 @@ +> 模板版本:v0.1.3 + +

+

react-native-sound

+

+

+ + Supported platforms + + + License + + +

+ + + +> [!TIP] [Github 地址](https://github.com/react-native-oh-library/react-native-sound) + +## 安装与使用 + +请到三方库的 Releases 发布地址查看配套的版本信息:[<@react-native-oh-library/react-native-sound> Releases](https://github.com/react-native-oh-library/react-native-sound/releases),并下载适用版本的 tgz 包。 + +进入到工程目录并输入以下命令: + +>[!TIP] # 处替换为 tgz 包的路径 + + + +#### npm + +```bash +npm install @react-native-oh-tpl/react-native-sound@file:# +``` + +#### yarn + +```bash +yarn add @react-native-oh-tpl/react-native-sound@file:# +``` + + + +下面的代码展示了这个库的基本使用场景: + +>[!WARNING] 使用时 import 的库名不变。 + +```tsx +import React, { useState } from 'react'; +import type {PropsWithChildren} from 'react'; +import { + SafeAreaView, + ScrollView, + StatusBar, + StyleSheet, + Text, + useColorScheme, + View, + Button +} from 'react-native'; + +import { + Colors, + DebugInstructions, + Header, + LearnMoreLinks, + ReloadInstructions, +} from 'react-native/Libraries/NewAppScreen'; + +import Sound from 'react-native-sound'; + +type SectionProps = PropsWithChildren<{ + title: string; + func: ()=> void; +}>; + +type SliderSectionProps = PropsWithChildren<{ + duration:number; + value: number; + func: ()=> void; +}>; + +function Section({title,func}: SectionProps): JSX.Element { + const isDarkMode = useColorScheme() === 'dark'; + return ( + +