mirror of
https://github.com/tooot-app/app
synced 2025-04-24 07:07:24 +02:00
Remove button animation
Not great
This commit is contained in:
parent
c79caa6dc7
commit
196fb05dea
@ -1,15 +1,8 @@
|
|||||||
import Icon from '@components/Icon'
|
import Icon from '@components/Icon'
|
||||||
import { StyleConstants } from '@utils/styles/constants'
|
import { StyleConstants } from '@utils/styles/constants'
|
||||||
import layoutAnimation from '@utils/styles/layoutAnimation'
|
|
||||||
import { useTheme } from '@utils/styles/ThemeManager'
|
import { useTheme } from '@utils/styles/ThemeManager'
|
||||||
import React, { useEffect, useMemo, useRef, useState } from 'react'
|
import React, { useMemo, useState } from 'react'
|
||||||
import {
|
import { AccessibilityProps, Pressable, StyleProp, View, ViewStyle } from 'react-native'
|
||||||
AccessibilityProps,
|
|
||||||
Pressable,
|
|
||||||
StyleProp,
|
|
||||||
View,
|
|
||||||
ViewStyle
|
|
||||||
} from 'react-native'
|
|
||||||
import { Flow } from 'react-native-animated-spinkit'
|
import { Flow } from 'react-native-animated-spinkit'
|
||||||
import CustomText from './Text'
|
import CustomText from './Text'
|
||||||
|
|
||||||
@ -57,15 +50,6 @@ const Button: React.FC<Props> = ({
|
|||||||
}) => {
|
}) => {
|
||||||
const { colors, theme } = useTheme()
|
const { colors, theme } = useTheme()
|
||||||
|
|
||||||
const mounted = useRef(false)
|
|
||||||
useEffect(() => {
|
|
||||||
if (mounted.current) {
|
|
||||||
layoutAnimation()
|
|
||||||
} else {
|
|
||||||
mounted.current = true
|
|
||||||
}
|
|
||||||
}, [content, loading, disabled])
|
|
||||||
|
|
||||||
const loadingSpinkit = useMemo(
|
const loadingSpinkit = useMemo(
|
||||||
() => (
|
() => (
|
||||||
<View style={{ position: 'absolute' }}>
|
<View style={{ position: 'absolute' }}>
|
||||||
@ -120,8 +104,7 @@ const Button: React.FC<Props> = ({
|
|||||||
<CustomText
|
<CustomText
|
||||||
style={{
|
style={{
|
||||||
color: mainColor,
|
color: mainColor,
|
||||||
fontSize:
|
fontSize: StyleConstants.Font.Size[size] * (size === 'L' ? 1.25 : 1),
|
||||||
StyleConstants.Font.Size[size] * (size === 'L' ? 1.25 : 1),
|
|
||||||
opacity: loading ? 0 : 1
|
opacity: loading ? 0 : 1
|
||||||
}}
|
}}
|
||||||
fontWeight={fontBold ? 'Bold' : 'Normal'}
|
fontWeight={fontBold ? 'Bold' : 'Normal'}
|
||||||
@ -156,15 +139,13 @@ const Button: React.FC<Props> = ({
|
|||||||
borderColor: mainColor,
|
borderColor: mainColor,
|
||||||
backgroundColor: colorBackground,
|
backgroundColor: colorBackground,
|
||||||
paddingVertical: StyleConstants.Spacing[spacing],
|
paddingVertical: StyleConstants.Spacing[spacing],
|
||||||
paddingHorizontal:
|
paddingHorizontal: StyleConstants.Spacing[spacing] + StyleConstants.Spacing.XS,
|
||||||
StyleConstants.Spacing[spacing] + StyleConstants.Spacing.XS,
|
|
||||||
width: round && layoutHeight ? layoutHeight : undefined
|
width: round && layoutHeight ? layoutHeight : undefined
|
||||||
},
|
},
|
||||||
customStyle
|
customStyle
|
||||||
]}
|
]}
|
||||||
{...(round && {
|
{...(round && {
|
||||||
onLayout: ({ nativeEvent }) =>
|
onLayout: ({ nativeEvent }) => setLayoutHeight(nativeEvent.layout.height)
|
||||||
setLayoutHeight(nativeEvent.layout.height)
|
|
||||||
})}
|
})}
|
||||||
testID='base'
|
testID='base'
|
||||||
onPress={onPress}
|
onPress={onPress}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user