Comments (4)
maybe dates.displayedDate will be undefined, therefore we need to give certain conditions.
try this maybe it help:
const setDates = (dates) => {
if (dates.startDate != undefined) {
setStartDate(dates.startDate)
}
if (dates.displayedDate != undefined) {
setDisplayedDate(dates.displayedDate)
}
if (dates.endDate != undefined) {
setEndDate(dates.endDate)
}
};
from react-native-daterange-picker.
@longman0512 You need to ensure you handle the onChange event properly and set/update the 'displayedDate' prop correctly
from react-native-daterange-picker.
maybe dates.displayedDate will be undefined, therefore we need to give certain conditions.
try this maybe it help:
const setDates = (dates) => { if (dates.startDate != undefined) { setStartDate(dates.startDate) } if (dates.displayedDate != undefined) { setDisplayedDate(dates.displayedDate) } if (dates.endDate != undefined) { setEndDate(dates.endDate) } };
Work's fine.
from react-native-daterange-picker.
Set Like that
👇👇😊
const [dateObj, setDateObj] = useState({
startDate: null,
endDate: null,
displayedDate: moment(),
});
<DateRangePicker
onChange={dates => {
console.log('dates ------------------', dates);
setDateObj({
startDate:
'startDate' in dates
? moment(dates.startDate)
: dateObj?.startDate,
endDate:
'endDate' in dates ? moment(dates.endDate) : dateObj?.endDate,
displayedDate:
'displayedDate' in dates
? moment(dates.displayedDate)
: dateObj?.displayedDate,
});
}}
endDate={dateObj?.endDate}
startDate={dateObj?.startDate}
displayedDate={dateObj?.displayedDate}
range={true}
>
from react-native-daterange-picker.
Related Issues (17)
- Dates are not according to the day HOT 2
- Some Improvements
- Pre-defined buttons inside popup?
- Changing to hooks crash at 'displayedDate' HOT 4
- Backdrop feature HOT 6
- Slow HOT 8
- iOS calendar date range selection is not working ? HOT 2
- Toggle HOT 4
- Does not Contain @types HOT 1
- how to show select button
- unable to npm install react version need to updated from react@"^16.13.1" to onward HOT 1
- Invariant Violation: requireNatievComponent: "ENSVGPath" was not found in the UIManager. HOT 1
- Custom Labels when presetButtons for buttons (Today / This Week / This Month) is enabled
- RNSVGPath was not found in the UIManager gettting this error in both ios and android HOT 2
- Controlled isOpen HOT 2
- Can't position if I use it on Navigationbar HOT 2
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.
from react-native-daterange-picker.