Skip to content

Instantly share code, notes, and snippets.

View n-ii-ma's full-sized avatar
👨‍💻
Coding

Nima n-ii-ma

👨‍💻
Coding
View GitHub Profile
@n-ii-ma
n-ii-ma / SVG.tsx
Created January 6, 2024 07:17
Responsive SVG in React Native
import { View } from "react-native";
import { memo } from "react";
import Svg, { Circle, Path } from 'react-native-svg';
// Calculate aspect ratio
const originalWidth = 500;
const originalHeight = 500;
const aspectRatio = originalWidth / originalHeight;
const SVG = () => (
@n-ii-ma
n-ii-ma / Modal.tsx
Created December 25, 2023 09:37
Expo Modal
import {
StyleSheet,
View,
Modal,
TouchableOpacity,
TouchableWithoutFeedback,
} from "react-native";
import { memo } from "react";
import { ms } from "react-native-size-matters";
@n-ii-ma
n-ii-ma / Snackbar.tsx
Last active December 25, 2023 09:32
Expo Snackbar
import {
StyleSheet,
Text,
View,
TouchableOpacity,
Dimensions,
} from "react-native";
import { memo } from "react";
import Animated, { FadeInDown, FadeOutDown } from "react-native-reanimated";
import { Feather } from "@expo/vector-icons";
@n-ii-ma
n-ii-ma / Skeleton.tsx
Last active December 25, 2023 09:32
Animated Expo Skeleton
import { StyleSheet, View, Dimensions } from "react-native";
import { useEffect, memo } from "react";
import { LinearGradient } from "expo-linear-gradient";
import Animated, {
useSharedValue,
withTiming,
Easing,
interpolate,
useAnimatedStyle,
withRepeat,
@n-ii-ma
n-ii-ma / iranianPhoneRegex.js
Created October 22, 2023 07:04
Regular expression for Iranian phone numbers
// Phone numbers in English/Farsi
export const dynamicNumPhone =
/^(09|۰۹)((0|۰)[\u06F0-\u06F50-5]|(1|۱)[\u06F0-\u06F90-9]|(3|۳)[\u06F0-\u06F90-9]|(2|۲)[\u06F0-\u06F30-3]|(9|۹)[\u06F0-\u06F30-3])[\u06F0-\u06F90-9]{7}$/;
// Phone numbers in English
export const englishNumPhone =
/^09(0[0-5]|1[0-9]|3[0-9]|2[0-3]|9[0-3])[0-9]{7}$/;
// Phone numbers in Farsi
export const farsiNumPhone =