ヘッダーをタップすることによる Scroll to Top に対応しました#81
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
resolve #78
概要
ヘッダーのタイトル部分をタップすると、タイムラインが一番上にスムーズスクロールで戻る機能を追加しました。app版・web版の両方に対応しています。
変更内容
Header コンポーネント
onTitleTapプロパティを追加onClickハンドラを設定onTitleTapが渡されている場合のみcursor: pointerを適用対応画面
useImperativeHandle経由)scrollTo)変更ファイル(10ファイル)
app/src/ui/Header.tsxweb/src/ui/Header.tsxapp/src/views/Home.tsxweb/src/views/Home.tsxapp/src/views/Timeline.tsxweb/src/views/Timeline.tsxapp/src/views/Notifications.tsxweb/src/views/Notifications.tsxapp/src/views/Explorer.tsxweb/src/views/Explorer.tsx設計メモ
RealtimeTimeline/NotificationTimelineは既にuseImperativeHandleでscrollToTop()を公開しているため、各ビューからはrefを渡して呼ぶだけで済んでいますHomeViewはMainViewからのタブ再タップ→scrollToTopにも対応しており、ローカルrefを作成した上でuseImperativeHandleでprops.refへ転送することで既存の動作を維持していますExplorerはタイムラインコンポーネントではなくoverflowY: autoの div なので、直接scrollToを呼んでいます対象外
AcknowledgeListが内部でスクロールコンテナを管理しており、外からrefを取れない構造のためHeaderコンポーネントを使わずCCWallpaperが独自ヘッダーとなっているためこれらは必要に応じて別 Issue です。