2021-02-09 11:33:57 +05:00
|
|
|
import React from 'react';
|
2021-06-08 12:59:31 +05:00
|
|
|
import { TouchableOpacity, useWindowDimensions, View } from 'react-native';
|
|
|
|
|
import { useTracked } from '../../provider';
|
|
|
|
|
import { eSendEvent } from '../../services/EventManager';
|
|
|
|
|
import { eOpenJumpToDialog } from '../../utils/Events';
|
|
|
|
|
import { SIZE } from '../../utils/SizeUtils';
|
|
|
|
|
import { HeaderMenu } from '../Header/HeaderMenu';
|
2021-02-09 11:33:57 +05:00
|
|
|
import Heading from '../Typography/Heading';
|
|
|
|
|
|
|
|
|
|
export const SectionHeader = ({
|
2021-06-08 12:26:55 +05:00
|
|
|
item,
|
|
|
|
|
index,
|
|
|
|
|
headerProps,
|
|
|
|
|
jumpToDialog,
|
|
|
|
|
sortMenuButton,
|
|
|
|
|
}) => {
|
|
|
|
|
const [state] = useTracked();
|
|
|
|
|
const {colors} = state;
|
|
|
|
|
const {fontScale} = useWindowDimensions();
|
2021-02-20 14:55:29 +05:00
|
|
|
|
2021-06-08 12:26:55 +05:00
|
|
|
return (
|
|
|
|
|
<View
|
|
|
|
|
style={{
|
|
|
|
|
flexDirection: 'row',
|
|
|
|
|
alignItems: 'center',
|
|
|
|
|
width: '100%',
|
|
|
|
|
justifyContent: 'space-between',
|
|
|
|
|
paddingHorizontal: 12,
|
2021-07-09 12:15:06 +05:00
|
|
|
height: 35 * fontScale,
|
|
|
|
|
backgroundColor: colors.nav,
|
2021-06-08 12:26:55 +05:00
|
|
|
marginTop: index === 0 ? 0 : 5 * fontScale,
|
|
|
|
|
}}>
|
|
|
|
|
<TouchableOpacity
|
|
|
|
|
onPress={() => {
|
|
|
|
|
console.log('called');
|
|
|
|
|
if (jumpToDialog) {
|
|
|
|
|
console.log('sending event');
|
|
|
|
|
eSendEvent(eOpenJumpToDialog);
|
|
|
|
|
}
|
|
|
|
|
}}
|
|
|
|
|
activeOpacity={0.9}
|
|
|
|
|
hitSlop={{top: 10, left: 10, right: 30, bottom: 15}}
|
|
|
|
|
style={{
|
|
|
|
|
height: '100%',
|
|
|
|
|
justifyContent: 'center',
|
|
|
|
|
}}>
|
|
|
|
|
<Heading
|
|
|
|
|
color={colors.accent}
|
|
|
|
|
size={SIZE.sm}
|
|
|
|
|
style={{
|
|
|
|
|
minWidth: 60,
|
|
|
|
|
alignSelf: 'center',
|
|
|
|
|
textAlignVertical: 'center',
|
|
|
|
|
}}>
|
|
|
|
|
{!item.title || item.title === '' ? 'Pinned' : item.title}
|
|
|
|
|
</Heading>
|
|
|
|
|
</TouchableOpacity>
|
|
|
|
|
{index === 0 && sortMenuButton ? <HeaderMenu /> : null}
|
|
|
|
|
</View>
|
|
|
|
|
);
|
|
|
|
|
};
|