Skip to content

Commit 4308017

Browse files
committed
refactor: add HeaderBackButton component and integrate it into IterableInboxMessageDisplay
1 parent 74a6409 commit 4308017

File tree

2 files changed

+50
-1
lines changed

2 files changed

+50
-1
lines changed
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
import {
2+
StyleSheet,
3+
Text,
4+
TouchableWithoutFeedback,
5+
View,
6+
type TouchableWithoutFeedbackProps,
7+
} from 'react-native';
8+
import { Icon } from 'react-native-vector-icons/Icon';
9+
import { ITERABLE_INBOX_COLORS } from '../constants/colors';
10+
11+
const styles = StyleSheet.create({
12+
13+
returnButton: {
14+
alignItems: 'center',
15+
flexDirection: 'row',
16+
},
17+
18+
returnButtonIcon: {
19+
color: ITERABLE_INBOX_COLORS.BUTTON_PRIMARY_TEXT,
20+
fontSize: 40,
21+
paddingLeft: 0,
22+
},
23+
24+
returnButtonText: {
25+
color: ITERABLE_INBOX_COLORS.BUTTON_PRIMARY_TEXT,
26+
fontSize: 20,
27+
},
28+
});
29+
30+
export const HeaderBackButton = (props: TouchableWithoutFeedbackProps) => {
31+
return (
32+
<TouchableWithoutFeedback {...props}>
33+
<View style={styles.returnButton}>
34+
<Icon name="chevron-back-outline" style={styles.returnButtonIcon} />
35+
<Text style={styles.returnButtonText}>Inbox</Text>
36+
</View>
37+
</TouchableWithoutFeedback>
38+
);
39+
};

src/inbox/components/IterableInboxMessageDisplay.tsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,9 +23,9 @@ import {
2323
IterableInAppCloseSource,
2424
IterableInAppLocation,
2525
} from '../../inApp';
26-
2726
import { ITERABLE_INBOX_COLORS } from '../constants';
2827
import { type IterableInboxRowViewModel } from '../types';
28+
import { HeaderBackButton } from './HeaderBackButton';
2929

3030
/**
3131
* Props for the IterableInboxMessageDisplay component.
@@ -222,6 +222,16 @@ export const IterableInboxMessageDisplay = ({
222222
<View style={styles.messageDisplayContainer}>
223223
<View style={styles.header}>
224224
<View style={styles.returnButtonContainer}>
225+
<HeaderBackButton
226+
onPress={() => {
227+
returnToInbox();
228+
Iterable.trackInAppClose(
229+
rowViewModel.inAppMessage,
230+
IterableInAppLocation.inbox,
231+
IterableInAppCloseSource.back
232+
);
233+
}}
234+
/>
225235
<TouchableWithoutFeedback
226236
onPress={() => {
227237
returnToInbox();

0 commit comments

Comments
 (0)