Skip to content

Instantly share code, notes, and snippets.

View oleg1994's full-sized avatar
🎯
Focusing

Oleg oleg1994

🎯
Focusing
View GitHub Profile
@oleg1994
oleg1994 / format number as currency while typing
Created December 27, 2025 18:52
format number as currency while typing
import React from "react";
import { StyleSheet, TextInput } from "react-native";
import { SafeAreaView, SafeAreaProvider } from "react-native-safe-area-context";
/**
* Formats a text input as currency-like text while typing.
* - Keeps only digits + one dot
* - Allows ".5" -> "0.5"
* - Limits decimals to 2
* - Adds thousands separators to the integer part
const [routeCoordinates, setRouteCoordinates] = useState([]);
useEffect(() => {
const getRoute = async () => {
const apiKey = process.env.EXPO_PUBLIC_googleMaps_ApiKey;
let userCoordinates = null;
try {
const location = await Location.getLastKnownPositionAsync();
userCoordinates = location;
} catch (error) {
import * as React from "react";
function isShallowEqual(object1, object2) {
const keys1 = Object.keys(object1);
const keys2 = Object.keys(object2);
if (keys1.length !== keys2.length) {
return false;
}