diff --git a/.changeset/stupid-heads-refuse.md b/.changeset/stupid-heads-refuse.md new file mode 100644 index 000000000..a2f2bce2a --- /dev/null +++ b/.changeset/stupid-heads-refuse.md @@ -0,0 +1,5 @@ +--- +"@stackflow/plugin-basic-ui": patch +--- + +Fix scroll behavior of AppScreen by attaching refs on paperContent diff --git a/extensions/plugin-basic-ui/src/components/AppScreen.tsx b/extensions/plugin-basic-ui/src/components/AppScreen.tsx index 507d77d96..f7016943a 100644 --- a/extensions/plugin-basic-ui/src/components/AppScreen.tsx +++ b/extensions/plugin-basic-ui/src/components/AppScreen.tsx @@ -75,6 +75,7 @@ const AppScreen: React.FC = ({ const paperRef = useRef(null); const edgeRef = useRef(null); const appBarRef = useRef(null); + const paperContentRef = useRef(null); const modalPresentationStyle = globalOptions.theme === "cupertino" @@ -201,7 +202,7 @@ const AppScreen: React.FC = ({ appBar?.onTopClick?.(e); if (!e.defaultPrevented) { - paperRef.current?.scroll({ + paperContentRef.current?.scroll({ top: 0, behavior: "smooth", }); @@ -217,7 +218,7 @@ const AppScreen: React.FC = ({ value={useMemo( () => ({ scroll({ top }) { - paperRef?.current?.scroll({ + paperContentRef?.current?.scroll({ top, behavior: "smooth", }); @@ -229,7 +230,7 @@ const AppScreen: React.FC = ({ appBar: zIndexAppBar, }, }), - [paperRef, zIndexDim, zIndexPaper, zIndexEdge, zIndexAppBar], + [paperContentRef, zIndexDim, zIndexPaper, zIndexEdge, zIndexAppBar], )} >
= ({ data-part="paper" {...activityDataAttributes} > -
{children}
+
+ {children} +
{!activity?.isRoot && globalOptions.theme === "cupertino" &&