@openpeepshq/rn-components 0.8.6 → 0.8.7
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.8.
|
|
3
|
+
"version": "0.8.7",
|
|
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,4 +1,4 @@
|
|
|
1
|
-
import React, { useEffect, useRef } from 'react';
|
|
1
|
+
import React, { useEffect, useReducer, useRef } from 'react';
|
|
2
2
|
import { Pressable, StyleSheet, View } from 'react-native';
|
|
3
3
|
import Sound from 'react-native-sound';
|
|
4
4
|
import {
|
|
@@ -289,7 +289,24 @@ export const JamCallParticipant = ({
|
|
|
289
289
|
const profile = parseParticipantMetadata(participant.metadata).profile;
|
|
290
290
|
const connectionLost = useConnectionLost(participant);
|
|
291
291
|
const speaking = useIsSpeaking(participant);
|
|
292
|
-
|
|
292
|
+
// React Native's RTCView only re-resolves its media stream when the
|
|
293
|
+
// `streamURL` string changes, but a renegotiated track can arrive under the
|
|
294
|
+
// same MediaStream reactTag, leaving the native view bound to a dead track
|
|
295
|
+
// (blank tile). Remount the video view whenever the track object changes.
|
|
296
|
+
const cameraTrack = isTrackReference(trackRef)
|
|
297
|
+
? trackRef.publication.track
|
|
298
|
+
: undefined;
|
|
299
|
+
const [trackEpoch, bumpTrackEpoch] = useReducer(
|
|
300
|
+
(count: number) => count + 1,
|
|
301
|
+
0
|
|
302
|
+
);
|
|
303
|
+
useEffect(() => {
|
|
304
|
+
bumpTrackEpoch();
|
|
305
|
+
}, [cameraTrack]);
|
|
306
|
+
const cameraOn =
|
|
307
|
+
isTrackReference(trackRef) &&
|
|
308
|
+
!!cameraTrack &&
|
|
309
|
+
!trackRef.publication.isMuted;
|
|
293
310
|
const displayName =
|
|
294
311
|
profile?.displayName || (profile?.handle ? `@${profile.handle}` : '');
|
|
295
312
|
|
|
@@ -310,6 +327,7 @@ export const JamCallParticipant = ({
|
|
|
310
327
|
>
|
|
311
328
|
{cameraOn ? (
|
|
312
329
|
<VideoTrack
|
|
330
|
+
key={`${trackRef.publication.trackSid}-${trackEpoch}`}
|
|
313
331
|
trackRef={trackRef}
|
|
314
332
|
style={StyleSheet.absoluteFill}
|
|
315
333
|
objectFit="cover"
|
|
@@ -9,7 +9,7 @@ import { KeyboardAwareScrollView } from 'react-native-keyboard-aware-scroll-view
|
|
|
9
9
|
import { CompositeScreenProps } from '@react-navigation/native';
|
|
10
10
|
import { NativeStackScreenProps } from '@react-navigation/native-stack';
|
|
11
11
|
import { canCreateGroup } from '@openpeepshq/common';
|
|
12
|
-
import { useOpenpeeps } from '@openpeepshq/react';
|
|
12
|
+
import { useCurrentProfile, useOpenpeeps } from '@openpeepshq/react';
|
|
13
13
|
import { useTranslation } from 'react-i18next';
|
|
14
14
|
import {
|
|
15
15
|
useSetPageHeader,
|
|
@@ -34,7 +34,8 @@ type GroupsProps = CompositeScreenProps<
|
|
|
34
34
|
|
|
35
35
|
export const GroupsIndex: React.FC<GroupsProps> = ({ navigation }) => {
|
|
36
36
|
const { t } = useTranslation();
|
|
37
|
-
const { openpeepsApi
|
|
37
|
+
const { openpeepsApi } = useOpenpeeps();
|
|
38
|
+
const currentProfile = useCurrentProfile();
|
|
38
39
|
const { data: groups, refetch, isLoading } = openpeepsApi.useGroups();
|
|
39
40
|
const unseenCountsQuery = openpeepsApi.useUnseenPostCounts();
|
|
40
41
|
const unseenByGroup = unseenCountsQuery.data?.groups ?? {};
|