Skip to content

rmc-date-picker 为何在移动端刷新之后数据丢失了? #255

@lxc9314

Description

@lxc9314

import React, { useState } from "react";
import "rmc-picker/assets/index.css";
import "rmc-date-picker/assets/index.css";
import DatePicker from "rmc-date-picker/lib/DatePicker";
import zhCn from "rmc-date-picker/lib/locale/zh_CN";
import enUs from "rmc-date-picker/lib/locale/en_US";
import { cn, format, minDate, maxDate, now } from "./utils";

const DatePick = props => {
const { locale } = props;
const [date, setDate] = useState(new Date(2017, 2, 31, 15, 1, 1));
const onDateChange = date => {
console.log("onChange", format(date));
setDate(date);
};
const onValueChange = (values, index) => {
console.log("onValueChange", values, index);
};
const onScrollChange = (values, index) => {
console.log("onScrollChange", values, index);
};
console.log(date);
return (
<DatePicker
rootNativeProps={{ "data-xx": "yy" }}
defaultDate={date || now}
mode="date"
locale={zhCn}
maxDate={maxDate}
minDate={minDate}
onDateChange={onDateChange}
onValueChange={onValueChange}
onScrollChange={onScrollChange}
>
);
};
DatePick.defaultProps = {
locale: cn ? zhCn : enUs
};

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions