loki icon indicating copy to clipboard operation
loki copied to clipboard

Storybook 8 is not supported by React Native integration

Open V3RON opened this issue 1 year ago • 3 comments

Storybook 8 is supported by Loki for the web platform, thanks to updates introduced in #507. However, the React Native integration has not yet been updated to align with the new APIs.

Identified Issues:

  • storybook.raw() must be replaced with await __STORYBOOK_PREVIEW.extract().
  • configureStorybookReactNative should be called after view.getStorybookUI.
  • DevSettings.setHotLoadingEnabled(false); triggers a reload of the application, causing the "Loading bundle from..." toast message to be captured and displayed in screenshots, should be replaced with HMRClient.disable() and HMRClient.enable()

I made the necessary changes locally and successfully ran Loki.

V3RON avatar Nov 29 '24 11:11 V3RON

Any update on this.

rishabh876 avatar Mar 05 '25 12:03 rishabh876

Any update on this.

@rishabh876 You can use patch-package with the contents of https://github.com/V3RON/loki/commit/207929d7cc75744d533d11ac62e43a669a0c55dd - should work just fine.

V3RON avatar Mar 05 '25 18:03 V3RON

Any update on this.

@rishabh876 You can use patch-package with the contents of V3RON@207929d - should work just fine.

This works. Thanks!!!

Btw, for those that are on react-native 0.79.0 or newer, change the way HMRClient is imported. Instead of...

const HMRClient = require('react-native/Libraries/Utilities/HMRClient');

Do...

import HMRClient from 'react-native/Libraries/Utilities/HMRClient';

Otherwise, you will get errors. The reason is because react-native changed the way HMRClient is exported.

  • https://github.com/facebook/react-native/blob/v0.78.3/packages/react-native/Libraries/Utilities/HMRClient.js
  • https://github.com/facebook/react-native/blob/v0.79.0/packages/react-native/Libraries/Utilities/HMRClient.js

vestrelatlassian avatar Sep 17 '25 20:09 vestrelatlassian