react-native-calendars icon indicating copy to clipboard operation
react-native-calendars copied to clipboard

CalendarList always shows minimum of three months in scroll

Open SukhKalsi opened this issue 9 years ago • 5 comments

Description

CalendarList component always shows three months.

Expected Behavior

When setting the props, I'd expect the CalendarList to show less than three months if required

Observed Behavior

No matter what I set in the props the CalendarList will default to showing minimum of three months.

Environment

Also specify:

  1. Phone/emulator/simulator & version: iOS Simulator on iOS 10.3

Reproducible Demo

Below will show the current month, along with the next two months. I only want the current month and the next month to be shown. Also if i wish to set the futureScrollRange to be zero, to only show the current month.

import { CalendarList } from 'react-native-calendars';

class Demo extends Component {

  render() {
    return (
      <CalendarList
        pastScrollRange={0}
        futureScrollRange={1}
      />
  }
}

SukhKalsi avatar Aug 15 '17 10:08 SukhKalsi

Hi, yes there is currently such limitation. Maybe you could also overcome this by using two Calendar components instead of CalendarList ?

tautvilas avatar Aug 17 '17 11:08 tautvilas

Out of curiosity where in this library are we forcing minimum of three months?

SukhKalsi avatar Aug 21 '17 12:08 SukhKalsi

I think here:

https://github.com/wix/react-native-calendars/blob/master/src/calendar-list/index.js#L52

There would be some bugs if there are less than 3 months, I think. need to check it.

tautvilas avatar Aug 21 '17 13:08 tautvilas

I set pastScrollRange={0} and futureScrollRange={1} and see error No item for index 2. It is working correctly when futureScrollRange is greater or equal than 2.

nulleof avatar Oct 18 '17 05:10 nulleof

resolved in 1.14.1

tautvilas avatar Nov 23 '17 12:11 tautvilas