React

App Screen

Stackflow 네비게이션에서 개별 화면을 구성하는 컴포넌트입니다. 모바일 앱과 같은 화면 전환 경험을 제공할 때 사용됩니다.

Loading...

Installation

npx @seed-design/cli@latest add ui:app-screen

Usage

import {
  AppBar,
  AppBarBackButton,
  AppBarCloseButton,
  AppBarIconButton,
  AppBarLeft,
  AppBarMain,
  AppBarRight,
} from "seed-design/ui/app-bar";
import { AppScreen, AppScreenContent } from "seed-design/ui/app-screen";
<AppScreen theme="cupertino">
  <AppBar>
    <AppBarLeft>
      <AppBarBackButton />
    </AppBarLeft>
    <AppBarMain>Title</AppBarMain>
    <AppBarRight>{/* actions */}</AppBarRight>
  </AppBar>
  <AppScreenContent>{/* content */}</AppScreenContent>
</AppScreen>

Props

App Screen

AppScreen

Prop

Type

preventSwipeBack?boolean | undefined
onSwipeBackStart?(() => void) | undefined
onSwipeBackMove?((props: { displacement: number; displacementRatio: number; }) => void) | undefined
onSwipeBackEnd?((props: { swiped: boolean; }) => void) | undefined

AppScreenContent

Prop

Type

ptr?boolean | undefined
onPtrReady?(() => void) | undefined
onPtrRefresh?(() => Promise<void>) | undefined

App Bar

AppBar

Prop

Type

background?(string & {}) | ScopedColorBg | ScopedColorPalette | ScopedColorBanner | undefined

AppBarLeft

Prop

Type

AppBarMain

Prop

Type

AppBarRight

Prop

Type

AppBarIconButton, AppBarBackButton, AppBarCloseButton

Prop

Type

Examples

Tones

AppScreen의 tone 속성을 transparent로 설정하여 투명한 배경을 사용할 수 있습니다.

  • AppBar의 배경이 투명해집니다.
  • 모바일 OS 상태바를 포함한 AppScreen 상단에 그라디언트가 표시됩니다.
    • gradient 속성을 false로 설정하여 숨길 수 있습니다.
Loading...

With Intersection Observer

Intersection Observer를 사용해 AppBartone 속성을 동적으로 변경할 수 있습니다.

Loading...

Layer Offset Top

layerOffsetTop 속성을 사용해 AppScreenContent의 상단 오프셋을 조정할 수 있습니다.

tone="transparent"gradient를 사용하는 경우, 일반적으로 layerOffsetTop="none"을 함께 설정하여 모바일 OS 상태바 영역까지 콘텐츠 영역을 확장합니다.

디스플레이 컷아웃 (notch) 등 safe area를 올바르게 처리하기 위해 viewport-fit=cover가 포함된 viewport 메타 태그를 사용하세요.

<meta
  name="viewport"
  content="width=device-width, initial-scale=1, viewport-fit=cover"
/>

layerOffsetTop을 none으로 설정한 스크린샷

layerOffsetTop을 safeArea으로 설정한 스크린샷

layerOffsetTop을 appBar로 설정한 스크린샷

Customizing App Bar

tone="layer"인 경우 AppBar의 색상을 변경할 수 있습니다.

AppBarIconButton 내에 Icon 컴포넌트를 사용하여 아이콘을 커스터마이징할 수 있습니다.

Icon

아이콘 컴포넌트에 대해 자세히 알아봅니다.

Loading...

Custom Elements in App Bar

AppBar 내에 AppBarLeft, AppBarMain, AppBarRight에 대응되지 않는 커스텀 요소를 배치하는 경우, 다른 요소와 동일한 화면 전환 트랜지션을 적용하기 위해 AppBarSlot 컴포넌트를 사용합니다.

AppBarSlot은 하위 요소에 class를 주입하여 트랜지션을 적용하며, 추가 마크업은 생성하지 않습니다.

Loading...

Preventing Swipe Back

preventSwipeBack 속성을 사용해 theme="cupertino"인 AppScreen에서 edge 영역을 렌더링하지 않음으로써 스와이프 백 제스처를 방지할 수 있습니다.

Transition Styles

transitionStyle 속성을 사용해 AppScreen이 최상위로 push되거나 최상위에서 pop될 때 재생할 트랜지션을 지정할 수 있습니다.

최상위: useActivity().isTop === true인 액티비티로 만들어진 AppScreen을 의미합니다.

별도로 지정하지 않는 경우, transitionStyletheme에 따른 기본값을 갖습니다.

  • theme="cupertino": slideFromRightIOS
  • theme="android": fadeFromBottomAndroid

최상위 AppScreen이 push/pop될 때, 최상위가 아닌 AppScreen도 함께 트랜지션을 재생합니다.

최상위가 아닌 AppScreen의 트랜지션 스타일

@seed-design/[email protected]까지

최상위 AppScreen이 push/pop될 때, 최상위가 아닌 AppScreen은 각 AppScreen의 고유한 transitionStyle을 재생합니다.

  • 예를 들면, transitionStyle="fadeFromBottomAndroid"인 0번 AppScreen 위에 transitionStyle="slideFromLeftIOS"인 1번 AppScreen이 push되는 경우, 0번 AppScreen은 fadeFromBottomAndroid 트랜지션을 재생합니다.
    • 0번 AppScreen이 위치 변화 없이 그대로 유지된 상태에서(fadeFromBottomAndroid) 1번 AppScreen이 우측에서 슬라이드 인(slideFromLeftIOS)

이후 버전

최상위 AppScreen이 push/pop될 때, 최상위가 아닌 AppScreen은 최상위 AppScreen의 transitionStyle을 재생합니다.

  • 같은 스택 내에 여러 transitionStyle이 공존할 때 자연스러운 트랜지션을 제공합니다.
  • 예를 들면, transitionStyle="fadeFromBottomAndroid"인 0번 AppScreen 위에 transitionStyle="slideFromLeftIOS"인 1번 AppScreen이 push되는 경우, 0번 AppScreen은 slideFromLeftIOS 트랜지션을 재생합니다.
    • 0번 AppScreen이 자연스럽게 좌측으로 조금 밀려나며 어두워지고(slideFromLeftIOS) 1번 AppScreen이 우측에서 슬라이드 인(slideFromLeftIOS)
Loading...

Last updated on

On this page