import { useSafeAreaInsets } from 'react-native-safe-area-context';
import { useThrottledPressHandler } from '../../internal/utils/useThrottledPressHandler';
import { TouchableHighlight, View } from 'react-native';
import { getBottomFixedButtonHeight } from './utils';
import { Gradient, SemanticColor, TypoIncludingEmoji } from '../../foundation';
import { isAndroid } from '../../internal/utils/functions';
import React from 'react';
import { OneButtonProp } from './BottomFixedButton';
import { Button } from '../button/Button';
import Animated, { Easing, FadeIn, FadeOut, LinearTransition } from 'react-native-reanimated';
import { Spin } from '../spin/Spin';
/**
* BottomFixedButton 구성요소
*/
export function OneButtonFullType(props: OneButtonProp) {
const { bottom } = useSafeAreaInsets();
return ;
}
/**
* BottomFixedButton 구성요소
* - full, solid 타입을 사용할 때, TextInput 입력을 위해 키보드가 올라오면 이 타입의 버튼이 키보드 상단에 렌더됩니다.
*/
export function KeyboardType(props: OneButtonProp) {
return ;
}
// 로딩중 버튼 텍스트의 이동 애니메이션
// (참고) Button 컴포넌트 내부 구현과 동일한 애니메이션 스펙임
const TextLinerTransition = LinearTransition.duration(300).easing(Easing.out(Easing.ease));
/**
* BottomFixedButton > 버튼 한개짜리 타입의 베이스 컴포넌트
*/
function OneButtonFullBase(
props: Omit & { type: 'full' | 'solid' | 'keyboard' } & {
safeAreaBottom?: number;
typography: 'button_16_semibold' | 'button_18_semibold';
},
) {
const throttledPressHandler = useThrottledPressHandler(props.onPress, props.throttle);
const bottom = props.safeAreaBottom ?? 0;
const ellipsizeMode = (() => {
// 로딩 표현 중일 땐 말줄임 하는게 디자인 요구사항
if (props.loading) return 'tail';
// HACK: 원래 요구사항은 플랫폼 분기 없이 'clip' 적용하여 말줄임 없이 자르는 것이었으나 안드로이드는 'tail' 처리함
// - 안드로이드는 단어 단위로 끝을 자름. 말줄임 없이 자르면 길어서 잘린건지 텍스트가 원래 짧은건지 구분이 안 됨.
return isAndroid() ? 'tail' : 'clip';
})();
return (
{props.loading ? (
// (참고) Button 컴포넌트 내부 구현과 동일한 애니메이션 스펙임
) : null}
라벨 변경시, 레이아웃이 변경되면서 불필요한 애니메이션 발생하는 문제 해소
key={props.label}
layout={TextLinerTransition}
style={{ flexShrink: 1 }}>
{props.label}
);
}
/**
* BottomFixedButton 구성요소
*/
export function OneButtonSolidType(props: OneButtonProp) {
const { bottom } = useSafeAreaInsets();
const throttledPressHandler = useThrottledPressHandler(props.onPress, props.throttle);
return (
);
}