Skip to content

Instantly share code, notes, and snippets.

View badalsaibo's full-sized avatar
🌱
Do. Doing.

badal badalsaibo

🌱
Do. Doing.
View GitHub Profile
import { BottomSheetModal, BottomSheetModalProps } from '@gorhom/bottom-sheet';
import { useCallback, useRef } from 'react';
import { BackHandler, NativeEventSubscription } from 'react-native';
/**
* hook that dismisses the bottom sheet on the hardware back button press if it is visible
* @param bottomSheetRef ref to the bottom sheet which is going to be closed/dismissed on the back press
*/
export const useBottomSheetBackHandler = (
bottomSheetRef: React.RefObject<BottomSheetModal | null>,
@gregfenton
gregfenton / AuthProvider.js
Created February 8, 2022 03:18
A React/React-Native authentication provider that uses the Context API to make authentication & profile info available to "the rest of the app"
import React, {createContext, useEffect, useState} from 'react';
import auth from '@react-native-firebase/auth'; // or from 'firebase/auth';
import Loading from '../components/Loading';
import {myFirestore} from '../common/firebase.js';
export const AuthContext = createContext({});
export const AuthProvider = (props) => {

Layout projection: A method for animating browser layouts at 60fps

Introduction

Animating layout is hard. Prohibitively so; how many ambitious designers have provided dev teams dazzling videos of app-quality UI animations, only to be rebuffed?

If you're a web developer, what would your reaction be if asked to realise this kind of App Store-style interaction, where an item opens into a full-screen view when clicked:

Y2Mate.is.-.Inside.Framer.Motion.s.Layout.Animations.-.Matt.Perry-5-JIu0u42Jc-1080p-1651813013467.online-video-cutter.com.mp4
@dannysmc95
dannysmc95 / pure-downloaded-capacitor.js
Last active February 18, 2024 03:02
Download a file with pure Capacitor FileSystem and the Fetch API.
const downloadFile = async (uri, path, folder) => {
return new Promise(async (resolve, reject) => {
try {
const file_request = await fetch(uri, {
method: 'GET',
credentials: 'include',
mode: 'cors',
});
const file_blob = await file_request.blob();
@ShopifyEng
ShopifyEng / Confetti.tsx
Created April 6, 2020 17:11
Building Arrive's Confetti in React Native with Reanimated - Confetti Final
import React, {useMemo} from 'react'
import Animated from 'react-native-reanimated'
import {View, Dimensions, StyleSheet} from 'react-native'
import FastImage from 'react-native-fast-image'
import ConfettiImage from 'assets/images/confetti.png'
const NUM_CONFETTI = 100
const COLORS = ['#00e4b2', '#09aec5', '#107ed5']
const CONFETTI_SIZE = 16
@bergmannjg
bergmannjg / rearct-native-app-in-wsl2.md
Last active April 15, 2025 09:32
Building a react native app in WSL2
@derekstavis
derekstavis / FastList.tsx
Last active March 20, 2025 08:39 — forked from vishnevskiy/FastList.js
Discord's FastList, but in TypeScript
import { forEachObjIndexed } from "ramda";
import * as React from "react";
import {
Animated,
ScrollView,
View,
ViewStyle,
LayoutChangeEvent,
NativeScrollEvent,
} from "react-native";
@reinvanoyen
reinvanoyen / terminal-prompt-git-branch-zsh.md
Last active April 22, 2025 18:55
Add Git Branch Name to Terminal Prompt (MacOS zsh)

Add Git Branch Name to Terminal Prompt (zsh)

Updated for MacOS with zsh

  • Catalina
  • Big Sur
  • Monterey
  • Ventura
  • Sonoma

screenshot

@parmentf
parmentf / GitCommitEmoji.md
Last active April 29, 2025 11:20
Git Commit message Emoji
@aleksblago
aleksblago / Date-Select-Markup.html
Last active April 4, 2025 21:59
Markup: Select options for Month, Day, and Year.
<span>
<select name="day">
<option value="monday">Monday</option>
<option value="tuesday">Tuesday</option>
<option value="wednesday">Wednesday</option>
<option value="thursday">Thursday</option>
<option value="friday">Friday</option>
<option value="saturday">Saturday</option>
<option value="sunday">Sunday</option>
</select>