Skip to content

Instantly share code, notes, and snippets.

View donatoaguirre24's full-sized avatar
🏠
Working from home

Donato Aguirre donatoaguirre24

🏠
Working from home
View GitHub Profile
@donatoaguirre24
donatoaguirre24 / logTime.js
Created May 13, 2019 14:03
Log the execution time of a certain portion of code
const tick = Date.now();
// the code goes here
const log = tick => console.log(`Elapsed: ${Date.now() - tick}ms`);
@donatoaguirre24
donatoaguirre24 / useRenderCount.js
Last active August 12, 2020 21:26
Logs the renders count of a React component
import { useRef } from 'react';
function useRendersCount(componentName) {
const renders = useRef(1);
console.log(`${componentName} renders count: ${renders.current++}`);
}
export default useRendersCount;
import * as React from "react";
import { Modal, Pressable, StyleProp, StyleSheet, View, ViewStyle } from "react-native";
import { PanGestureHandler } from "react-native-gesture-handler";
import Animated, {
Easing,
interpolate,
runOnJS,
useAnimatedGestureHandler,
useAnimatedStyle,
useSharedValue,