arco-design / arco-design-mobile

React mobile UI components library based on Arco Design
https://arco.design/mobile/react/arco-design/pc/#/
MIT License
421 stars 76 forks source link

[Picker] 首次渲染 `renderLinkedContainer` 函数中的`data`为空 #293

Open canvascat opened 1 month ago

canvascat commented 1 month ago

Basic Info

import React from "react";
import { Picker } from "@arco-design/mobile-react";

const options = [
  { label: "male", value: "1" },
  { label: "female", value: "2" },
  { label: "others", value: "3" },
];

export default function FormDemo() {
  const [value, setValue] = React.useState(["1"]);
  return (
    <Picker
      value={value}
      onChange={setValue}
      renderLinkedContainer={(value, data) => {
        console.debug(value, data);
        return (
          <div
            className="arco-form-picker-link-container"
            style={{ width: 240, height: 30, border: "1px solid #ccc" }}
          >
            {data.map((item) => item.label).join(",")}
          </div>
        );
      }}
      cascade={false}
      data={options}
      maskClosable
    />
  );
}

在有初始值的情况下,显示data为空 image