Skip to content

Commit 7b5efc5

Browse files
authored
Merge pull request #368 from Iterable/inbox-updates-1.3.2
Inbox updates 1.3.2
2 parents 72a8ae8 + 65e74ff commit 7b5efc5

4 files changed

Lines changed: 47 additions & 30 deletions

File tree

integration-testing/ts/App.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ import {
1010
} from 'react-native';
1111

1212
import {
13+
Iterable,
14+
IterableConfig,
1315
IterableAction,
1416
IterableActionContext,
1517
IterableInAppShowResponse,
1618
IterableInAppLocation,
1719
IterableInAppDeleteSource,
1820
} from '@iterable/react-native-sdk';
1921

20-
import { Iterable } from '@iterable/react-native-sdk/js/Iterable';
21-
import IterableConfig from '@iterable/react-native-sdk/js/IterableConfig';
2222
import IterableInAppMessage from '@iterable/react-native-sdk/js/IterableInAppMessage';
2323

2424
import { Login } from './Login'

integration-testing/yarn.lock

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -703,10 +703,11 @@
703703
dependencies:
704704
"@hapi/hoek" "^8.3.0"
705705

706-
"@iterable/react-native-sdk@^1.3.1":
707-
version "1.3.1"
708-
resolved "https://registry.yarnpkg.com/@iterable/react-native-sdk/-/react-native-sdk-1.3.1.tgz#811f2f97a0337e60a6ce7f14f8927496d4a3b238"
709-
integrity sha512-kjaYNKt3nPcwUbEWvcmKKvM4wYPbKZuZ9uT6U5azDfon4l0XAu0KYwJVoovmkDi+egDyb4yAkIfFGIhCNOvVWQ==
706+
"@iterable/react-native-sdk@^1.3.2":
707+
version "1.3.2"
708+
resolved "https://registry.yarnpkg.com/@iterable/react-native-sdk/-/react-native-sdk-1.3.2.tgz#03aff1b440b7b4f58b982ebc292d4500830569f6"
709+
integrity sha512-s+TTXQUOvcjAyp4lB9g42moAOPjiN7Gd4zWCvicO+zNcF170oZ8zSw/CJoUxvZIaFqKYIJXREeECBuDpA/p3Nw==
710+
710711
dependencies:
711712
"@react-native-community/hooks" "^2.6.0"
712713
"@react-navigation/native" "^6.0.6"
@@ -4728,9 +4729,9 @@ react-native-vector-icons@^9.0.0:
47284729
yargs "^16.1.1"
47294730

47304731
react-native-webview@^11.14.1:
4731-
version "11.21.1"
4732-
resolved "https://registry.yarnpkg.com/react-native-webview/-/react-native-webview-11.21.1.tgz#9d777b592a2f6802a8adb07e90e8cdaafc15d109"
4733-
integrity sha512-0136xrXV1VYMLj9yqma/8lNjUAoTa9uUYjAXlnkX8gSZbp4Bfk7VjDgXM2DCuYF/Pqzrq37hqYVyV+Hl/5zzlQ==
4732+
version "11.21.2"
4733+
resolved "https://registry.yarnpkg.com/react-native-webview/-/react-native-webview-11.21.2.tgz#fe4675318b8e487a4347d30f3036bfb89ba5a09b"
4734+
integrity sha512-BgiRfRfB9J60dEzj6Z4fZQcKhPbqGhinweHdIMFtLm9GCaTZ/cTo3sOeMN9XuLgakqcqHnvHg7Abp5jT2aiOyw==
47344735
dependencies:
47354736
escape-string-regexp "2.0.0"
47364737
invariant "2.2.4"

ts/IterableInbox.tsx

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,8 @@ type inboxProps = {
4141
customizations?: IterableInboxCustomizations,
4242
tabBarHeight?: number,
4343
tabBarPadding?: number,
44-
safeAreaMode?: boolean
44+
safeAreaMode?: boolean,
45+
showNavTitle?: boolean
4546
}
4647

4748
const IterableInbox = ({
@@ -50,7 +51,8 @@ const IterableInbox = ({
5051
customizations = {} as IterableInboxCustomizations,
5152
tabBarHeight = 80,
5253
tabBarPadding = 20,
53-
safeAreaMode = true
54+
safeAreaMode = true,
55+
showNavTitle = true
5456
}: inboxProps) => {
5557
const defaultInboxTitle = "Inbox"
5658
const inboxDataModel = new IterableInboxDataModel()
@@ -243,9 +245,11 @@ const IterableInbox = ({
243245
function showMessageList(loading: boolean) {
244246
return (
245247
<View style={messageListContainer}>
246-
<Text style={headline}>
247-
{customizations?.navTitle ? customizations?.navTitle : defaultInboxTitle}
248-
</Text>
248+
{showNavTitle ?
249+
<Text style={headline}>
250+
{customizations?.navTitle ? customizations?.navTitle : defaultInboxTitle}
251+
</Text>
252+
: null}
249253
{rowViewModels.length ?
250254
<IterableInboxMessageList
251255
dataModel={inboxDataModel}
@@ -289,22 +293,22 @@ const IterableInbox = ({
289293
const inboxAnimatedView =
290294
<Animated.View
291295
style={{
292-
transform: [
293-
{
294-
translateX: animatedValue.interpolate({
295-
inputRange: [0, 1],
296-
outputRange: [0, -width]
297-
})
298-
}
299-
],
300-
height: '100%',
301-
flexDirection: 'row',
302-
width: 2 * width,
303-
justifyContent: 'flex-start'
304-
}}
305-
>
306-
{showMessageList(loading)}
307-
{showMessageDisplay(rowViewModels, selectedRowViewModelIdx)}
296+
transform: [
297+
{
298+
translateX: animatedValue.interpolate({
299+
inputRange: [0, 1],
300+
outputRange: [0, -width]
301+
})
302+
}
303+
],
304+
height: '100%',
305+
flexDirection: 'row',
306+
width: 2 * width,
307+
justifyContent: 'flex-start'
308+
}}
309+
>
310+
{showMessageList(loading)}
311+
{showMessageDisplay(rowViewModels, selectedRowViewModelIdx)}
308312
</Animated.View>
309313

310314
return(

ts/IterableInboxMessageDisplay.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -160,12 +160,24 @@ const IterableInboxMessageDisplay = ({
160160
Iterable.trackInAppClick(rowViewModel.inAppMessage, IterableInAppLocation.inbox, URL)
161161
Iterable.trackInAppClose(rowViewModel.inAppMessage, IterableInAppLocation.inbox, IterableInAppCloseSource.link, URL)
162162

163+
//handle delete action
163164
if (URL === 'iterable://delete') {
164165
returnToInbox(() => deleteRow(rowViewModel.inAppMessage.messageId))
166+
//handle dismiss action
165167
} else if(URL === 'iterable://dismiss') {
166168
returnToInbox()
169+
//handle external link
167170
} else if (URL.slice(0, 4) === 'http') {
168171
returnToInbox(() => Linking.openURL(URL))
172+
//handle custom action
173+
} else if (URL.slice(0,9) === 'action://') {
174+
action.type = URL.replace('action://', '')
175+
returnToInbox(() => {
176+
if(Iterable.savedConfig.customActionHandler) {
177+
Iterable.savedConfig.customActionHandler(action, context)
178+
}
179+
})
180+
//handle deep link or error link
169181
} else {
170182
returnToInbox(() => {
171183
if(Iterable.savedConfig.urlHandler) {

0 commit comments

Comments
 (0)