Skip to main content

Appearance

AppearanceManager controls the visual presentation of story cards in the feed, readers (stories, games, In-App Messages), controls (likes, favorites, share, sound), and custom asset icons.

Stories list appearance

Configure the appearance of story cards and the feed container with setStoriesListOptions:

import {
AppearanceManager,
StoriesListCardTitlePosition,
StoriesListCardTitleTextAlign,
StoriesListCardViewVariant,
} from '@inappstory/react-native-sdk';
import { Platform } from 'react-native';

const appearanceManager = new AppearanceManager();

appearanceManager.setStoriesListOptions({
card: {
title: {
fontSize: 12,
fontWeight: 600,
fontFamily: Platform.OS === 'ios' ? 'System' : 'Roboto',
lineHeight: 14,
lineClamp: 2,
textAlign: StoriesListCardTitleTextAlign.LEFT,
position: StoriesListCardTitlePosition.CARD_INSIDE_BOTTOM,
padding: { paddingTop: 0, paddingRight: 8, paddingBottom: 8, paddingLeft: 8 },
},
gap: 8,
height: 140,
aspectRatio: 1,
variant: StoriesListCardViewVariant.RECTANGLE, // CIRCLE | QUAD | RECTANGLE
border: {
radius: 12,
color: '#007AFF',
width: 2,
gap: 2,
},
mask: {
color: 'rgba(0, 0, 0, 0.2)',
},
opacity: 1,
opened: {
border: {
radius: 12,
color: '#8E8E93',
width: 1,
gap: 2,
},
mask: {
color: 'rgba(0, 0, 0, 0.4)',
},
opacity: 0.8,
},
},
favoriteCard: {
title: {
content: 'Saved',
},
},
sidePadding: 16,
topPadding: 8,
bottomPadding: 8,
});

StoriesListCardOptions

OptionTypeDescription
heightnumberCard height in pixels
aspectRationumberAspect ratio of the card
gapnumberSpacing between cards
variantStoriesListCardViewVariantRECTANGLE, QUAD, or CIRCLE
border{ radius?, color?, width?, gap? }Card border and outer ring styling
mask{ color? }Color overlay on top of the cover
opacitynumberCard opacity (0 to 1)
openedPartial<StoriesListCardOptions>Overrides for already-viewed stories
titleCardTitleOptionsTitle typography and alignment

Card Title Options

OptionTypeDescription
fontSizenumberFont size in points
fontWeightstring | numberFont weight (e.g. '600', 600, 'bold')
fontFamilystringFont family name
lineHeightnumberLine height in points
lineClampnumberMaximum number of visible lines
textAlignStoriesListCardTitleTextAlignLEFT, CENTER, or RIGHT
positionStoriesListCardTitlePositionCARD_INSIDE_BOTTOM, CARD_OUTSIDE_TOP, or CARD_OUTSIDE_BOTTOM
paddingnumber | string | objectInner padding for the title container

Custom story cell

To completely replace the card rendering with your own React Native components, pass renderCell or renderFavoriteCell to <StoriesList />:

<StoriesList
storyManager={storyManager}
appearanceManager={appearanceManager}
feed="default"
renderCell={(story, { isFirstItem, isLastItem }) => (
<View style={{ width: 100, height: 140, padding: 8 }}>
<Image source={{ uri: story.coverImagePath }} style={{ width: '100%', height: 100 }} />
<Text numberOfLines={2}>{story.title}</Text>
</View>
)}
/>

Story reader appearance

Reader-related appearance settings are configured on appearanceManager and apply globally to all readers (story reader, game reader, In-App Messages):

appearanceManager.setOverScrollToClose(true);
appearanceManager.setSwipeToClose(false);
appearanceManager.setTimerGradientEnable(true);
appearanceManager.setScrollStyle(StoryReaderSwipeStyle.FLAT);
appearanceManager.setPresentationStyle(StoryReaderPresentationStyle.MODAL);
appearanceManager.setReaderBackgroundColor('#000000');
appearanceManager.setReaderCornerRadius(16);
appearanceManager.setCoverQuality(CoverQuality.HIGH);
MethodValue typeDescription
setOverScrollToClosebooleanAllow closing reader by overscrolling
setSwipeToClosebooleanAllow closing reader by swipe down
setTimerGradientEnablebooleanShow gradient underneath the story progress timer
setScrollStyleStoryReaderSwipeStyleTransition animation: FLAT, COVER, CUBE, DEPTH
setPresentationStyleStoryReaderPresentationStyleScreen presentation: ZOOM, MODAL, FADE
setReaderBackgroundColorstringBackground color of the reader container
setReaderCornerRadiusnumberReader corner radius in px
setCoverQualityCoverQualityCover image resolution: CoverQuality.MEDIUM or HIGH

You can also set reader options together via setStoryReaderOptions:

appearanceManager.setStoryReaderOptions({
closeButtonPosition: StoryReaderCloseButtonPosition.RIGHT,
scrollStyle: StoryReaderSwipeStyle.FLAT,
slideBorderRadius: 16,
});

Likes, share, favorites

Configure which buttons are displayed in the story reader with setCommonOptions:

appearanceManager.setCommonOptions({
hasLike: true,
hasLikeButton: true,
hasDislikeButton: false,
hasFavorite: true,
hasShare: true,
coverQuality: CoverQuality.HIGH,
});

Custom icons

Customize reader toolbar icons by passing the names of assets bundled with your application:

appearanceManager.setLikeImage('like_icon', 'like_icon_selected');
appearanceManager.setDislikeImage('dislike_icon', 'dislike_icon_selected');
appearanceManager.setFavoriteImage('fav_icon', 'fav_icon_selected');
appearanceManager.setShareImage('share_icon', 'share_icon_selected');
appearanceManager.setSoundImage('sound_on_icon', 'sound_muted_icon');
appearanceManager.setCloseReaderImage('close_reader_icon');
appearanceManager.setRefreshImage('refresh_icon');
appearanceManager.setRefreshGoodsImage('refresh_goods_icon');
appearanceManager.setCloseGoodsImage('close_goods_icon');