@iterable/react-native-sdk - v2.0.3
    Preparing search index...

    Interface IterableInboxProps

    Props for the IterableInbox component.

    interface IterableInboxProps {
        customizations?: IterableInboxCustomizations;
        messageListItemLayout?: (
            isLast: boolean,
            rowViewModel: IterableInboxRowViewModel,
        ) => undefined | null | [ReactNode, number];
        returnToInboxTrigger?: boolean;
        safeAreaMode?: boolean;
        showNavTitle?: boolean;
        tabBarHeight?: number;
        tabBarPadding?: number;
    }

    Hierarchy

    • Partial<Pick<IterableInboxMessageListProps, "messageListItemLayout">>
      • IterableInboxProps
    Index

    Properties

    Customization for the look and feel of the inbox.

    messageListItemLayout?: (
        isLast: boolean,
        rowViewModel: IterableInboxRowViewModel,
    ) => undefined | null | [ReactNode, number]

    Function to specify a layout for the message row.

    Type Declaration

      • (
            isLast: boolean,
            rowViewModel: IterableInboxRowViewModel,
        ): undefined | null | [ReactNode, number]
      • Parameters

        • isLast: boolean

          Is this the last message in the list?

        • rowViewModel: IterableInboxRowViewModel

          The view model for the inbox row.

        Returns undefined | null | [ReactNode, number]

        A tuple containing a React node and a number, or undefined/null.

    To specify a custom layout for your inbox rows, when you instantiate your IterableInbox, assign a function to its messageListItemLayout prop. The inbox will call this function for each of its rows, and it should return:

    1. JSX that represents the custom layout for the row.
    2. The height of the row (must be the same for all rows).
     const ROW_HEIGHT = 100;

    // Custom layout for the message row
    const renderCustomLayout = (
    isLast: boolean,
    rowViewModel: IterableInboxRowViewModel,
    ) => {
    return [
    // Component shown in the message row
    <View>
    <Text>Title: {rowViewModel.inAppMessage.inboxMetadata?.title}</Text>
    <Text>Body: {rowViewModel.inAppMessage.inboxMetadata?.subtitle}</Text>
    <Text>Date: {rowViewModel.createdAt}</Text>
    <Text>Has been read: {rowViewModel.read === true}</Text>
    </View>,
    // Height of the row
    ROW_HEIGHT,
    ];
    }

    <IterableInbox messageListItemLayout={renderCustomLayout} />
    returnToInboxTrigger?: boolean

    Flag which, when switched, returns a user to their inbox from within the inbox component (from the details of the particular message to the message list) if the inbox is already in view.

    Let's say you have bottom tabs in your app, and one of them is the inbox. If you click on a message, you may want to be able to return to the inbox by clicking on the bottom tab inbox icon.

    If this prop is included and correctly set up, clicking on the bottom inbox tab when a message is in focus will return the user to the inbox.

    If this prop is NOT included, clicking on the bottom inbox tab when a message is in focus will have no effect.

     import { NavigationContainer } from '@react-navigation/native';
    import { createBottomTabNavigator } from '@react-navigation/bottom-tabs';
    import { IterableInbox} from '@iterable/react-native-sdk/js/Iterable';

    const Tab = createBottomTabNavigator();

    const MyNavigation = () => {
    const [isInbox, setIsInbox] = useState<boolean>(false);
    const [returnToInboxTrigger, setReturnToInboxTrigger] = useState<boolean>(false);

    return (
    <NavigationContainer>
    <Tab.Navigator>
    <Tab.Screen
    name="Home"
    component={Home}
    listeners={{tabPress: () => setIsInbox(false)}}
    />
    <Tab.Screen
    name="Inbox"
    listeners={{
    tabPress: () => {
    // if this is true, then the inbox is already displayed, so
    // go back to the message list if it is not already in view
    if (isInbox) {
    setReturnToInboxTrigger(!returnToInboxTrigger);
    }
    setIsInbox(true);
    }
    }}
    >
    {() => (
    <IterableInbox
    returnToInboxTrigger={returnToInboxTrigger}
    />
    )}
    </Tab.Screen>
    <Tab.Screen
    name="Settings"
    component={Settings}
    listeners={{tabPress: () => setIsInbox(false)}}
    />
    </Tab.Navigator>
    </NavigationContainer>
    );
    }
    safeAreaMode?: boolean

    Is safe area mode enabled?

    This indicates whether or not the inbox should be displayed inside a React Native SafeAreaView.

    If the parent of the inbox component is already inside a SafeAreaView, set this to false as another SafeAreaView is not needed.

     // Safe area mode should be `true` as it is NOT already inside a `SafeAreaView`
    const MyInbox = () => <IterableInbox safeAreaMode={true} />;

    // Safe area mode should be `false` as it is already inside a `SafeAreaView`
    const MyInbox = () => (
    <SafeAreaView>
    <IterableInbox safeAreaMode={false} />
    </SafeAreaView>
    );
    showNavTitle?: boolean

    Should the navigation title be shown?

    tabBarHeight?: number

    The height of the tab bar.

    If your app uses custom tab bar dimensions, provide this value to make sure that the inbox component lays out as expected.

    tabBarPadding?: number

    The padding of the tab bar.

    If your app uses custom tab bar dimensions, provide this value to make sure that the inbox component lays out as expected.