diff --git a/code/lib/manager-api/package.json b/code/lib/manager-api/package.json index b662b571e5e2..c864941ccbad 100644 --- a/code/lib/manager-api/package.json +++ b/code/lib/manager-api/package.json @@ -30,6 +30,7 @@ }, "main": "dist/index.js", "module": "dist/index.mjs", + "react-native": "dist/index.mjs", "types": "dist/index.d.ts", "files": [ "dist/**/*", diff --git a/code/lib/preview-api/package.json b/code/lib/preview-api/package.json index 172ea3b7c1ab..64bd7e29d709 100644 --- a/code/lib/preview-api/package.json +++ b/code/lib/preview-api/package.json @@ -30,6 +30,7 @@ }, "main": "dist/index.js", "module": "dist/index.mjs", + "react-native": "dist/index.mjs", "types": "dist/index.d.ts", "files": [ "dist/**/*", diff --git a/code/lib/preview-api/src/index.ts b/code/lib/preview-api/src/index.ts index 2abcec8de9e1..c2fcc5bf9640 100644 --- a/code/lib/preview-api/src/index.ts +++ b/code/lib/preview-api/src/index.ts @@ -68,4 +68,4 @@ export type { PropDescriptor } from './store'; * STORIES API */ export { StoryStore } from './store'; -export { Preview, PreviewWeb } from './preview-web'; +export { Preview, PreviewWithSelection, PreviewWeb } from './preview-web'; diff --git a/code/lib/preview-api/src/modules/preview-web/Preview.tsx b/code/lib/preview-api/src/modules/preview-web/Preview.tsx index 7e368f7457f3..af851edfc304 100644 --- a/code/lib/preview-api/src/modules/preview-web/Preview.tsx +++ b/code/lib/preview-api/src/modules/preview-web/Preview.tsx @@ -384,6 +384,13 @@ export class Preview { return this.storyStoreValue.loadStory({ storyId }); } + getStoryContext(story: PreparedStory, { forceInitialArgs = false } = {}) { + if (!this.storyStoreValue) + throw new CalledPreviewMethodBeforeInitializationError({ methodName: 'getStoryContext' }); + + return this.storyStoreValue.getStoryContext(story, { forceInitialArgs }); + } + async extract(options?: { includeDocsOnly: boolean }) { if (!this.storyStoreValue) throw new CalledPreviewMethodBeforeInitializationError({ methodName: 'extract' });