1import Ionicons from '@expo/vector-icons/build/Ionicons';
2import { BottomTabNavigationProp } from '@react-navigation/bottom-tabs';
3import { HeaderStyleInterpolators } from '@react-navigation/stack';
4import * as React from 'react';
5import { Platform, StyleSheet, TouchableOpacity } from 'react-native';
6
7import { Colors } from '../constants';
8
9const styles = StyleSheet.create({
10  header: Platform.select({
11    default: {
12      backgroundColor: Colors.headerBackground,
13    },
14    android: {
15      elevation: 0,
16      borderBottomWidth: 1,
17      borderBottomColor: '#eee',
18    },
19  }),
20  headerTitle: {
21    color: Colors.headerTitle,
22  },
23  card: {
24    backgroundColor: Colors.greyBackground,
25  },
26});
27
28export default function getStackConfig({
29  navigation,
30}: {
31  navigation: BottomTabNavigationProp<any>;
32}) {
33  return {
34    cardStyle: styles.card,
35    screenOptions: () => ({
36      headerStyleInterpolator: HeaderStyleInterpolators.forUIKit,
37      headerStyle: styles.header,
38      headerTintColor: Colors.tintColor,
39      headerTitleStyle: styles.headerTitle,
40      headerPressColorAndroid: Colors.tintColor,
41      headerRight: () => (
42        <TouchableOpacity
43          onPress={() => navigation.navigate('searchNavigator')}
44          style={{ marginRight: 16 }}>
45          <Ionicons
46            name="md-search"
47            size={Platform.OS === 'ios' ? 22 : 25}
48            color={Colors.tintColor}
49          />
50        </TouchableOpacity>
51      ),
52    }),
53  };
54}
55