6

React Native Week Month Date Picker

 2 years ago
source link: https://reactnativeexample.com/react-native-week-month-date-picker/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.

React Native Week Month Date Picker

Date picker with a week and month view

Installation

npm install react-native-week-month-date-picker

Usage

import { DatePicker } from 'react-native-week-month-date-picker';
import { addDays } from 'date-fns';

export default function App() {
  const [selectedDate, setSelectedDate] = React.useState(new Date());

  return (
    <SafeAreaView>
      <DatePicker
        startDate={new Date()}
        maxFutureDays={90}
        markedDates={[new Date(), addDays(new Date(), 2)]}
        onDateChange={(date) => setSelectedDate(date)}
        theme={{
          primaryColor: 'purple',
        }}
      >
        <View>
          <Text>Timeslots</Text>
          <Text>{selectedDate.toString()}</Text>
        </View>
      </DatePicker>
    </SafeAreaView>
  );
}

Contributing

See the contributing guide to learn how to contribute to the repository and the development workflow.

License

GitHub

View Github


About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK