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

Timeline is being hidden by bottom tab navigator

Open tuanthanh2067 opened this issue 2 years ago • 6 comments

Description

I'm having an error where my timeline will stops at 23:00, and I couldn't scroll past it. The screen has a header, and a bottom navigator. I tried to add margin or padding to the bottom but it doesn't work. Hidding the header, and bottom navigator is also not an option.

Expected Behavior

The timeline from 1:00 to 23:59 should be visible.

Observed Behavior

What actually happened when you performed the above actions?

No error message

Environment

Please run these commands in the project folder and fill in their results:

Also specify:

  1. Device/emulator/simulator & OS version: Iphone 12, IOS 16

Reproducible Demo

https://github.com/wix/react-native-calendars/assets/51014333/787866de-fc0b-4574-bf21-241fe00f0398

Code

import React, { useState } from "react";
import { useTheme, Text, Button, Chip } from "@rneui/themed";
import { SafeAreaView, View, ScrollView } from "react-native";
import Animated, { FadeInRight } from "react-native-reanimated";
import {
  TimelineList,
  CalendarUtils,
  CalendarProvider,
  Calendar,
} from "react-native-calendars";
import _ from "lodash";

const today = new Date();
const INITIAL_TIME = { hour: 9, minutes: 0 };
export const getDate = (offset = 0) =>
  CalendarUtils.getCalendarDateString(
    new Date().setDate(today.getDate() + offset)
  );

const PlanAgenda: React.FC = () => {
  const EVENTS = [
    {
      start: `${getDate(-1)} 09:20:00`,
      end: `${getDate(-1)} 12:00:00`,
      title: "Merge Request to React Native Calendars",
      summary: "Merge Timeline Calendar to React Native Calendars",
    },
    {
      start: `${getDate()} 01:45:00`,
      end: `${getDate()} 02:45:00`,
      title: "Meeting C",
      summary: "Summary for meeting C",
      color: "#e6add8",
    },
    {
      start: `${getDate()} 02:40:00`,
      end: `${getDate()} 03:10:00`,
      title: "Meeting D",
      summary: "Summary for meeting D",
      color: "#e6add8",
    },
    {
      start: `${getDate()} 02:50:00`,
      end: `${getDate()} 03:20:00`,
      title: "Meeting E",
      summary: "Summary for meeting E",
      color: "#e6add8",
    },
    {
      start: `${getDate()} 04:30:00`,
      end: `${getDate()} 05:30:00`,
      title: "Meeting F",
      summary: "Summary for meeting F",
      color: "#e6add8",
    },
    {
      start: `${getDate(1)} 04:10:00`,
      end: `${getDate(1)} 04:40:00`,
      title: "Tea Time with Dr. Hasan",
      summary: "Tea Time with Dr. Hasan, Talk about Project",
    },
  ];

  const eventsByDate = _.groupBy(EVENTS, (e) =>
    CalendarUtils.getCalendarDateString(e.start)
  );

  const timelineProps = {};

  return (
    <SafeAreaView style={{ flex: 1, justifyContent: "center" }}>
      <CalendarProvider
        date={"2023-06-01"}
        disabledOpacity={0.6}
        // numberOfDays={3}
        showTodayButton
      >
        {/* <Calendar firstDay={1} /> */}
        <TimelineList
          events={eventsByDate}
          timelineProps={{
            format24h: true,
            start: 0,
            end: 24,
            overlapEventsSpacing: 8,
            rightEdgeSpacing: 24,
          }}
          showNowIndicator
          scrollToNow
          initialTime={INITIAL_TIME}
        />
      </CalendarProvider>
    </SafeAreaView>
  );
};

export default PlanAgenda;

tuanthanh2067 avatar Jun 01 '23 20:06 tuanthanh2067

@tuanthanh2067, Have you solved the issue? I was getting the same issue, which was solved by adding margin-bottom in the theme.

<TimelineList
    events={eventsByDate}
    timelineProps={{
      theme: {...theme, timelineContainer: {
         marginBottom: tabBarHeight,
      }}
      format24h: true,
      start: 0,
      end: 24,
      overlapEventsSpacing: 8,
      rightEdgeSpacing: 24,
    }}
    showNowIndicator
    scrollToNow
    initialTime={INITIAL_TIME}
  />

david-fang0621 avatar Jun 08 '23 21:06 david-fang0621

@david-fang0621

Thanks, I wasn't able to solve it so I switched to a different library, but thank you for your recommendation. I'll try it 💯

tuanthanh2067 avatar Jun 08 '23 21:06 tuanthanh2067

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

stale[bot] avatar Sep 17 '23 05:09 stale[bot]

Any solutions?

modifyljf avatar Sep 21 '23 20:09 modifyljf

I have the same problem. Has anyone found a solution?

aliyapici avatar Jan 28 '24 13:01 aliyapici

@tuanthanh2067, Have you solved the issue? I was getting the same issue, which was solved by adding margin-bottom in the theme.

<TimelineList
    events={eventsByDate}
    timelineProps={{
      theme: {...theme, timelineContainer: {
         marginBottom: tabBarHeight,
      }}
      format24h: true,
      start: 0,
      end: 24,
      overlapEventsSpacing: 8,
      rightEdgeSpacing: 24,
    }}
    showNowIndicator
    scrollToNow
    initialTime={INITIAL_TIME}
  />

Thanks! This solution works! Really appreciated it.

geoffcfchen avatar May 16 '24 06:05 geoffcfchen