avantstay-ui's People
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
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google โค๏ธ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.