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
  • 00:50 (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 / react-native-reanimated-example.tsx
Last active August 13, 2023 02:25
React Native Opacity Animation Example
import React, { useState } from 'react';
import { useMemoOne } from 'use-memo-one';
import { View, Button } from 'react-native';
import Animated, {
cond,
not,
clockRunning,
startClock,
interpolate,
Extrapolate,
@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>
) => {
@likern
likern / Crash
Created July 19, 2020 16:06
Reanimated v2 alpha 4 crash
*** *** *** *** *** *** *** *** *** *** *** *** *** *** *** ***
Build fingerprint: 'Xiaomi/raphael_eea/raphael:10/QKQ1.190825.002/V12.0.1.0.QFKEUXM:user/release-keys'
Revision: '0'
ABI: 'arm64'
Timestamp: 2020-07-19 19:05:18+0300
pid: 24023, tid: 24023, name: m.breeffy.feeve >>> com.breeffy.feeve <<<
uid: 10331
signal 6 (SIGABRT), code -1 (SI_QUEUE), fault addr --------
x0 0000000000000000 x1 0000000000005dd7 x2 0000000000000006 x3 0000007febfaa1d0
x4 fefeff00fbf49b0a x5 fefeff00fbf49b0a x6 fefeff00fbf49b0a x7 7f7f7f7fffffff7f
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) {