synchronize google calendar events in agenda
See original GitHub issueHi everybody,
I am newbie to react native and trying to show events from my google calendar on the agenda. Is there an any sample code that shows how to do that because I am really stuck at this point. Here is what I have done so far, i was able to get the events as json from google calendar but I do not know how to display it in the calendar.
`import React from 'react';
import { SafeAreaView, View, Text, StatusBar, Image, AppRegistry, ScrollView, StyleSheet, TouchableHighlight, FlatList } from 'react-native';
import glamorous from "glamorous-native";
import { Calendar, Agenda } from 'react-native-calendars';
import { bColor, pColor } from "../style/colors"
import request from 'superagent'
export default class AppCalendar extends React.Component {
static navigationOptions = ({ navigation }) => ({
title: "Calendar",
});
constructor(props) {
super(props)
this.state= {
events:null
}
}
componentDidMount(){
let postsUrl = "https://www.googleapis.com/calendar/v3/calendars/id/api-key
fetch(postsUrl)
.then((response) => response.json())
.then((response) => {
this.setState({
events: response
})
})
}
fetchData(){
let e = []
if(this.state.events != null) {
for (let i = 0; i < this.state.events.length; i++) {
let newEvent = {}
newEvent.title = this.state.events[i].summary
newEvent.location = this.state.events[i].location
newEvent.startDate = this.state.events[i].start.date || this.state.events[i].start.dateTime
newEvent.endDate = this.state.events[i].end.date || this.state.events[i].end.dateTime
e.push(newEvent)
}
return e[1]
}
else{
return 'wrong'
}
}
render() {
return(
<Container>
<Agenda
items={this.state.events}
loadItemsForMonth={this.loadItems.bind(this)}
selected={'2017-05-16'}
renderItem={() => {return (<View />);}}
renderEmptyDate={() => {return (<View />);}}
rowHasChanged={() => {return r1.name !== r2.name;}}
onCalendarToggled={(calendarOpened) =>
}
/>
</Container>
)
}
loadItems(day) {
this.setState(
{events :null}
)
}
}`
const Container = glamorous.safeAreaView({
flex: 1,
})
Issue Analytics
- State:
- Created 5 years ago
- Comments:5
Top Results From Across the Web
Fix sync problems with the Google Calendar app - Android
Open the Settings app on your device (not the Google settings app). Tap Accounts. Select an account. Tap Account sync. Make sure Account...
Read more >Synchronize resources efficiently | Google Calendar
This guide describes how to implement "incremental synchronization" of calendar data. ... In this example we are only syncing events up to a...
Read more >How To Use Google Calendar Sync To Always Be On Top Of ...
Step 1: Open the Google Calendar app on your device. Step 2: On the top right part of the screen, click on the...
Read more >Sync events to Google Calendar on Android
1. The Calendar app automatically syncs any events and dates associated with your Google Account.To see events from another calendar like iCal or...
Read more >how to sync old events? - Google Groups
google calendar function to exchange the primary calendar). now i miss old entries, they are still in my google calendar, but not in...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Hey @trancanh2202
Yes, I actually solved it. The Agenda requires you to take the events in a specific format. Therefore, I had to adjust my events based on that. Then, it worked like a charm. Here is my code after I edited it,
PS: Don’t forget to put your api key for your calendar
I needed the exact same thing. I accomplished this by using Zapier.com. It syncs my Google Calendar events with my Firebase (or any other service, options are endless). Then I load the data from Firebase into the Agenda Calendar.