stephy / CalendarPicker

CalendarPicker Component for React Native
792 stars 369 forks source link

Default date #133

Closed mozamonkey closed 5 years ago

mozamonkey commented 5 years ago

How can I set the current date as the default date that's highlighted?

Does it make sense to change selectedStartDate = null?

peacechen commented 5 years ago

try selectedStartDate={ moment() }

mozamonkey commented 5 years ago

that doesn't work. are there any other functions?

peacechen commented 5 years ago

My app is using the selectedStartDate prop and it's working. Please post a code snippet along with any styles you're passing to CalendarPicker.

mozamonkey commented 5 years ago
constructor(props){
        super(props)
        this.state = {
                  selectedStartDate: null,      
        };
        this.onDateChange = this.onDateChange.bind(this);   
    }

<Text style={{fontFamily: 'Avenir Next', fontWeight: '700', fontSize: 12, marginTop: -20, marginLeft: 25, color: '#4A494A'}}>
                            Select Date: {startDate}
                                </Text>
                            </TouchableOpacity>
                        <View style={{backgroundColor: 'white'}}>
                            <CalendarPicker
                            minDate={minDate}   
                            onDateChange={this.onDateChange}
                            selectedDayColor="#4FE3C1"
                          />
                        </View>
peacechen commented 5 years ago

selectedStartDate isn't being passed to CalendarPicker. Am I missing something?

peacechen commented 5 years ago

Closing due to inactivity. Re-open if this continues to be an issue.