Skip to content

Instantly share code, notes, and snippets.

View YewoMhango's full-sized avatar

Yewo Mhango YewoMhango

View GitHub Profile
@rhyek
rhyek / phone-input.tsx
Last active July 23, 2025 11:26
Mantine v7 Phone Input with country select
import { useEffect, useRef, useState } from 'react';
import {
useCombobox,
Combobox,
Group,
CheckIcon,
ScrollArea,
InputBase,
ActionIcon,
type InputBaseProps,
@ArnyminerZ
ArnyminerZ / MapLifecycle.kt
Created April 1, 2022 11:35
osmdroid approach with Jetpack Compose.
import androidx.compose.runtime.Composable
import androidx.compose.runtime.DisposableEffect
import androidx.compose.runtime.remember
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.platform.LocalLifecycleOwner
import androidx.lifecycle.Lifecycle
import androidx.lifecycle.LifecycleEventObserver
import org.osmdroid.views.MapView
@Composable
@rmorse
rmorse / react-router-dom-v.6.02.prompt.blocker.js
Last active July 2, 2025 19:35
Adds back in `useBlocker` and `usePrompt` to `react-router-dom` version 6.0.2 (they removed after the 6.0.0 beta, temporarily)
/**
* These hooks re-implement the now removed useBlocker and usePrompt hooks in 'react-router-dom'.
* Thanks for the idea @piecyk https://github.com/remix-run/react-router/issues/8139#issuecomment-953816315
* Source: https://github.com/remix-run/react-router/commit/256cad70d3fd4500b1abcfea66f3ee622fb90874#diff-b60f1a2d4276b2a605c05e19816634111de2e8a4186fe9dd7de8e344b65ed4d3L344-L381
*/
import { useContext, useEffect, useCallback } from 'react';
import { UNSAFE_NavigationContext as NavigationContext } from 'react-router-dom';
/**
* Blocks all navigation attempts. This is useful for preventing the page from
* changing until some condition is met, like saving form data.