Selectables week numbers
See original GitHub issueDescription
When running the example app, pressing one of the week numbers on the Calendar with week numbers example causes the app to crash.
Expected Behavior
The week numbers should not be selectable ( behaving like other markings, such as the weekday names on the top)
Observed Behavior
Selecting the week number triggered the onPress
prop to trigger when it was not defined for the week numbers, causing the example app to crash.
Error output from the console:
ExceptionsManager.js:65 this.props.onPress is not a function
handleException @ ExceptionsManager.js:65
handleError @ InitializeCore.js:115
reportFatalError @ error-guard.js:44
__guardSafe @ MessageQueue.js:318
callFunctionReturnFlushedQueue @ MessageQueue.js:117
(anonymous) @ debuggerWorker.js:72
Environment
npm ls react-native-calendars
: react-native-calendars@1.17.3npm ls react-native
: react-native@0.53.3
Also specify:
- Phone/emulator/simulator & version: Simulator Version 10.0 (SimulatorApp-835.5 CoreSimulator-494.33)
- OS: macOS High Sierra 10.13.3
Reproducible Demo
The error can be observed on the example app present on the repository, but here follows a minimal reproducible version:
import React, {Component} from 'react';
import { StyleSheet, View } from 'react-native';
import {Calendar} from 'react-native-calendars';
export default class CalendarsScreen extends Component {
constructor(props) {
super(props);
this.state = {};
this.onDayPress = this.onDayPress.bind(this);
}
render() {
return (
<View style={styles.container}>
<Calendar
onDayPress={this.onDayPress}
style={styles.calendar}
hideExtraDays
showWeekNumbers
markedDates={{[this.state.selected]: {selected: true}}}
/>
</View>
);
}
onDayPress(day) {
this.setState({
selected: day.dateString
});
}
}
const styles = StyleSheet.create({
calendar: {
borderTopWidth: 1,
paddingTop: 5,
borderBottomWidth: 1,
borderColor: '#eee',
height: 350
},
container: {
flex: 1,
backgroundColor: 'gray'
}
});
Issue Analytics
- State:
- Created 6 years ago
- Comments:7 (4 by maintainers)
Top Results From Across the Web
How to select only a week number and a year ...
A week number is not selectable. However, you can implement one of the following solutions to select all days in a clicked week:...
Read more >Solved: How to calculate week number? - Page 4
Solved: Im creating a small booking app, where the users are used to Weeknumbers. Is it posible to spesify like : Week :...
Read more >Javascript Calendar Week selection Example
Define the number of days - The selectSize option can be any number, where 3 means three days, 7 means a week and...
Read more ><input type="week"> - HTML: HyperText Markup Language
The latest (time-wise) year and week number, in the string format ... 2017 will be seen as valid and be selectable in supporting...
Read more >Calendar Week Number in status - Apps on Google Play
This App shows you the Calendar Week Number directly in the Notification Bar, thats it The Work Week is shown also inside the...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
resolved v1.17.4 thanks for PR
Nope, built my own week calendar to have more flexibility.