"Fossies" - the Fresh Open Source Software Archive 
Member "jitsi-meet-7305/react/features/display-name/components/native/DisplayNameLabel.tsx" (26 May 2023, 2208 Bytes) of package /linux/misc/jitsi-meet-7305.tar.gz:
As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) TSX (TypeScript with React) source code syntax highlighting (style:
standard) with prefixed line numbers.
Alternatively you can here
view or
download the uninterpreted source code file.
See also the last
Fossies "Diffs" side-by-side code changes report for "DisplayNameLabel.tsx":
jitsi-meet_8319_vs_jitsi-meet_8615.
1 import * as React from 'react';
2 import { Text, TextStyle, View, ViewStyle } from 'react-native';
3 import { connect } from 'react-redux';
4
5 import { IReduxState } from '../../../app/types';
6 import {
7 getParticipantById,
8 getParticipantDisplayName,
9 isScreenShareParticipant
10 } from '../../../base/participants/functions';
11
12 import styles from './styles';
13
14 interface IProps {
15
16 /**
17 * The name of the participant to render.
18 */
19 _participantName: string;
20
21 /**
22 * True of the label needs to be rendered. False otherwise.
23 */
24 _render: boolean;
25
26 /**
27 * Whether or not the name is in a container.
28 */
29 contained?: boolean;
30
31 /**
32 * The ID of the participant to render the label for.
33 */
34 participantId: string;
35 }
36
37 /**
38 * Renders a label with the display name of the on-stage participant.
39 */
40 class DisplayNameLabel extends React.Component<IProps> {
41 /**
42 * Implements {@code Component#render}.
43 *
44 * @inheritdoc
45 */
46 render() {
47 if (!this.props._render) {
48 return null;
49 }
50
51 return (
52 <View
53 style = { (this.props.contained ? styles.displayNamePadding : styles.displayNameBackdrop
54 ) as ViewStyle }>
55 <Text
56 numberOfLines = { 1 }
57 style = { styles.displayNameText as TextStyle }>
58 { this.props._participantName }
59 </Text>
60 </View>
61 );
62 }
63 }
64
65 /**
66 * Maps part of the Redux state to the props of this component.
67 *
68 * @param {any} state - The Redux state.
69 * @param {IProps} ownProps - The own props of the component.
70 * @returns {IProps}
71 */
72 function _mapStateToProps(state: IReduxState, ownProps: Partial<IProps>) {
73 const participant = getParticipantById(state, ownProps.participantId ?? '');
74
75 return {
76 _participantName: getParticipantDisplayName(state, ownProps.participantId ?? ''),
77 _render: Boolean(participant && (!participant?.local || ownProps.contained)
78 && (!participant?.fakeParticipant || isScreenShareParticipant(participant)))
79 };
80 }
81
82 export default connect(_mapStateToProps)(DisplayNameLabel);