Skip to content

Instantly share code, notes, and snippets.

@sp0033212000
sp0033212000 / country.json
Created July 25, 2023 10:44 — forked from jnlin/country.json
國碼與電話國碼對應表 (JSON)
{
"userinfo_country_code": {
"0": "請選擇",
"US": "美國 (+1)",
"CA": "加拿大 (+1)",
"UK": "英國 (+44)",
"AF": "阿富汗 (+93)",
"AR": "阿根廷 (+54)",
"AT": "奧地利 (+43)",
@sp0033212000
sp0033212000 / country.json
Created July 25, 2023 10:44 — forked from jnlin/country.json
國碼與電話國碼對應表 (JSON)
{
"userinfo_country_code": {
"0": "請選擇",
"US": "美國 (+1)",
"CA": "加拿大 (+1)",
"UK": "英國 (+44)",
"AF": "阿富汗 (+93)",
"AR": "阿根廷 (+54)",
"AT": "奧地利 (+43)",
const locationOption = {
countryType: [{ key: "TW", label: "台灣", active: true }],
cityType: {
TW: [
{ key: "KLU", label: "基隆市", active: true },
{ key: "TPH", label: "新北市", active: true },
{ key: "TPE", label: "臺北市", active: true },
{ key: "TYC", label: "桃園市", active: true },
{ key: "HSH", label: "新竹縣", active: true },
{ key: "HSC", label: "新竹市", active: true },
@sp0033212000
sp0033212000 / useAsyncDialog.tsx
Created June 26, 2021 03:17
async prompt with custom component
import { useState, useCallback } from "react";
type Resolver = ((value: string) => void) | null;
type Rejecter = ((reason?: any) => void) | null;
const useAsyncDialog = () => {
const [show, setShow] = useState<boolean>(false);
const [resolver, setResolver] = useState<Resolver>(null);
const [rejecter, setRejecter] = useState<Rejecter>(null);
import React, { useState, useRef, useCallback } from "react";
import CustomModal from "../component/CustomModal";
type Resolver = ((value?: unknown) => void) | null;
type Rejecter = ((reason?: any) => void) | null;
const useAsyncDialog = ({
title,
paragraph,
confirm,
import React, { useState, FC } from "react";
import { Button, Modal } from "react-bootstrap";
import "./styles.css";
import CustomModal from "./component/CustomModal";
export default function App() {
const [show, setShow] = useState(false);
const handleConfirm = () => {
alert("Do something when user confirm");
{"lastUpload":"2021-03-29T02:31:31.047Z","extensionVersion":"v3.4.3"}
{"lastUpload":"2021-03-29T02:53:00.542Z","extensionVersion":"v3.4.3"}
@sp0033212000
sp0033212000 / gist:265fa55752d681edf340773cd9788178
Last active February 8, 2021 03:35
src/types/declarations.d.ts
declare module "react-native-config" {
export interface Env {
ENVIRONMENT: "development" | "production";
}
export const Config: Env;
export default Config;
}
import React, {
ComponentProps,
useCallback,
useEffect,
useMemo,
useRef,
useState,
} from "react";
import {
StyleSheet,