Files
mattermost-mobile/app/components/button/index.tsx
Daniel Espino García 5fae120826 Add support for review app (#6772)
* Add app review

* Use overlay instead of modal

* Add fixes for ios

* i18n-extract

* Add to milliseconds function

* Address review feedback

* Add try to queryGlobalValue

* added app review illustration

* add feedback illustration

* Add animations and feedback bot message

* Restrict reviews to build environment variable

* Fix bug with "dont ask anymore"

* Add check for only supported servers

* Add missing change

* Use for await

Co-authored-by: Daniel Espino <danielespino@MacBook-Pro-de-Daniel.local>
Co-authored-by: Matthew Birtch <mattbirtch@gmail.com>
2022-11-24 18:52:15 +01:00

62 lines
1.5 KiB
TypeScript

// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
// See LICENSE.txt for license information.
import React, {useMemo} from 'react';
import {StyleProp, Text, TextStyle, ViewStyle} from 'react-native';
import RNButton from 'react-native-button';
import {buttonBackgroundStyle, buttonTextStyle} from '@utils/buttonStyles';
type Props = {
theme: Theme;
backgroundStyle?: StyleProp<ViewStyle>;
textStyle?: StyleProp<TextStyle>;
size?: ButtonSize;
emphasis?: ButtonEmphasis;
buttonType?: ButtonType;
buttonState?: ButtonState;
testID?: string;
onPress: () => void;
text: string;
}
const Button = ({
theme,
backgroundStyle,
textStyle,
size,
emphasis,
buttonType,
buttonState,
onPress,
text,
testID,
}: Props) => {
const bgStyle = useMemo(() => [
buttonBackgroundStyle(theme, size, emphasis, buttonType, buttonState),
backgroundStyle,
], [theme, backgroundStyle, size, emphasis, buttonType, buttonState]);
const txtStyle = useMemo(() => [
buttonTextStyle(theme, size, emphasis, buttonType),
textStyle,
], [theme, textStyle, size, emphasis, buttonType]);
return (
<RNButton
containerStyle={bgStyle}
onPress={onPress}
testID={testID}
>
<Text
style={txtStyle}
numberOfLines={1}
>
{text}
</Text>
</RNButton>
);
};
export default Button;