Skip to content

Instantly share code, notes, and snippets.

View viniciusmoreria's full-sized avatar

Vinícius Moreira viniciusmoreria

View GitHub Profile
@derekstavis
derekstavis / Toast.tsx
Last active May 16, 2024 14:13
React Native Toast, without Context hell
/* Layout and Text components are my own utility components. Replace them by your own. */
import { memo, useEffect, useMemo, useState } from "react";
import { ViewStyle } from "react-native";
import { A } from "@mobily/ts-belt";
import mitt from "mitt";
import { v4 as uuid } from "@lukeed/uuid";
import Animated, {
Layout as REALayout,
Easing,
@intergalacticspacehighway
intergalacticspacehighway / keyboard-aware-reanimated-scrollview.tsx
Last active September 30, 2024 14:44
keyboard aware reanimated scrollview
import React from "react";
import { Dimensions, TextInput, ScrollView } from "react-native";
import Animated, {
useAnimatedKeyboard,
useAnimatedReaction,
runOnJS,
KeyboardState,
useAnimatedProps,
useAnimatedScrollHandler,
import React from "react";
import { View, SafeAreaView, Text, Dimensions } from "react-native";
import Animated, {
useSharedValue,
useAnimatedStyle,
useAnimatedScrollHandler,
interpolate,
interpolateColor,
Extrapolate,
} from "react-native-reanimated";
type AnyFunction = (...args: any[]) => any
function useEvent<T extends AnyFunction>(callback?: T) {
const ref = useRef<AnyFunction | undefined>(() => {
throw new Error("Cannot call an event handler while rendering.")
})
// Or useInsertionEffect if it's React 18
useLayoutEffect(() => {
ref.current = callback
})
@pSapien
pSapien / react-native-reanimated-drag-sort_apple-music.jsx
Created June 28, 2021 04:31 — forked from eveningkid/react-native-reanimated-drag-sort_apple-music.jsx
React Native Reanimated 2 Multiple Drag and Sort: Apple Music Example
// Expo SDK40
// expo-blur: ~8.2.2
// expo-haptics: ~8.4.0
// react-native-gesture-handler: ~1.8.0
// react-native-reanimated: ^2.0.0-rc.0
// react-native-safe-area-context: 3.1.9
import React, { useState } from 'react';
import {
Image,
@sibelius
sibelius / LookingForTheFirstJob.md
Last active July 3, 2023 08:48
Looking for the First Job state

Looking for the First Job

Versão em Português

This is a very common state for people in college, people before/after a bootcamp, or people from another area.

The first job will be the hardest one to get, but it will get easier over time.

The interview will be harder than the job itself

@KATT
KATT / favourite-ts-tricks.md
Last active July 26, 2023 06:16
🧙‍♂️ Favourite non-obvious TS tricks

Record<string, x | undefined>

Represent maps

// rather than 
const map: {[ key: string ]: string} = {
  foo: 'bar',
}
@Giladx
Giladx / her-os1-loading.markdown
Created July 18, 2019 01:07
Her - OS1 Loading

Her - OS1 Loading

Loading animation based on movie "Her" - OS1.

  • Mouse or Finger press on the page to finish loading action.

A Pen by gilad on CodePen.

License.

@wcandillon
wcandillon / wallet-animation.js
Created September 3, 2018 09:28
React Native Apple Wallet Animation
import React from "react";
import {
StyleSheet,
Text,
View,
ScrollView,
Animated,
SafeAreaView,
Dimensions
} from "react-native";