This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const getPercentageInHex = (percentage: number): string => { | |
if (percentage >= 0 && percentage <= 100) { | |
const preHexNumber = (percentage * 255) / 100; | |
const hexNumber = preHexNumber.toString(16).split('.')[0].padStart(2, '0').replace('f0', 'ff'); | |
return hexNumber; | |
} | |
return 'ff'; | |
}; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { useEffect, useRef, useState } from "react"; | |
export const useGetDivDimensions = () => { | |
const [dimensions, setDimensions] = useState({ height: 0, width: 0 }); | |
const div_ref = useRef<HTMLDivElement | null>(null); | |
useEffect(() => { | |
const resizeObserver = new ResizeObserver((event) => { | |
setDimensions({ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { TouchableOpacity, View } from 'react-native'; | |
import { withLightHapticFeedback } from '_utils'; | |
import { C_Text } from './C_Text'; | |
const weekdays = ['L', 'M', 'X', 'J', 'V', 'S', 'D']; | |
export const WeekdaysSelector = ({ | |
selectedDays, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Plausible, { EventOptions, PlausibleOptions } from 'plausible-tracker'; | |
import { setLocationHref } from '@expo/metro-runtime/build/location/Location.native.js'; | |
// NOTE: see tracking events here: https://plausible.io/asd.xyz | |
const runPlausibleInitialConfig = () => { | |
let alreadyRun = false; | |
if (!alreadyRun) { | |
alreadyRun = true; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dayjs from 'dayjs'; | |
/** | |
* return DD/MM/YYYY | |
*/ | |
export const removeHoursMinutesAndSecondsFromDate = ( | |
date: Date, | |
): {newDate: dayjs.Dayjs; DDMMYYYY: string} => { | |
const _date = dayjs(date); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import dayjs from 'dayjs'; | |
export const validateAtLeast13Years = (DDMMYYYY?: string): boolean => { | |
if (!DDMMYYYY) return false; | |
const timePickerDate = DDMMYYYY.split('/').reverse().join('-'); | |
const date1 = dayjs(); | |
const date2 = dayjs(timePickerDate); | |
const diff = date1.diff(date2, 'years'); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const checkVersionAIsGreaterOrEqualThanVersionB = ({ | |
versionA, | |
versionB, | |
}: { | |
versionA: string; // 1.2.3 | |
versionB: string; // 1.2.3 | |
}): boolean => { | |
const _versionA = { | |
major: parseInt(versionA.split('.')[0], 10), // 1.2.3 -> 1 | |
minor: parseInt(versionA.split('.')[1].split('.')[0], 10), // 1.2.3 -> 2 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const gistUrl = 'https://gist.github.com/sturmenta/df1c9da1f219c88e996e48f19d57acd3'; | |
const {data, error} = await getGistFirstFileText(`${gistUrl}.json`); | |
console.log(data); | |
// ## some title | |
// | |
// some text |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import Qs from 'qs'; | |
import {GOOGLE_MAPS_API_KEY} from 'react-native-dotenv'; | |
export const getGoogleMapsPlaceByAutocomplete = ( | |
place: string, | |
): Promise<{ | |
data?: { | |
predictions: Array<{ | |
description: string; | |
place_id: string; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, {useState} from 'react'; | |
import {ImageProps, View} from 'react-native'; | |
import FastImage, {FastImageProps} from 'react-native-fast-image'; | |
import {useComponentTrackTrace} from '_hooks'; | |
import {ShowProgress} from '_atoms'; | |
import {ToastShow} from '_utils'; | |
import {getNewImageSizeByAspectRatio} from './get-new-image-size-by-aspect-ratio'; |