From b1f57a42c32f90e2f0df4a2dc16f823627d6ea4f Mon Sep 17 00:00:00 2001 From: fanqingbiao Date: Fri, 23 Feb 2024 14:36:15 +0800 Subject: [PATCH 1/2] =?UTF-8?q?[Issues:=20#I92Y4J]=20=E6=B7=BB=E5=8A=A0rea?= =?UTF-8?q?ct-native-sound=20=E6=8C=87=E5=AF=BC=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- 1224/react-native-sound.md | 337 +++++++++++++++++++++++++++++++++++++ 1 file changed, 337 insertions(+) create mode 100644 1224/react-native-sound.md diff --git a/1224/react-native-sound.md b/1224/react-native-sound.md new file mode 100644 index 00000000..62cf3dfc --- /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 ( + +