Giter VIP home page Giter VIP logo

avantstay-ui's People

Contributors

dependabot[bot] avatar dielduarte avatar evjuniorm avatar evmjunior avatar felpin avatar gimoteco avatar jaugustodafranca avatar matpandino avatar pedroaraujo20 avatar rafaelmaiach avatar robertjfox avatar vandreleal avatar wellguimaraes avatar zibra avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

avantstay-ui's Issues

Tooltip not accepting functional components as children

 <Tooltip tip="abracadabra">
    <SomeFunctionalComponent />
</Tooltip>

Warning: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()?

Check the render method of Tooltip.

Controlling inner startDate and endDate state from outside

So, first of all, I don't know if I'm missing something and if I am, sorry for this in advance.
Couldn't find anything related to this on the docs so here we go...

I'm trying to use your DateRangePicker component and it would be a huge deal if there was a way to fully control the date range state from the outside with something like ContextAPI.

A simplified version or the component I've wrapped the DateRangePicker is:

export const DatePicker = ({ range, label }: DatePickerProps) => {
  const [isOpen, setIsOpen] = useState<boolean>(() => false);
  const { startDate, endDate } = range;

  const toggling = () => setIsOpen(!isOpen);

  const onOptionClicked = (selectedRange: DateSelection) => {
    setRange({
      startDate: selectedRange?.startDate ? moment(selectedRange.startDate).startOf('day').toISOString() : '',
      endDate: selectedRange?.endDate ? moment(selectedRange.endDate).endOf('day').toISOString() : ''
    });
  };

  return (
      <DateRangePicker
        singleDateRange={false}
        show={isOpen}
        onChange={(selectedRange: DateSelection) => onOptionClicked(selectedRange)}
        onClickOut={() => setIsOpen(false)}
        startDate={startDate}
        endDate={endDate}
      />
  );
};

And I've been calling that component with:

  const {
    period,
    setPeriod,
  } = useFilterContext();
  
  <DatePicker range={period} setRange={setPeriod} />

So, my problem here is: if I change startDate and endState states externally using contextApi(in this case useFilterContext() the date picker internally still shows the previousState for those.

Shouldn't this be responsible for watching that kind of change and update accordingly?

BTW, I thought that this could've been an issue related to using React in strict mode since using UNSAFE_componentWillReceiveProps in strict mode is not recommended and may indicate bugs.

Also, is there a reason for using UNSAFE_componentWillReceiveProps instead of componentDidUpdate, memoization techniques or even moving it to static getDerivedStateFromProps?

Thanks you so much!

FloatingContainer should calculate width

When using the FloatingContainer component, I've to set the width through className, but I think it could be calculated by default to the width of the containing element.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.