@tylerhammer/notifications-template-preview-react-native
v1.0.8
Published
## Usage
Downloads
7
Readme
Notifications Template Preview - React Native
Usage
import {NotificationPreview} from '@sendbird/notifications-template-preview-react-native';
----
<NotificationPreview
globalTheme={globalSettings}
template={templates[item.notificationData.templateKey]}
notification={item}
themeMode="light"
customImageComponent={props => {
return (
<FastImage
style={{
...(!props.parsedProperties?.imageStyles.height ? {aspectRatio: 686 / 320} : null),
...props.parsedProperties?.imageStyles,
}}
source={{uri: props.imageUrl, priority: FastImage.priority.normal}}
resizeMode={props.parsedProperties?.resizeMode}
/>
);
}}
handlePress={props => {
switch (props.action?.type) {
case 'web': {
if (!props.action.data.startsWith('http://') || !props.action.data.startsWith('https://')) {
return Linking.openURL(`https://${props.action.data}`);
}
return Linking.openURL(props.action.data);
}
case 'uikit': {
return console.warn(props.action.data);
}
case 'custom': {
return;
}
}
}}
/>