Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/stupid-heads-refuse.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@stackflow/plugin-basic-ui": patch
---

Fix scroll behavior of AppScreen by attaching refs on paperContent
14 changes: 10 additions & 4 deletions extensions/plugin-basic-ui/src/components/AppScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ const AppScreen: React.FC<AppScreenProps> = ({
const paperRef = useRef<HTMLDivElement>(null);
const edgeRef = useRef<HTMLDivElement>(null);
const appBarRef = useRef<HTMLDivElement>(null);
const paperContentRef = useRef<HTMLDivElement>(null);

const modalPresentationStyle =
globalOptions.theme === "cupertino"
Expand Down Expand Up @@ -201,7 +202,7 @@ const AppScreen: React.FC<AppScreenProps> = ({
appBar?.onTopClick?.(e);

if (!e.defaultPrevented) {
paperRef.current?.scroll({
paperContentRef.current?.scroll({
top: 0,
behavior: "smooth",
});
Expand All @@ -217,7 +218,7 @@ const AppScreen: React.FC<AppScreenProps> = ({
value={useMemo(
() => ({
scroll({ top }) {
paperRef?.current?.scroll({
paperContentRef?.current?.scroll({
top,
behavior: "smooth",
});
Expand All @@ -229,7 +230,7 @@ const AppScreen: React.FC<AppScreenProps> = ({
appBar: zIndexAppBar,
},
}),
[paperRef, zIndexDim, zIndexPaper, zIndexEdge, zIndexAppBar],
[paperContentRef, zIndexDim, zIndexPaper, zIndexEdge, zIndexAppBar],
)}
>
<div
Expand Down Expand Up @@ -294,7 +295,12 @@ const AppScreen: React.FC<AppScreenProps> = ({
data-part="paper"
{...activityDataAttributes}
>
<div className={css.paperContent({ hasAppBar })}>{children}</div>
<div
ref={paperContentRef}
className={css.paperContent({ hasAppBar })}
>
{children}
</div>
</div>
{!activity?.isRoot &&
globalOptions.theme === "cupertino" &&
Expand Down