react-native-calendars
react-native-calendars copied to clipboard
my JS project crash with timeline: 'events.map' is undefined
Description
I just convert your timeline class to js, and get this error:
TypeError: events.map is not a function. (In 'events.map(function (ev, index) {
return (0, _extends2.default)({}, ev, {
index: index
});
})', 'events.map' is undefined)
in this line of class Packer.js

Here is my simple code:
<CalendarProvider
date={currentDate}
onDateChanged={date => {
// console.log('TimelineCalendarScreen onDateChanged: ', date)
setCurrentDate(date)
}}
onMonthChange={this.onMonthChange}
showTodayButton
todayBottomMargin={38}
disabledOpacity={0.6}
numberOfDays={7}
>
<ExpandableCalendar
firstDay={1}
markedDates={{
[`${getDate(-1)}`]: {marked: true},
[`${getDate()}`]: {marked: true},
[`${getDate(1)}`]: {marked: true},
[`${getDate(2)}`]: {marked: true},
[`${getDate(4)}`]: {marked: true}
}}
/>
<Timeline
events={{
"2022-07-14": [
{
"end": "2022-07-14 12:00:00",
"start": "2022-07-14 09:20:00",
"summary": "Merge Timeline Calendar to React Native Calendars",
"title": "Merge Request to React Native Calendars"
}
]
}}
timelineProps={{
format24h: true,
// onBackgroundLongPress: this.createNewEvent,
// onBackgroundLongPressOut: this.approveNewEvent,
// scrollToFirst: true,
start: 0,
end: 24,
// scrollToNow: true,
// unavailableHours: [{start: 0, end: 6}, {start: 22, end: 24}],
overlapEventsSpacing: 8,
rightEdgeSpacing: 24,
}}
showNowIndicator
// scrollToNow
scrollToFirst
initialTime={{hour: 0, minutes: 0}}
/>
</CalendarProvider>
Expected Behavior
I want to show timeline normally
Observed Behavior
If there's an error message, please paste the full terminal output and error message in this code block:
ERROR TypeError: events.map is not a function. (In 'events.map(function (ev, index) {
return (0, _extends2.default)({}, ev, {
index: index
});
})', 'events.map' is undefined)
This error is located at:
in Timeline (at UserScheduleScreen.js:318)
in RCTView (at View.js:32)
in View (at Provider.js:117)
in CalendarProvider (at UserScheduleScreen.js:296)
in UserScheduleScreen (at SceneView.tsx:132)
in StaticContainer
in EnsureSingleNavigator (at SceneView.tsx:124)
in SceneView (at useDescriptors.tsx:217)
in RCTView (at View.js:32)
in View (at DebugContainer.native.tsx:27)
in DebugContainer (at NativeStackView.native.tsx:76)
in MaybeNestedStack (at NativeStackView.native.tsx:247)
in RNSScreen (at createAnimatedComponent.js:211)
in AnimatedComponent (at createAnimatedComponent.js:264)
in AnimatedComponentWrapper (at src/index.native.tsx:281)
in MaybeFreeze (at src/index.native.tsx:280)
in Screen (at NativeStackView.native.tsx:180)
in SceneView (at NativeStackView.native.tsx:299)
in RNSScreenStack (at src/index.native.tsx:202)
in ScreenStack (at NativeStackView.native.tsx:290)
in NativeStackViewInner (at NativeStackView.native.tsx:344)
in RCTView (at View.js:32)
in View (at SafeAreaProviderCompat.tsx:42)
in SafeAreaProviderCompat (at NativeStackView.native.tsx:343)
in NativeStackView (at createNativeStackNavigator.tsx:72)
in Unknown (at createNativeStackNavigator.tsx:71)
in NativeStackNavigator (at HomeScreen.js:61)
in UserScheduleStackScreen (at SceneView.tsx:132)
in StaticContainer
in EnsureSingleNavigator (at SceneView.tsx:124)
in SceneView (at useDescriptors.tsx:217)
in RCTView (at View.js:32)
in View (at Screen.tsx:63)
in RCTView (at View.js:32)
in View (at Background.tsx:13)
in Background (at Screen.tsx:58)
in Screen (at BottomTabView.tsx:130)
in RNSScreen (at createAnimatedComponent.js:211)
in AnimatedComponent (at createAnimatedComponent.js:264)
in AnimatedComponentWrapper (at src/index.native.tsx:281)
in MaybeFreeze (at src/index.native.tsx:280)
in Screen (at ScreenFallback.tsx:38)
in MaybeScreen (at BottomTabView.tsx:123)
in RNSScreenNavigationContainer (at src/index.native.tsx:349)
in ScreenContainer (at ScreenFallback.tsx:29)
in MaybeScreenContainer (at BottomTabView.tsx:93)
in RCTView (at View.js:32)
in View (at SafeAreaProviderCompat.tsx:42)
in SafeAreaProviderCompat (at BottomTabView.tsx:92)
in BottomTabView (at createBottomTabNavigator.tsx:118)
in Unknown (at createBottomTabNavigator.tsx:117)
in BottomTabNavigator (at HomeScreen.js:92)
in HomeScreen (at SceneView.tsx:132)
in StaticContainer
in EnsureSingleNavigator (at SceneView.tsx:124)
in SceneView (at useDescriptors.tsx:217)
in RCTView (at View.js:32)
in View (at DebugContainer.native.tsx:27)
in DebugContainer (at NativeStackView.native.tsx:76)
in MaybeNestedStack (at NativeStackView.native.tsx:247)
in RNSScreen (at createAnimatedComponent.js:211)
in AnimatedComponent (at createAnimatedComponent.js:264)
in AnimatedComponentWrapper (at src/index.native.tsx:281)
in MaybeFreeze (at src/index.native.tsx:280)
in Screen (at NativeStackView.native.tsx:180)
in SceneView (at NativeStackView.native.tsx:299)
in RNSScreenStack (at src/index.native.tsx:202)
in ScreenStack (at NativeStackView.native.tsx:290)
in NativeStackViewInner (at NativeStackView.native.tsx:344)
in RNCSafeAreaProvider (at SafeAreaContext.tsx:76)
in SafeAreaProvider (at SafeAreaProviderCompat.tsx:46)
in SafeAreaProviderCompat (at NativeStackView.native.tsx:343)
in NativeStackView (at createNativeStackNavigator.tsx:72)
in Unknown (at createNativeStackNavigator.tsx:71)
in NativeStackNavigator (at App.js:285)
in EnsureSingleNavigator (at BaseNavigationContainer.tsx:430)
in BaseNavigationContainer (at NavigationContainer.tsx:132)
in ThemeProvider (at NavigationContainer.tsx:131)
in NavigationContainerInner (at App.js:280)
in RCTView (at View.js:32)
in View (at ActionSheet/index.ios.tsx:16)
in ActionSheet (at ActionSheetProvider.tsx:35)
in ActionSheetProvider (at App.js:279)
in Provider (at SignalrContext.js:60)
in SignalrWrapper (at App.js:273)
in Unknown (at App.js:269)
in Provider (at App.js:268)
in App (at renderApplication.js:50)
in RCTView (at View.js:32)
in View (at AppContainer.js:92)
in RCTView (at View.js:32)
in View (at AppContainer.js:119)
in AppContainer (at renderApplication.js:43)
in VedaxLink(RootComponent) (at renderApplication.js:60)
Environment
Please run these commands in the project folder and fill in their results:
npm ls react-native-calendars: [email protected]npm ls react-native:
/Users/thehe/Desktop/VedaxLink
├─┬ @freakycoder/[email protected]
│ └── [email protected] deduped
├─┬ @react-native-community/[email protected]
│ └── [email protected] deduped
├─┬ @react-native-community/[email protected]
│ └── [email protected] deduped
├─┬ @react-native-masked-view/[email protected]
│ └── [email protected] deduped
├─┬ @react-native-segmented-control/[email protected]
│ └── [email protected] deduped
├─┬ @react-navigation/[email protected]
│ ├─┬ @react-navigation/[email protected]
│ │ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
│ └── [email protected] deduped
├─┬ @react-navigation/[email protected]
│ └── [email protected] deduped
├─┬ @react-navigation/[email protected]
│ └── [email protected] deduped
├─┬ @react-navigation/[email protected]
│ └── [email protected] deduped
├─┬ @realm/[email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
│ └─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └─┬ [email protected]
│ ├─┬ @react-native-community/[email protected]
│ │ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer
├─┬ [email protected]
│ ├─┬ [email protected]
│ │ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
│ ├─┬ [email protected]
│ │ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ ├─┬ @jsamr/[email protected]
│ │ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
│ ├─┬ @native-html/[email protected]
│ │ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected] invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
│ └─┬ @react-native-community/[email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
└─┬ [email protected]
├─┬ [email protected]
│ └── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
└── [email protected] deduped invalid: "0.54.3" from node_modules/react-native-doc-viewer, "0.61.4" from node_modules/react-native-keyboard-input
npm ERR! code ELSPROBLEMS
npm ERR! invalid: [email protected] /Users/thehe/Desktop/VedaxLink/node_modules/react-native
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/thehe/.npm/_logs/2022-07-15T10_21_29_001Z-debug-0.log
Also specify:
- Device/emulator/simulator & OS version: IPhone 13 simulator ios 15.5
Reproducible Demo
Please provide a minimized reproducible demonstration of the problem you're reporting.
Issues that come with minimal repro's are resolved much more quickly than issues where a maintainer has to reproduce themselves.
Screenshots
