mattermost-mobile/app/components/touchable_with_feedback/touchable_with_feedback.android.js
Joseph Baylon 48dbb75471
MM-29024 Detox/E2E: Add unit and e2e tests for disabled mobile upload (#4954)
* MM-29024 Detox/E2E: Add unit and e2e tests for disabled mobile upload

* Simplified element call

* Remove extra lines

* Added e2e for mobile upload enabled - quick actions

* Fix upload item snap file

* Added check for license

* Fix lint

* Update function export

Co-authored-by: Mattermod <mattermod@users.noreply.github.com>
2020-11-12 21:29:16 -03:00

62 lines
1.8 KiB
JavaScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
/* eslint-disable new-cap */
import React, {PureComponent} from 'react';
import {TouchableNativeFeedback, TouchableOpacity, TouchableWithoutFeedback, View} from 'react-native';
import PropTypes from 'prop-types';
import CustomPropTypes from 'app/constants/custom_prop_types';
export default class TouchableWithFeedbackAndroid extends PureComponent {
static propTypes = {
testID: PropTypes.string,
children: CustomPropTypes.Children,
underlayColor: PropTypes.string,
type: PropTypes.oneOf(['native', 'opacity', 'none']),
};
static defaultProps = {
type: 'native',
};
render() {
const {testID, children, underlayColor, type, ...props} = this.props;
switch (type) {
case 'native':
return (
<TouchableNativeFeedback
testID={testID}
{...props}
background={TouchableNativeFeedback.Ripple(underlayColor || '#000', false)}
>
<View>
{children}
</View>
</TouchableNativeFeedback>
);
case 'opacity':
return (
<TouchableOpacity
testID={testID}
{...props}
>
{children}
</TouchableOpacity>
);
case 'none':
return (
<TouchableWithoutFeedback
testID={testID}
{...props}
>
{children}
</TouchableWithoutFeedback>
);
}
return null;
}
}