From 0be70b81c5cbe7a383dc675997c4f1dc9eb3110e Mon Sep 17 00:00:00 2001 From: Aleksandr Zavadkin Date: Wed, 4 Feb 2026 19:42:03 +0300 Subject: [PATCH] docs(stories): description expanded Signed-off-by: Aleksandr Zavadkin --- source/includes/_stories.md.erb | 58 +++++++++++++++++++++++++++++---- 1 file changed, 52 insertions(+), 6 deletions(-) diff --git a/source/includes/_stories.md.erb b/source/includes/_stories.md.erb index b226607..1b56f99 100644 --- a/source/includes/_stories.md.erb +++ b/source/includes/_stories.md.erb @@ -152,6 +152,9 @@ StoriesView storiesView = new StoriesView(this, "STORY BLOCK CODE"); ``` ```jsx + +/* This is an example of SDK initialization, you need to do it once for your app. You don't need another instance of SDK to use stories */ + import <%= config[:rn_sdk_package_name] %> from '<%= config[:rn_sdk_package_code] %>/react-native-sdk'; import { Platform } from 'react-native'; @@ -160,6 +163,13 @@ const sdk = new <%= config[:rn_sdk_package_name] %>( Platform.OS, // 'ios' or 'android' true // debug mode enabled (true or false) ); + + +/* Due to the asynchronous SDK initialization it is recommended to wait until SDK is ready */ + +if (sdk.isInit()) { + // SDK is ready +} ``` ## Show stories block on request @@ -219,19 +229,30 @@ public func collectionView(_ collectionView: UICollectionView, didSelectItemAt i ``` ```jsx -/* Due to the asynchronized SDK initialization it is reccomended to wait until SDK is ready */ +/* + Getting the list of stories -if (sdk.isInit()) { - // SDK is ready -} -/* Getting the list of stories */ + sdk.getStories('STORIES_CODE'); - SDK method that performs an API request to fetch a specific stories block identified by STORIES_CODE + const allStories = response.stories; - content of the API response, requested stories block + + */ const response = await sdk.getStories('STORIES_CODE'); if (response && response.stories) { const allStories = response.stories; } -/* Display of the list of stories */ +/* + + Display of the list of stories + + UI component displaying all the requested stories: + + sdk={sdk} - there you have to place your initialized SDK variable. It provides access to data loading, tracking, and internal logic required by the component. + code="STORIES_CODE" - STORIES_CODE this will tell the component which stories block the SDK will be handling + + +*/