@100mslive/react-native-room-kit
Version:
100ms Room Kit provides simple & easy to use UI components to build Live Streaming & Video Conferencing experiences in your apps.
68 lines • 1.85 kB
JavaScript
import * as React from 'react';
import { ActivityIndicator, StyleSheet, Text, TouchableHighlight, TouchableOpacity, View } from 'react-native';
import { Gesture, GestureDetector } from 'react-native-gesture-handler';
export const HMSBaseButton = ({
testID,
underlayColor,
loaderColor,
title,
loading,
onPress,
style,
textStyle,
disabled,
leftComponent,
wrapWithGestureDetector,
useTouchableOpacity
}) => {
const Touchable = useTouchableOpacity ? TouchableOpacity : TouchableHighlight;
const button = /*#__PURE__*/React.createElement(Touchable, {
testID: testID,
underlayColor: underlayColor,
style: [styles.button, style],
onPress: onPress,
disabled: disabled
}, /*#__PURE__*/React.createElement(React.Fragment, null, loading ? /*#__PURE__*/React.createElement(ActivityIndicator, {
size: 'small',
color: loaderColor,
style: styles.loader
}) : null, /*#__PURE__*/React.createElement(View, {
style: [styles.buttonContentWrapper, loading ? styles.hiddenView : null]
}, leftComponent, /*#__PURE__*/React.createElement(Text, {
style: [styles.text, textStyle]
}, title))));
if (wrapWithGestureDetector) {
return /*#__PURE__*/React.createElement(GestureDetector, {
gesture: Gesture.Tap()
}, button);
}
return button;
};
const styles = StyleSheet.create({
button: {
flexDirection: 'row',
paddingHorizontal: 16,
paddingVertical: 8,
borderRadius: 8,
alignItems: 'center',
justifyContent: 'center'
},
buttonContentWrapper: {
flexDirection: 'row',
alignItems: 'center',
justifyContent: 'center'
},
text: {
fontSize: 16,
lineHeight: 24,
letterSpacing: 0.5,
marginHorizontal: 8
},
loader: {
position: 'absolute'
},
hiddenView: {
opacity: 0
}
});
//# sourceMappingURL=HMSBaseButton.js.map