storybookjs / native

📱 Storybook for Native: iOS, Android, Flutter
MIT License
188 stars 28 forks source link

[Bug] Stories are not rendering properly based off of example #96

Open michael-golfi opened 4 months ago

michael-golfi commented 4 months ago

Describe the bug

Running any story yields the following error. Including this story. I followed the instructions here and have set the proper environment variable for local simulation. I am not using appetize, I'd like to connect directly to the local simulator. I have deep linking working and I can manually use it directly from the commandline already.

could not find react-redux context value; please ensure the component is wrapped in a <Provider>
Error: could not find react-redux context value; please ensure the component is wrapped in a <Provider>
    at useReduxContext2 (http://localhost:4400/@fs/Users/michael/work/node_modules/.cache/sb-vite/deps/@storybook_native-components.js?v=dd971736:2814:11)
    at useStore3 (http://localhost:4400/@fs/Users/michael/work/node_modules/.cache/sb-vite/deps/@storybook_native-components.js?v=dd971736:2835:28)
    at useDispatch3 (http://localhost:4400/@fs/Users/michael/work/node_modules/.cache/sb-vite/deps/@storybook_native-components.js?v=dd971736:2856:17)
    at useAppDispatch (http://localhost:4400/@fs/Users/michael/work/node_modules/.cache/sb-vite/deps/@storybook_native-components.js?v=dd971736:3031:44)
    at WithStore (http://localhost:4400/@fs/Users/michael/work/node_modules/.cache/sb-vite/deps/@storybook_native-components.js?v=dd971736:55506:62)
    at renderWithHooks (http://localhost:4400/@fs/Users/michael/work/node_modules/.cache/sb-vite/deps/chunk-XXNDK2BK.js?v=dd971736:12171:26)
    at mountIndeterminateComponent (http://localhost:4400/@fs/Users/michael/work/node_modules/.cache/sb-vite/deps/chunk-XXNDK2BK.js?v=dd971736:14921:21)
    at beginWork (http://localhost:4400/@fs/Users/michael/work/node_modules/.cache/sb-vite/deps/chunk-XXNDK2BK.js?v=dd971736:15902:22)
    at beginWork$1 (http://localhost:4400/@fs/Users/michael/work/node_modules/.cache/sb-vite/deps/chunk-XXNDK2BK.js?v=dd971736:19749:22)
    at performUnitOfWork (http://localhost:4400/@fs/Users/michael/work/node_modules/.cache/sb-vite/deps/chunk-XXNDK2BK.js?v=dd971736:19194:20)
import { EmulatorRenderer } from "@storybook/native-components";
import type { Meta } from '@storybook/react';
import React from "react";

export const Example = (props) => {
  return (
    <EmulatorRenderer
      apiKey={'sdfsadfsdfsdfiojoisdf'}
      platform={'ios'}
      storyParams={{ component: "button" }}
      deepLinkBaseUrl="sb-native://deep.link"
    />
  );
};

const Story: Meta = {
  title: 'Components/Cards/ArticleCard',
  component: Example,
  parameters: {
    layout: 'fullscreen',
  },
  args: {
    apiKey: 'sdfsadfsdfsdfiojoisdf',
    platform: 'ios',
    storyParams: { component: "Components/Cards/ArticleCard" },
    deepLinkBaseUrl: "sb-native://deep.link"
  },
};

export default Story;

export const Primary = {}

main.ts

import type { StorybookConfig } from '@storybook/react-vite';

const config: StorybookConfig = {
  stories: ['../lib/**/*.stories.@(js|jsx|ts|tsx|mdx)'],
  framework: '@storybook/react-vite',
  core: {
    builder: '@storybook/builder-vite',
  },
  addons: [
    '@storybook/addon-essentials',
    "@storybook/addon-docs",
    "@storybook/addon-controls",
    "@storybook/native-addon",
    // "@storybook/native-addon/dist/register.js",
  ]
};

export default config;

middleware.ts

import { middleware } from '@storybook/native-dev-middleware';

export default middleware();

preview.ts

import { DeviceDecorator } from "@storybook/native-addon";

export const decorators = [DeviceDecorator];

Steps to reproduce the behavior

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior

It should render something.

Screenshots and/or logs

If applicable, add screenshots and/or logs to help explain your problem.

Environment

Additional context

Add any other context about the problem here.