React Native Expo:未能在“CSSStyleDeclaration”上设置索引属性:不支持索引属性设置程序

mctunoxg  于 2023-10-22  发布在  React
关注(0)|答案(1)|浏览(110)

当我点击故事页面上的Addons按钮时,我得到以下错误:

Failed to set an indexed property on 'CSSStyleDeclaration': Indexed property setter is not supported

这是我的故事:

import React from "react";
import { Button } from "@rneui/themed";

const MyButtonMeta = {
  title: "MyButton",
  component: Button,
  argTypes: {
    onPress: { action: "pressed the button" },
  },
  args: {
    title: "Hello world",
    color: "error",
  },
  decorators: [(Story) => <Story />],
};

export default MyButtonMeta;

export const Basic = {};

export const AnotherExample = {
  args: {
    title: "Another example",
    color: "error",
  },
};

颜色属性有一些问题,因为如果我删除它,一切都很好!

有想法吗?tnx

  • expo SDK49
  • react-native-elements(rneui)4.0.0-rc.8
  • @storybook/react-native6.5.6

ig9co6j1

ig9co6j11#

我把颜色放在一个数组里。

import React from "react";
import { Button } from "@rneui/themed";

const MyButtonMeta = {
  title: "MyButton",
  component: Button,
  argTypes: {
    onPress: { action: "pressed the button" },
  },
  args: {
    title: "Hello world",
  },
  decorators: [
    (Story) => <Story />
  ],
};

export default MyButtonMeta;

export const Basic = {
  args: {
    title: "Basic",
    type: 'clear',
    color: ['warning']  // <------- HERE
  },
};

export const AnotherExample = {
  args: {
    title: "Another example",
  },
};

相关问题