Comments (9)
Hi,
this handling is not included in a lib, try to use something like this:
const onDatesChange = ({ startDate, endDate, focusedInput }) => {
moment.range(startDate, endDate).by('days', (day) => {
if (isDateBlocked(day)) {
return console.log(day, 'is blocked');
}
});
this.setState({ ...this.state, focus: focusedInput }, () =>
this.setState({ ...this.state, startDate, endDate })
);
}
this code shouldn't update state with startDate
and endDate
in your state but print into console information that you cannot select this time range. There could be some nice popup message or any other information, but implementation is up to you :)
from react-native-dates.
Thanks for the answer, it causes my app to freeze though...
from react-native-dates.
My bad, I'll try to reproduce it locally and then let you know
from react-native-dates.
I've done a Pull Request for this issue, let me know :)
from react-native-dates.
@OzoTek is this working for you ?
i'm getting Unhandled JS Exception: _moment2.default.range is not a function
do you have any solution for this ?
from react-native-dates.
I'm using "moment-range": "^2.2.0"
as a dependency in my project, it works well. I think there have been some breaking changes with the v3 that are not supported by the lib.
from react-native-dates.
thanx it worked for me
from react-native-dates.
You fixed it with #13 right @OzoTek ?
from react-native-dates.
Yes, I'm closing.
from react-native-dates.
Related Issues (20)
- Date not focused if the hour changes HOT 2
- Excuse me, can't set up the Chinese? HOT 1
- Changing the selected date color HOT 3
- Upgrade to React Native @^42 HOT 2
- Change language of calendar HOT 4
- Highlight current date on calendar HOT 1
- Undefined moment2.default.range(currentDate.clone().startOf(iosweek)) HOT 1
- Move Sunday to beginning of week. HOT 2
- changing proportion of day blocks on selection HOT 1
- In `range={true}` case , How to change current date screen(calendar screen)
- Can't install react-native-dates by npm or yarn? HOT 1
- What is the license? HOT 1
- How to show year in calendar picker HOT 1
- Calendar not working properly with moment.locale in pt-br, suggestion to fix.
- Display Weeks from Sunday to Saturday
- Styling HOT 1
- Only future dates can be selected HOT 21
- _moment2.default.range is not a function HOT 3
- Not displaying Weeks in calander HOT 4
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-dates.