mirror of
https://gitcode.com/GitHub_Trending/ji/jitsi-meet.git
synced 2026-01-19 05:00:18 +00:00
71 lines
1.8 KiB
JavaScript
71 lines
1.8 KiB
JavaScript
// @flow
|
|
|
|
import React from 'react';
|
|
import {
|
|
TouchableHighlight,
|
|
TouchableWithoutFeedback,
|
|
View
|
|
} from 'react-native';
|
|
|
|
import AbstractContainer from '../AbstractContainer';
|
|
import type { Props } from '../AbstractContainer';
|
|
|
|
/**
|
|
* Represents a container of React Native/mobile {@link Component} children.
|
|
*
|
|
* @extends AbstractContainer
|
|
*/
|
|
export default class Container<P: Props> extends AbstractContainer<P> {
|
|
/**
|
|
* Implements React's {@link Component#render()}.
|
|
*
|
|
* @inheritdoc
|
|
* @returns {ReactElement}
|
|
*/
|
|
render() {
|
|
const {
|
|
accessibilityLabel,
|
|
accessible,
|
|
onClick,
|
|
onLongPress,
|
|
touchFeedback = onClick,
|
|
underlayColor,
|
|
visible = true,
|
|
...props
|
|
} = this.props;
|
|
|
|
// visible
|
|
if (!visible) {
|
|
return null;
|
|
}
|
|
|
|
const onClickOrTouchFeedback = onClick || onLongPress || touchFeedback;
|
|
let element
|
|
= super._render(
|
|
View,
|
|
{
|
|
pointerEvents: onClickOrTouchFeedback ? 'auto' : 'box-none',
|
|
...props
|
|
});
|
|
|
|
// onClick & touchFeedback
|
|
if (element && onClickOrTouchFeedback) {
|
|
element
|
|
= React.createElement(
|
|
touchFeedback
|
|
? TouchableHighlight
|
|
: TouchableWithoutFeedback,
|
|
{
|
|
accessibilityLabel,
|
|
accessible,
|
|
onLongPress,
|
|
onPress: onClick,
|
|
...touchFeedback && { underlayColor }
|
|
},
|
|
element);
|
|
}
|
|
|
|
return element;
|
|
}
|
|
}
|