christopherdro / christopherdro/react-native-calendar

Doesnt display the calendar on entering the view ,

Open
#155 4 comments 1 reaction 0 assignees View on GitHub
Dominant language
JavaScript
Stars
536
Forks
233
PR merge metrics
No merged PRs in 30d

Description

But it does display the calendar when moving to next month back and forth.

![image](https://user-images.githubusercontent.com/1026325/28502188-fbcb863a-6fba-11e7-8b47-76441e8eec7b.png)

import Calendar from 'react-native-calendar';
import moment from 'moment';

const customDayHeadings = ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'];
const customMonthNames = ['Jan', 'Feb', 'Mar', 'Apr', 'May',
'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'];

class CalendarScreen extends Component {

constructor(props) {
super(props);
this.state = {
selectedDate: moment().format(),
};
}

// const ChatScreen = ({ label, value, onChangeText, placeholder, secureTextEntry }) => {
// const { inputStyle, labelStyle, containerStyle } = styles;

static navigationOptions = ({ navigation }) => ({
title: `${navigation.state.params.user}`,
});

render() {
const { params } = this.props.navigation.state;
console.log('23- ChatScreen this.props =', this.props );
return (


{
console.log( '39- on Date Select : date =', date );
this.setState({ selectedDate: date })
}
}
onTouchPrev={(e) => console.log('onTouchPrev: ', e)}
onTouchNext={(e) => console.log('onTouchNext: ', e)}
onSwipePrev={(e) => console.log('onSwipePrev: ', e)}
onSwipeNext={(e) => console.log('onSwipeNext', e)}
/>
Selected Date: {moment(this.state.selectedDate).format('MMMM DD YYYY')}

);
}
}

const styles = StyleSheet.create({
container: {
flex: 1,
paddingTop: 20,
backgroundColor: '#f7f7f7',
},
welcome: {
fontSize: 20,
textAlign: 'center',
margin: 10,
},
instructions: {
textAlign: 'center',
color: '#333333',
marginBottom: 5,
},
});

const mapStateToProps = (state) => {
// bal bla bla
};

export default connect(mapStateToProps, { propertyUpdate, propertySave })(CalendarScreen);

// export default ChatScreen;

//

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.