question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

What's the update condition?

See original GitHub issue

First, it’s an awesome project!

I found that the control not always update as state changed, but it would update selected status if changing month, so what’s the update condition or is there any method to force updating control?

if comment this.shouldComponentUpdate = shouldComponentUpdate; in the calendar\index.js, it would update if component state changes.

anyway, i want to know why override shouldcomponentupdate method?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:7 (3 by maintainers)

github_iconTop GitHub Comments

3reactions
tautvilascommented, Aug 17, 2017

You are not treating markedDates as immutable. Since the reference of markedDates does not change update condition is not triggered. Use this whenever you change markedDates:

this.viewData.markedDates = Object.assign({}, this.viewData.markedDates);

0reactions
mharriswebcommented, Sep 12, 2018

Hi,

I have the same problem I am updating my markedDates:

loadItems(dates) {
    const { events } = this.props;

    const startDate = new Date(dates[0].year, dates[0].day, dates[0].month),
        endDate = new Date(dates[2].year, dates[2].day, dates[2].month),
      

    const newEvents = events.filter(date => { 
        moment()
            .range(startDate, endDate)
            .contains(date);
    });

    this.setState({
        markedDates: { ...newEvents, this.state.markedDates }
    });
}
 return (
            <CalendarList
                style={styles.calendar}
                markingType={"multi-dot"}
                onVisibleMonthsChange={this.loadItems}
                onDayPress={this.onDayPress}
                maxDate={"2019-12-19"}
                markedDates={this.state.markedDates}
                pastScrollRange={-1}
                futureScrollRange={12}
                scrollEnabled={true}
                showScrollIndicator={true}
            />
        );

@tautvilas Any ideas how I can get it to update?

Read more comments on GitHub >

github_iconTop Results From Across the Web

SQL update with where - w3resource
WHERE clause can be used with SQL UPDATE to add conditions while modifying records. Without using any WHERE clause, the SQL UPDATE command...
Read more >
How to Update a Column Based on a Filter of Another Column
Learn how to update a column based on a filter of another column. This tutorial will cover ways to update rows, including full...
Read more >
SQL UPDATE Statement - W3Schools
The UPDATE statement is used to modify the existing records in a table. ... WHERE condition; ... Notice the WHERE clause in the...
Read more >
Using a conditional UPDATE statement in SQL - Stack Overflow
I am working with it on MS SQL Server and MySQL Server too. UPDATE testingtable SET dob = CASE WHEN DATEDIFF(CURRENT_TIMESTAMP,ADDDATE(dob, INTERVAL -2...
Read more >
SQL - UPDATE Query - Tutorialspoint
The SQL UPDATE Query is used to modify the existing records in a table. You can use the WHERE clause with the UPDATE...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found