Skip to content

Instantly share code, notes, and snippets.

View likern's full-sized avatar
👨‍💻
Developing a new web service

Victor Malov likern

👨‍💻
Developing a new web service
  • @relladb
  • 05:13 (UTC +03:00)
View GitHub Profile
npm install --save-dev @fortawesome/fontawesome-pro
@likern
likern / custom-text-component.ts
Created December 18, 2019 19:18
Text component which treats lineHeight as multiplier
import React from "react"
import { Text as ReactNativeText, StyleProp, TextStyle } from 'react-native'
import { NoExtraProperties, hasDefinedProperty, isArray, isObject } from "../types";
interface TextProps {
style?: StyleProp<TextStyle>;
children: string;
}
/** In our application fontFamily is required */
@likern
likern / animation.tsx
Created March 21, 2020 09:30
Animation which never finishes
const { state, offsetY, translationY, velocityY } = useMemoOne(
() => ({
state: new Value(State.UNDETERMINED),
offsetY: new Value<number>(0),
translationY: new Value<number>(0),
velocityY: new Value<number>(0)
}),
[]
);
@likern
likern / animation.tsx
Created March 22, 2020 14:40
Animation not working
const animateTranslation = (
clock: Animated.Clock,
position: Animated.Value<number>,
translation: Animated.Value<number>,
velocity: Animated.Value<number>,
offset: Animated.Value<number>,
min: Animated.Value<number>,
max: Animated.Value<number>,
gestureState: Animated.Value<State>
) => {
import React, { useMemo } from 'react';
import {
TouchableWithoutFeedbackProps,
TouchableWithoutFeedback,
TextStyle
} from 'react-native';
import { ViewStyleProp } from '../../../types';
import Animated, {
useSharedValue,
import React, { useCallback, useState } from 'react';
import Animated, {
measure,
cancelAnimation,
useAnimatedRef,
useSharedValue,
useDerivedValue,
withTiming,
Easing,
useAnimatedStyle,
import React, { useCallback, useState } from 'react';
import Animated, {
measure,
cancelAnimation,
useAnimatedRef,
useSharedValue,
useDerivedValue,
withTiming,
Easing,
useAnimatedStyle,
import React, { useState, useCallback, useEffect } from 'react';
import { LayoutChangeEvent, Text } from 'react-native';
import Animated, {
useSharedValue,
useAnimatedRef,
runOnUI,
measure
} from 'react-native-reanimated';
function useAnimatedState<T>(initial: T) {
import React, { useState, useCallback, useEffect } from 'react';
import { LayoutChangeEvent, Text } from 'react-native';
import Animated, {
useSharedValue,
useAnimatedRef,
runOnUI,
measure
} from 'react-native-reanimated';
function useAnimatedState<T>(initial: T) {
import React, { useState, useCallback, useEffect } from 'react';
import { LayoutChangeEvent, Text } from 'react-native';
import Animated, {
useSharedValue,
useAnimatedRef,
runOnUI,
measure
} from 'react-native-reanimated';
function useAnimatedState<T>(initial: T) {