Skip to content

Instantly share code, notes, and snippets.

View amandeepmittal's full-sized avatar

Aman Mittal amandeepmittal

View GitHub Profile
import React, { useState } from 'react';
import {
View,
Text,
StyleSheet,
TouchableOpacity,
Image,
ScrollView
} from 'react-native';
import { AntDesign } from '@expo/vector-icons';
import React from 'react';
import logo from './logo.svg';
import './App.css';
import { useHarperDB } from 'use-harperdb';
function App() {
const [data, loading, error, refresh] = useHarperDB({
query: { operation: 'sql', sql: 'select * from dev.books' }
});
Starting build
Download project archive
Unpacking project archive
Running yarn
yarn install v1.17.3
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.2.13: The platform "linux" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.3: The platform "linux" is incompatible with this module.
// RN or Expo apps
import React from 'react';
import { Text as RNText, StyleSheet } from 'react-native';
import { Typography, FontWeight } from '@config';
export default function Text({
header = false,
title1 = false,
<TouchableOpacity style={styles.button} onPress={addEventToCalendar}>
<Text style={[styles.text, { color: 'white' }]}>
Add this event to the calendar
</Text>
</TouchableOpacity>
function addEventToCalendar(title, startDateUTC) {
const eventConfig = {
title: eventTitle,
startDate: utcDateToString(startDateUTC),
endDate: utcDateToString(moment.utc(startDateUTC).add(1, 'hours')),
notes: 'Default Event Description'
};
AddCalendarEvent.presentEventCreatingDialog(eventConfig)
.then(eventInfo => {
const utcDateToString = momentInUTC => {
let s = moment.utc(momentInUTC).format('YYYY-MM-DDTHH:mm:ss.SSS[Z]');
return s;
};
const styles = StyleSheet.create({
container: {
flex: 1,
alignItems: 'center',
backgroundColor: '#f8f8f2',
paddingTop: 60
},
title: {
fontSize: 20,
textAlign: 'center'
export default function App() {
const [eventTitle, setEventTitle] = useState('Default event');
return (
<View style={styles.container}>
<Text style={styles.title}>
Add Event in device's Calendar from React Native App
</Text>
<View style={styles.inputContainer}>
<Text style={styles.text}>Enter the Event title:</Text>
export default function App() {
const [eventTitle, setEventTitle] = useState('Default event');
// rest of the code
}