@quintype/native-components 2.30.2--alt-story-layout-beta → 2.30.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -12,12 +12,35 @@ import { headerStyles } from "./styles";
|
|
|
12
12
|
|
|
13
13
|
export const Header = (props) => {
|
|
14
14
|
const { theme } = useContext(AppTheme);
|
|
15
|
-
const
|
|
15
|
+
const { noBorder, centerAlignLogo } = props || {};
|
|
16
|
+
const styles = headerStyles(theme, noBorder, centerAlignLogo);
|
|
16
17
|
const headerStyle = StyleSheet.flatten([styles.header, props.style]);
|
|
17
18
|
const logoComponentStyle = StyleSheet.flatten([
|
|
18
19
|
styles.logoComponentStyle,
|
|
19
20
|
props.logoComponentStyle,
|
|
20
21
|
]);
|
|
22
|
+
if (centerAlignLogo) {
|
|
23
|
+
return (
|
|
24
|
+
<View style={styles.header}>
|
|
25
|
+
<View style={styles.leftContainer}>
|
|
26
|
+
{props.leftComponent && props.leftComponent}
|
|
27
|
+
</View>
|
|
28
|
+
{props.logoComponent && (
|
|
29
|
+
<TouchableOpacity
|
|
30
|
+
style={logoComponentStyle}
|
|
31
|
+
onPress={props.onPress}
|
|
32
|
+
testID={COMP_GENERAL_CONSTANTS.headerLogoTouch}
|
|
33
|
+
>
|
|
34
|
+
{props.logoComponent}
|
|
35
|
+
</TouchableOpacity>
|
|
36
|
+
)}
|
|
37
|
+
<View style={styles.rightContainer}>
|
|
38
|
+
{props.rightComponent && props.rightComponent}
|
|
39
|
+
</View>
|
|
40
|
+
</View>
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
|
|
21
44
|
return (
|
|
22
45
|
<View style={headerStyle}>
|
|
23
46
|
<View>
|
|
@@ -1,19 +1,35 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
|
|
3
|
-
export const headerStyles = (appThemeContext, noBorder) => {
|
|
3
|
+
export const headerStyles = (appThemeContext, noBorder, centerAlignLogo) => {
|
|
4
4
|
const { COLORS, DARK_MODE } = appThemeContext;
|
|
5
|
-
|
|
5
|
+
const headerContainerStyles = {
|
|
6
6
|
header: {
|
|
7
7
|
height: 48,
|
|
8
8
|
backgroundColor: DARK_MODE ? COLORS.MONO6 : COLORS.BRAND_WHITE,
|
|
9
9
|
flexDirection: 'row',
|
|
10
10
|
alignItems: 'center',
|
|
11
|
-
justifyContent: 'space-between',
|
|
11
|
+
justifyContent: centerAlignLogo ? 'center' : 'space-between',
|
|
12
12
|
paddingHorizontal: 10,
|
|
13
13
|
borderBottomColor: noBorder
|
|
14
14
|
? (DARK_MODE ? COLORS.BRAND_WHITE : COLORS.BRAND_BLACK)
|
|
15
15
|
: (DARK_MODE ? COLORS.MONO6 : COLORS.BRAND5),
|
|
16
16
|
borderBottomWidth: StyleSheet.hairlineWidth,
|
|
17
|
-
}
|
|
18
|
-
}
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
if (centerAlignLogo) {
|
|
21
|
+
return StyleSheet.create({
|
|
22
|
+
...headerContainerStyles,
|
|
23
|
+
leftContainer: {
|
|
24
|
+
flex: 1, // Takes up all left space
|
|
25
|
+
alignItems: 'flex-start', // Aligns leftView to the left
|
|
26
|
+
},
|
|
27
|
+
rightContainer: {
|
|
28
|
+
flex: 1, // Takes up all right space
|
|
29
|
+
alignItems: 'flex-end', // Aligns rightView to the right
|
|
30
|
+
}
|
|
31
|
+
});
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
return StyleSheet.create(headerContainerStyles);
|
|
19
35
|
};
|
|
@@ -8,16 +8,34 @@ import { AppTheme } from '../../utils/context';
|
|
|
8
8
|
|
|
9
9
|
export const Text = (props) => {
|
|
10
10
|
const { theme } = useContext(AppTheme);
|
|
11
|
-
const {
|
|
11
|
+
const {
|
|
12
|
+
FONT_FAMILY, COLORS, CAN_COPY_TEXT, lineHeightMultiplier,
|
|
13
|
+
} = theme;
|
|
14
|
+
|
|
15
|
+
// Flatten the style first
|
|
16
|
+
const flattenedStyle = StyleSheet.flatten([props.style]) || {};
|
|
17
|
+
|
|
18
|
+
// Use fontSize from style or fallback, and lineHeight from style or calculate
|
|
19
|
+
const { fontSize } = flattenedStyle;
|
|
20
|
+
let lineHeight;
|
|
21
|
+
if (flattenedStyle.lineHeight != null) {
|
|
22
|
+
lineHeight = flattenedStyle.lineHeight;
|
|
23
|
+
} else if (fontSize != null) {
|
|
24
|
+
lineHeight = fontSize * (lineHeightMultiplier ?? 1.5);
|
|
25
|
+
}
|
|
12
26
|
|
|
13
27
|
const RNStyle = {
|
|
14
28
|
fontFamily: props.primary ? FONT_FAMILY.primary : FONT_FAMILY.secondary,
|
|
15
29
|
writingDirection: I18nManager.isRTL ? 'rtl' : 'ltr',
|
|
30
|
+
...(fontSize != null ? { fontSize } : {}),
|
|
31
|
+
...(lineHeight != null ? { lineHeight } : {}),
|
|
16
32
|
};
|
|
17
|
-
const flattenedStyle = StyleSheet.flatten([RNStyle, props.style]);
|
|
18
33
|
|
|
19
|
-
const
|
|
34
|
+
const mergedStyle = StyleSheet.flatten([RNStyle, props.style]);
|
|
20
35
|
|
|
36
|
+
const {
|
|
37
|
+
ellipsizeMode, numberOfLines, allowFontScaling, testID,
|
|
38
|
+
} = props;
|
|
21
39
|
const textData = I18nManager.isRTL ? `\u200F${props.children}` : props.children;
|
|
22
40
|
|
|
23
41
|
return (
|
|
@@ -29,7 +47,7 @@ export const Text = (props) => {
|
|
|
29
47
|
ellipsizeMode={ellipsizeMode}
|
|
30
48
|
numberOfLines={numberOfLines}
|
|
31
49
|
testID={testID}
|
|
32
|
-
style={
|
|
50
|
+
style={mergedStyle}
|
|
33
51
|
fontFamily={RNStyle.fontFamily}
|
|
34
52
|
allowFontScaling={allowFontScaling}
|
|
35
53
|
>
|