1

¡Buenas a todos! Estoy creando una story en Storybook y necesito que se muestre en componente RN-Range-Slider. El componente funciona genial en la app, pero a la hora de mostrarlo en el Storybook me da este error.

ERROR in ./node_modules/rn-range-slider/index.tsx 32:7
Module parse failed: Unexpected token (32:7)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders

La story esta de está de forma

import React from 'react';
import { ComponentStory, ComponentMeta } from '@storybook/react';

import SVDRange from "./SVDRange";

// More on default export: https://storybook.js.org/docs/react/writing-stories/introduction#default-export
export default {
    title: "Filters/SVDRange",
    component: SVDRange,
    // More on argTypes: https://storybook.js.org/docs/react/api/argtypes
} as ComponentMeta<typeof SVDRange>;

// More on component templates: https://storybook.js.org/docs/react/writing-stories/introduction#using-args
const Template: ComponentStory<typeof SVDRange> = (args) => <SVDRange {...args} />;

export const Primary = Template.bind({});
// More on args: https://storybook.js.org/docs/react/writing-stories/args
Primary.args = {
    currency: "€",
    Max: 100,
    Min : 0,
    filtertext : [],
    setFiltertext : () => {},
    SetmaxValue: () => {},
    SetminValue: () => {},   
    setShowFilter: () => {},
    setCurrentPage: () => {},
};

Alguno se le ocurre qué puede estar pasando. Saludos

1 respuesta 1

0

Acabo de encontrar está solución, que podría funcionar, que va la línea de lo que comentas Pablo. Añadiendo eso mismo al main.js del storybook.

module.exports = {
  "stories": [
    "../stories/**/*.stories.mdx",
    "../stories/**/*.stories.@(js|jsx|ts|tsx)"
  ],
  "addons": [
    "@storybook/addon-links",
    "@storybook/addon-essentials",
    "@storybook/addon-interactions",
    "@storybook/addon-react-native-web",
    "storybook-addon-apollo-client",
  ],
  "framework": "@storybook/react",
  "module": {
    "rules": [
      {
        "test": "/\.tsx?$/",
        "use": "ts-loader",
        "exclude": "/node_modules/",
      },
    ],
  },
  
}

0

Tu Respuesta

By clicking “Publica tu respuesta”, you agree to our terms of service and acknowledge you have read our privacy policy.

¿No es la respuesta que buscas? Examina otras preguntas con la etiqueta o formula tu propia pregunta.