Skip to content

Instantly share code, notes, and snippets.

View AlexeyTsutsoev's full-sized avatar
🎯
Focusing

Alexey Tsutsoev AlexeyTsutsoev

🎯
Focusing
View GitHub Profile
navigation.dispatch(
CommonActions.reset({
index: 0,
routes: [
{
name: 'protected',
state: {
index: 0,
routes: [
{
@AlexeyTsutsoev
AlexeyTsutsoev / AnimationList.swift
Created April 15, 2023 09:51
Lottie Adapter for SwiftUI macOS + iOS
import Foundation
/// list animation with name from Resources
public enum AnimationList: String {
/// stub for screens that are still in progress
case inProgress = "in-develop-animation"
/// animation for showing with some errors
case errorAnimation = "error-animation"
/// animation for showing with array
case emptyAnimation = "empty-animation"
@AlexeyTsutsoev
AlexeyTsutsoev / UniversalView.swift
Created April 14, 2023 15:35
Universal View for multiplatform SwiftUI Apps
import SwiftUI
/// view for resolve different UI for MacOS and iOS
///
/// - Usage
/// ```
/// UniversalView {
/// ViewForIPhone
/// } desktop: {
/// ViewForMacOSOrIPad
@AlexeyTsutsoev
AlexeyTsutsoev / cutOnMiddle.ts
Created March 16, 2023 08:15
Formatter for cut string in the middle
import { TCutOnMiddleArgs } from './types';
/**
* compare first and second number
* @param firstLength number of cut result
* @param secondLength number of base string
* @returns boolean
*/
const shouldBeCut = (firstLength: number = 0, secondLength: number) => {
return firstLength < secondLength;
@AlexeyTsutsoev
AlexeyTsutsoev / AnimatedPressable.tsx
Created March 16, 2023 08:13
Custom Pressable component
import React, { FC, useCallback } from 'react';
import {
GestureResponderEvent,
Pressable as PressableBase,
PressableProps,
StyleProp,
ViewStyle,
} from 'react-native';
import Animated, {
useSharedValue,
@AlexeyTsutsoev
AlexeyTsutsoev / AnimatedScaleImage.tsx
Created March 16, 2023 08:07
Animated Image Example
import React, { useCallback, useState, FC } from 'react';
import FastImage, { Source } from 'react-native-fast-image';
import Animated, {
Extrapolate,
interpolate,
SharedValue,
useAnimatedStyle,
} from 'react-native-reanimated';
import { styled } from '@shared/ui/theme';
@AlexeyTsutsoev
AlexeyTsutsoev / pull_request_template.md
Created March 16, 2023 07:58
Template for Pull Requests

Task: TASK_LINK

Description

  • First
iOS
@AlexeyTsutsoev
AlexeyTsutsoev / responsive.ts
Created March 16, 2023 07:54
Scale for React Native Example
import { Dimensions } from 'react-native';
const scale = Dimensions.get('window');
/**
* width by Dimensions
*/
export const DEVICE_WIDTH = scale.width;
/**