Skip to content

Commit 87229ae

Browse files
authored
fix(iOS): icon inside header button is not center aligned on iOS 26 (#7105)
1 parent 37f4949 commit 87229ae

1 file changed

Lines changed: 16 additions & 4 deletions

File tree

app/containers/Header/components/HeaderButton/HeaderButtonContainer.tsx

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
import React from 'react';
2-
import { type StyleProp, StyleSheet, View, type ViewProps, type ViewStyle } from 'react-native';
2+
import { Platform, type StyleProp, StyleSheet, View, type ViewProps, type ViewStyle } from 'react-native';
33

4-
import { isAndroid, isTablet } from '../../../../lib/methods/helpers/deviceInfo';
4+
import { isAndroid, isIOS, isTablet } from '../../../../lib/methods/helpers/deviceInfo';
55

66
interface IHeaderButtonContainer {
77
children?: React.ReactElement | (React.ReactElement | null)[] | null;
@@ -10,18 +10,30 @@ interface IHeaderButtonContainer {
1010
style?: StyleProp<ViewStyle>;
1111
}
1212

13+
const getMargin = () => {
14+
if (isTablet) {
15+
return 5;
16+
}
17+
if (isIOS && Number(Platform.Version) >= 26) {
18+
return 0;
19+
}
20+
return -5;
21+
};
22+
23+
const margin = getMargin();
24+
1325
const styles = StyleSheet.create({
1426
container: {
1527
flexDirection: 'row',
1628
alignItems: 'center',
1729
justifyContent: 'center'
1830
},
1931
left: {
20-
marginLeft: isTablet ? 5 : -5,
32+
marginLeft: margin,
2133
marginRight: isAndroid ? 5 : 0
2234
},
2335
right: {
24-
marginRight: isTablet ? 5 : -5
36+
marginRight: margin
2537
}
2638
});
2739

0 commit comments

Comments
 (0)