2020-06-01 14:54:23 +02:00
|
|
|
/* eslint react/prop-types: "off", react-native/no-inline-styles: "off" */
|
2024-06-08 18:18:56 +02:00
|
|
|
import React, { forwardRef } from 'react';
|
2024-08-24 20:06:17 +02:00
|
|
|
import { ActivityIndicator, Dimensions, I18nManager, Platform, StyleSheet, TextInput, TouchableOpacity, View } from 'react-native';
|
2024-06-12 18:46:44 +02:00
|
|
|
import { Icon, Text } from '@rneui/themed';
|
2024-06-08 18:18:56 +02:00
|
|
|
import { useTheme } from './components/themes';
|
2021-02-25 04:09:41 +01:00
|
|
|
|
2018-05-12 22:27:34 +02:00
|
|
|
const { height, width } = Dimensions.get('window');
|
|
|
|
const aspectRatio = height / width;
|
|
|
|
let isIpad;
|
|
|
|
if (aspectRatio > 1.6) {
|
|
|
|
isIpad = false;
|
|
|
|
} else {
|
|
|
|
isIpad = true;
|
|
|
|
}
|
2018-01-30 23:42:38 +01:00
|
|
|
|
2021-07-20 15:10:45 +02:00
|
|
|
/**
|
|
|
|
* TODO: remove this comment once this file gets properly converted to typescript.
|
|
|
|
*
|
|
|
|
* @type {React.FC<any>}
|
|
|
|
*/
|
2021-02-27 01:23:59 +01:00
|
|
|
export const BlueButtonLink = forwardRef((props, ref) => {
|
2020-07-15 19:32:59 +02:00
|
|
|
const { colors } = useTheme();
|
|
|
|
return (
|
|
|
|
<TouchableOpacity
|
2021-06-24 14:50:57 +02:00
|
|
|
accessibilityRole="button"
|
2020-07-15 19:32:59 +02:00
|
|
|
style={{
|
|
|
|
minWidth: 100,
|
2024-09-11 00:36:31 +02:00
|
|
|
minHeight: 36,
|
2020-07-15 19:32:59 +02:00
|
|
|
justifyContent: 'center',
|
|
|
|
}}
|
2020-08-11 00:38:07 +02:00
|
|
|
{...props}
|
2021-02-27 01:23:59 +01:00
|
|
|
ref={ref}
|
2020-07-15 19:32:59 +02:00
|
|
|
>
|
2020-08-11 00:38:07 +02:00
|
|
|
<Text style={{ color: colors.foregroundColor, textAlign: 'center', fontSize: 16 }}>{props.title}</Text>
|
2020-07-15 19:32:59 +02:00
|
|
|
</TouchableOpacity>
|
|
|
|
);
|
2021-02-27 01:23:59 +01:00
|
|
|
});
|
2020-07-15 19:32:59 +02:00
|
|
|
|
2020-11-30 05:18:54 +01:00
|
|
|
export const BlueCard = props => {
|
|
|
|
return <View {...props} style={{ padding: 20 }} />;
|
|
|
|
};
|
2018-01-30 23:42:38 +01:00
|
|
|
|
2020-11-22 09:04:04 +01:00
|
|
|
export const BlueText = props => {
|
2020-07-15 19:32:59 +02:00
|
|
|
const { colors } = useTheme();
|
2021-08-20 10:16:57 +02:00
|
|
|
const style = StyleSheet.compose({ color: colors.foregroundColor, writingDirection: I18nManager.isRTL ? 'rtl' : 'ltr' }, props.style);
|
|
|
|
return <Text {...props} style={style} />;
|
2020-07-15 19:32:59 +02:00
|
|
|
};
|
2018-01-30 23:42:38 +01:00
|
|
|
|
2020-11-25 04:01:51 +01:00
|
|
|
export const BlueTextCentered = props => {
|
2020-08-11 00:38:07 +02:00
|
|
|
const { colors } = useTheme();
|
|
|
|
return <Text {...props} style={{ color: colors.foregroundColor, textAlign: 'center' }} />;
|
|
|
|
};
|
2022-01-28 12:13:53 +01:00
|
|
|
|
2020-08-11 00:38:07 +02:00
|
|
|
export const BlueFormLabel = props => {
|
|
|
|
const { colors } = useTheme();
|
|
|
|
|
2021-05-22 05:36:34 +02:00
|
|
|
return (
|
|
|
|
<Text
|
|
|
|
{...props}
|
|
|
|
style={{
|
|
|
|
color: colors.foregroundColor,
|
|
|
|
fontWeight: '400',
|
|
|
|
marginHorizontal: 20,
|
|
|
|
writingDirection: I18nManager.isRTL ? 'rtl' : 'ltr',
|
|
|
|
}}
|
|
|
|
/>
|
|
|
|
);
|
2020-08-11 00:38:07 +02:00
|
|
|
};
|
2018-01-30 23:42:38 +01:00
|
|
|
|
2020-11-30 05:18:54 +01:00
|
|
|
export const BlueFormMultiInput = props => {
|
|
|
|
const { colors } = useTheme();
|
2019-02-28 01:45:44 +01:00
|
|
|
|
2020-11-30 05:18:54 +01:00
|
|
|
return (
|
|
|
|
<TextInput
|
|
|
|
multiline
|
|
|
|
underlineColorAndroid="transparent"
|
|
|
|
numberOfLines={4}
|
|
|
|
style={{
|
|
|
|
paddingHorizontal: 8,
|
|
|
|
paddingVertical: 16,
|
|
|
|
flex: 1,
|
|
|
|
marginTop: 5,
|
|
|
|
marginHorizontal: 20,
|
|
|
|
borderColor: colors.formBorder,
|
|
|
|
borderBottomColor: colors.formBorder,
|
|
|
|
borderWidth: 1,
|
|
|
|
borderBottomWidth: 0.5,
|
|
|
|
borderRadius: 4,
|
|
|
|
backgroundColor: colors.inputBackgroundColor,
|
|
|
|
color: colors.foregroundColor,
|
|
|
|
textAlignVertical: 'top',
|
|
|
|
}}
|
|
|
|
autoCorrect={false}
|
|
|
|
autoCapitalize="none"
|
|
|
|
spellCheck={false}
|
|
|
|
{...props}
|
|
|
|
selectTextOnFocus={false}
|
|
|
|
keyboardType={Platform.OS === 'android' ? 'visible-password' : 'default'}
|
|
|
|
/>
|
|
|
|
);
|
|
|
|
};
|
2018-05-06 19:12:14 +02:00
|
|
|
|
2020-11-30 05:18:54 +01:00
|
|
|
export const BlueSpacing = props => {
|
|
|
|
return <View {...props} style={{ height: 60 }} />;
|
|
|
|
};
|
2018-06-29 00:17:14 +02:00
|
|
|
|
2020-11-28 04:24:20 +01:00
|
|
|
export const BlueSpacing40 = props => {
|
|
|
|
return <View {...props} style={{ height: 50 }} />;
|
|
|
|
};
|
2018-01-30 23:42:38 +01:00
|
|
|
|
2018-06-29 00:17:14 +02:00
|
|
|
export class is {
|
|
|
|
static ipad() {
|
|
|
|
return isIpad;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2020-11-28 04:24:20 +01:00
|
|
|
export const BlueSpacing20 = props => {
|
2021-09-09 13:00:11 +02:00
|
|
|
const { horizontal = false } = props;
|
|
|
|
return <View {...props} style={{ height: horizontal ? 0 : 20, width: horizontal ? 20 : 0, opacity: 0 }} />;
|
2020-11-28 04:24:20 +01:00
|
|
|
};
|
2018-06-25 00:22:46 +02:00
|
|
|
|
2020-11-28 04:24:20 +01:00
|
|
|
export const BlueSpacing10 = props => {
|
|
|
|
return <View {...props} style={{ height: 10, opacity: 0 }} />;
|
|
|
|
};
|
2019-05-22 14:08:31 +02:00
|
|
|
|
2020-11-30 05:18:54 +01:00
|
|
|
export const BlueLoading = props => {
|
2020-07-15 19:32:59 +02:00
|
|
|
return (
|
2021-04-29 16:32:48 +02:00
|
|
|
<View style={{ flex: 1, justifyContent: 'center' }} {...props}>
|
2020-07-15 19:32:59 +02:00
|
|
|
<ActivityIndicator />
|
|
|
|
</View>
|
|
|
|
);
|
|
|
|
};
|
|
|
|
|
2024-04-18 03:33:13 +02:00
|
|
|
export function BlueBigCheckmark({ style = {} }) {
|
2020-04-28 18:27:35 +02:00
|
|
|
const defaultStyles = {
|
|
|
|
backgroundColor: '#ccddf9',
|
|
|
|
width: 120,
|
|
|
|
height: 120,
|
|
|
|
borderRadius: 60,
|
|
|
|
alignSelf: 'center',
|
|
|
|
justifyContent: 'center',
|
|
|
|
marginTop: 0,
|
|
|
|
marginBottom: 0,
|
|
|
|
};
|
|
|
|
const mergedStyles = { ...defaultStyles, ...style };
|
|
|
|
return (
|
|
|
|
<View style={mergedStyles}>
|
|
|
|
<Icon name="check" size={50} type="font-awesome" color="#0f5cc0" />
|
|
|
|
</View>
|
|
|
|
);
|
2024-04-29 15:01:46 +02:00
|
|
|
}
|