Card Component
The StorytellerCardView renders a single, adaptive Storyteller card for a given clips collection. It automatically measures its content and updates its height accordingly.
Props
import type {
DataLoadCompletedEvent ,
} from '@getstoryteller/react-native-storyteller-sdk' ;
type Props = {
configuration : {
collectionId : string ; // required
};
style? : ViewStyle ;
onDataLoadCompleted ?: ( event : DataLoadCompletedEvent ) => void ;
};
Notes
configuration.collectionId is required.
Methods
StorytellerCardView exposes an imperative API via a ref:
reloadData() — Reloads the card’s data.
Usage
import React , { useRef } from 'react' ;
import { StyleSheet , View } from 'react-native' ;
import {
StorytellerCardView ,
type StorytellerCardViewInterface ,
type DataLoadCompletedEvent ,
} from '@getstoryteller/react-native-storyteller-sdk' ;
export default function CardExample () {
const cardRef = useRef < StorytellerCardViewInterface >( null );
const handleDataLoadCompleted = ( event : DataLoadCompletedEvent ) => {
if ( event . success ) {
console . log ( 'Card loaded. Items:' , event . dataCount );
} else {
console . warn ( 'Card load error:' , event . error );
}
};
const refresh = () => cardRef . current ? . reloadData ();
return (
< View style = { styles . container }>
< StorytellerCardView
ref = { cardRef }
configuration = {{ collectionId : 'your-collection-id' }}
style = { styles . card }
onDataLoadCompleted = { handleDataLoadCompleted }
/>
</ View >
);
}
const styles = StyleSheet . create ({
container : { flex : 1 },
card : { width : '100%' },
});
Tips
Ensure the parent layout allows the card to expand vertically; the component sets its own height based on content.
Call reloadData() when you know content or configuration has changed.
{"slug": "storyteller-card-view", "page_title": "Card Component", "page_url": "StorytellerCardView/", "canonical_url": "/react-native/StorytellerCardView/", "markdown": "# Card Component\n\nThe `StorytellerCardView` renders a single, adaptive Storyteller card for a given clips collection. It automatically measures its content and updates its height accordingly.\n\n## Props\n\n```ts\nimport type {\n DataLoadCompletedEvent,\n} from '@getstoryteller/react-native-storyteller-sdk';\n\ntype Props = {\n configuration: {\n collectionId: string; // required\n };\n style?: ViewStyle;\n onDataLoadCompleted?: (event: DataLoadCompletedEvent) => void;\n};\n```\n\n### Notes\n\n- `configuration.collectionId` is required.\n\n## Methods\n\n`StorytellerCardView` exposes an imperative API via a ref:\n\n- `reloadData()` \u2014 Reloads the card\u2019s data.\n\n## Usage\n\n```tsx\nimport React, { useRef } from 'react';\nimport { StyleSheet, View } from 'react-native';\nimport {\n StorytellerCardView,\n type StorytellerCardViewInterface,\n type DataLoadCompletedEvent,\n} from '@getstoryteller/react-native-storyteller-sdk';\n\nexport default function CardExample() {\n const cardRef = useRef<StorytellerCardViewInterface>(null);\n\n const handleDataLoadCompleted = (event: DataLoadCompletedEvent) => {\n if (event.success) {\n console.log('Card loaded. Items:', event.dataCount);\n } else {\n console.warn('Card load error:', event.error);\n }\n };\n\n const refresh = () => cardRef.current?.reloadData();\n\n return (\n <View style={styles.container}>\n <StorytellerCardView\n ref={cardRef}\n configuration={{ collectionId: 'your-collection-id' }}\n style={styles.card}\n onDataLoadCompleted={handleDataLoadCompleted}\n />\n <\/View>\n );\n}\n\nconst styles = StyleSheet.create({\n container: { flex: 1 },\n card: { width: '100%' },\n});\n```\n\n### Tips\n\n- Ensure the parent layout allows the card to expand vertically; the component sets its own height based on content.\n- Call `reloadData()` when you know content or configuration has changed.\n", "copy_markdown_include_header": false, "base_path": "", "ai_dir": "ai", "missing_payload_behavior": "empty"}