Files
jitsi-meet/react/features/base/react/components/native/Pressable.js
Zoltan Bettenbuk decbcefbd4 [RN] Don't press on Conference in preparation for 'pinch to zoom'
TouchableWithoutFeedback and TouchableHighlight interfere with the
implementation of 'pinch to zoom' to come. We prepare for it by driving
the onClick/onPress handler(s) out of Conference, through LargeVideo and
ParticipantView into Video itself where the bulk of 'pinch to zoom' will
be implemented.
2018-04-10 01:20:52 -05:00

47 lines
1.2 KiB
JavaScript

// @flow
import React, { Component } from 'react';
import { TouchableWithoutFeedback } from 'react-native';
/**
* The type of the React {@link Component} props of {@link Pressable}.
*/
type Props = {
children: React$Node,
/**
* Called when the touch is released, but not if cancelled (e.g. by a scroll
* that steals the responder lock).
*/
onPress: Function
};
/**
* Adds support for {@code onPress} to a child React {@link Component} (which
* should probably not support the prop in question; otherwise, there's little
* point of using {@code Pressable} then in the first place).
*/
export default class Pressable extends Component<Props> {
/**
* Implements React's {@link Component#render()}.
*
* @inheritdoc
* @returns {React$Node}
*/
render() {
// onPress
const { children, onPress } = this.props;
if (onPress) {
return (
<TouchableWithoutFeedback onPress = { onPress }>
{ children }
</TouchableWithoutFeedback>
);
}
// A Pressable without an onPress is a "no-op".
return children;
}
}