Skip to content

Instantly share code, notes, and snippets.

View hieptl's full-sized avatar
🎯
Focusing

Hiep Le hieptl

🎯
Focusing
View GitHub Profile
@hieptl
hieptl / patientdetail.js
Last active December 11, 2021 07:10
patientdetail.js
import React from 'react';
import { View, Image, Text, StyleSheet } from 'react-native';
const PatientDetail = ({ route }) => {
const { item } = route.params;
if (!item) {
return <></>;
}
@hieptl
hieptl / doctordetail.js
Last active December 17, 2021 12:37
doctordetail.js - zocdoc clone
const createCometChatFriend = async () => {
if (!user || !item) {
return;
}
setIsLoading(true);
const cometChatAppId = `${cometChatConfig.cometChatAppId}`;
const cometChatAppRegion = `${cometChatConfig.cometChatRegion}`;
const cometChatApiKey = `${cometChatConfig.cometChatRestApiKey}`;
const url = `https://${cometChatAppId}.api-${cometChatAppRegion}.cometchat.io/v3/users/${user.id}/friends`;
const options = {
@hieptl
hieptl / doctordetail.js
Last active December 17, 2021 12:37
doctordetail.js - Zocdoc Clone
import React, { useEffect, useState, useContext } from 'react';
import { View, Image, Text, StyleSheet, TouchableOpacity, Alert, ActivityIndicator } from 'react-native';
import { AirbnbRating } from 'react-native-ratings';
import 'react-native-get-random-values';
import { v4 as uuidv4 } from "uuid";
import Context from '../context';
import { database, databaseRef, databaseSet, databaseQuery, orderByChild, equalTo, databaseOnValue, databaseOff } from "../firebase";
@hieptl
hieptl / appointmentitem.js
Created December 7, 2021 08:37
appointmentitem.js - Zocdoc Clone
import React from 'react';
import { View, Image, Text, StyleSheet, TouchableOpacity } from 'react-native';
const AppointmentItem = ({ item, onItemClick, isDoctor }) => {
const clickItem = () => {
onItemClick(item);
};
if (!item) {
return <></>;
@hieptl
hieptl / appointments.js
Last active December 17, 2021 12:35
appointments.js - Zocdoc Clone
import React, { useEffect, useState, useContext } from 'react';
import { View, FlatList, Text, StyleSheet } from 'react-native';
import AppointmentItem from './AppointmentItem';
import Context from '../context';
import { database, databaseRef, databaseQuery, orderByChild, equalTo, databaseOnValue, databaseOff } from "../firebase";
const Appointments = (props) => {
@hieptl
hieptl / doctoritem.js
Last active December 11, 2021 07:10
doctoritem.js - ZocDoc Clone
import React from 'react';
import { View, Image, Text, StyleSheet, TouchableOpacity } from 'react-native';
import { AirbnbRating } from 'react-native-ratings';
const DoctorItem = ({ item, onItemClick }) => {
if (!item) {
return <></>;
}
const clickItem = () => {
@hieptl
hieptl / doctors.js
Created December 7, 2021 08:16
doctors.js - ZocDoc Clone
import React, { useEffect, useState, useContext } from 'react';
import { View, FlatList, StyleSheet } from 'react-native';
import DoctorItem from './DoctorItem';
import Context from '../context';
import { database, databaseRef, databaseOnValue, databaseOff, databaseQuery, orderByChild, equalTo } from "../firebase";
const Doctors = (props) => {
@hieptl
hieptl / home.js
Created December 7, 2021 08:12
home.js - Zocdoc Clone
import React, { useContext } from 'react';
import Doctors from './Doctors';
import Appointments from './Appointments';
import Context from '../context';
const Home = (props) => {
const { navigation } = props;
@hieptl
hieptl / signup.js
Created December 7, 2021 08:06
signup.js - create cometchat account - ZocDoc Clone
const createCometChatAccount = async ({ id, fullname, avatar }) => {
try {
const authKey = `${cometChatConfig.cometChatAuthKey}`;
const user = new cometChat.User(id);
user.setName(fullname);
user.setAvatar(avatar);
const cometChatUser = await cometChat.createUser(user, authKey);
if (cometChatUser) {
showMessage('Info', `${fullname} was created successfully! Please sign in with your created account`);
setIsLoading(false);
@hieptl
hieptl / signup.js
Last active December 11, 2021 07:11
signup.js - ZocDoc Clone
import React, { useState, useContext } from 'react';
import { StyleSheet, View, TextInput, TouchableOpacity, Text, Alert, ActivityIndicator, Image, Platform } from 'react-native';
import validator from "validator";
import SelectDropdown from 'react-native-select-dropdown';
import { launchImageLibrary } from 'react-native-image-picker';
import Context from "../context";
import { cometChatConfig } from '../env';