Skip to content

Instantly share code, notes, and snippets.

View amandeepmittal's full-sized avatar

Aman Mittal amandeepmittal

View GitHub Profile
useEffect(() => {
const collectionRef = collection(database, 'chats');
const q = query(collectionRef, orderBy('createdAt', 'desc'));
const unsubscribe = onSnapshot(q, querySnapshot => {
setMessages(
querySnapshot.docs.map(doc => ({
_id: doc.data()._id,
createdAt: doc.data().createdAt.toDate(),
text: doc.data().text,
@amandeepmittal
amandeepmittal / authors.js
Created October 1, 2021 11:00
mock data for authors
export const AUTHORS = [
{
title: 'David Banner',
description:
'American rapper, record producer and activist from Mississippi',
dateOfBirth: '1974-04-11T00:00:00Z',
image_url:
'http://commons.wikimedia.org/wiki/Special:FilePath/David%20Banner%20at%20FOB%20Brassfield-Mora%202009-01-26%203.jpg',
placeOfBirth: 'Jackson',
articleUrl: 'https://en.wikipedia.org/wiki/David_Banner',
@amandeepmittal
amandeepmittal / books.js
Created October 1, 2021 11:00
Mock data
export const BOOKS = [
{
id: 1,
title: 'The Hunger Games',
authors: 'Suzanne Collins',
description:
"Winning will make you famous. Losing means certain death.The nation of Panem, formed from a post-apocalyptic North America, is a country that consists of a wealthy Capitol region surrounded by 12 poorer districts. Early in its history, a rebellion led by a 13th district against the Capitol resulted in its destruction and the creation of an annual televised event known as the Hunger Games. In punishment, and as a reminder of the power and grace of the Capitol, each district must yield one boy and one girl between the ages of 12 and 18 through a lottery system to participate in the games. The 'tributes' are chosen during the annual Reaping and are forced to fight to the death, leaving only one survivor to claim victory.When 16-year-old Katniss's young sister, Prim, is selected as District 12's female representative, Katniss volunteers to take her place. She and her male counterpart Peeta,
rules: {
'prettier/prettier': ['error'],
'no-use-before-define': 0,
'react/forbid-prop-types': 0,
'react/jsx-filename-extension': [1, { extensions: ['.js', '.jsx'] }],
'react/jsx-fragments': 0,
'react/jsx-props-no-spreading': 0,
'react/style-prop-object': 0,
'react/require-default-props': 0,
'react/prop-types': 0,
import React, { useState, useRef, useEffect } from 'react';
import {
StyleSheet,
Dimensions,
View,
Text,
TouchableOpacity
} from 'react-native';
import { Camera } from 'expo-camera';
import { Video } from "expo-av";
import React, { useRef } from 'react';
import {
StyleSheet,
Text,
View,
TouchableOpacity,
ScrollView,
Image,
Dimensions
} from 'react-native';
import 'react-native-gesture-handler';
import React from 'react';
import RootNavigator from './src/navigation/RootNavigator';
import { AuthenticatedUserProvider } from './src/navigation/AuthenticatedUserProvider';
const App = () => {
return (
<AuthenticatedUserProvider>
<RootNavigator />
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 [email protected]: The platform "linux" is incompatible with this module.
info "[email protected]" is an optional dependency and failed compatibility check. Excluding it from installation.
info [email protected]: The platform "linux" is incompatible with this module.