The StorytellerCardView renders a single, adaptive Storyteller card for a given clips collection. It automatically measures its content and updates its height accordingly.
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- The card updates its height when the displayed content changes, including after a card action changes the ordering within its collection.\n- Changing `collectionId` starts a new card instance; the previous collection\u2019s measured height is not reused.\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"}