@openpeepshq/rn-components 0.5.0 → 0.5.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@openpeepshq/rn-components",
3
- "version": "0.5.0",
3
+ "version": "0.5.1",
4
4
  "description": "React Native community screens and shared UI (extracted from the Black Ambition app) for the OpenPeeps stack.",
5
5
  "source": "./src/index.ts",
6
6
  "main": "./src/index.ts",
@@ -1,5 +1,6 @@
1
- import React from 'react';
1
+ import React, { useEffect, useRef } from 'react';
2
2
  import { Pressable, StyleSheet, View } from 'react-native';
3
+ import Sound from 'react-native-sound';
3
4
  import {
4
5
  isTrackReference,
5
6
  type TrackReferenceOrPlaceholder,
@@ -175,6 +176,7 @@ const JamParticipantOverlay = ({
175
176
 
176
177
  const micOn = participant.isMicrophoneEnabled;
177
178
  const handUp = raisedHands.has(participant.identity);
179
+ const handRaiseSound = useRef<Sound | null>(null);
178
180
  const profile = parseParticipantMetadata(participant.metadata).profile;
179
181
  const isModerator = jam.moderators.includes(participant.identity);
180
182
  const viewerIsModerator = !!me && jam.moderators.includes(me.id);
@@ -182,6 +184,28 @@ const JamParticipantOverlay = ({
182
184
  const micIconClass =
183
185
  micOn && speaking && !connectionLost ? 'text-primary' : 'text-foreground';
184
186
 
187
+ useEffect(() => {
188
+ const sound = new Sound(
189
+ require('../../assets/audio/click-notification.wav'),
190
+ (err) => {
191
+ if (!err) {
192
+ sound.setVolume(0.5);
193
+ handRaiseSound.current = sound;
194
+ }
195
+ }
196
+ );
197
+ return () => {
198
+ sound.release();
199
+ handRaiseSound.current = null;
200
+ };
201
+ }, []);
202
+
203
+ useEffect(() => {
204
+ if (handUp) {
205
+ handRaiseSound.current?.play();
206
+ }
207
+ }, [handUp]);
208
+
185
209
  return (
186
210
  <View
187
211
  pointerEvents="box-none"