Skip to content
Merged
Changes from 1 commit
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
Next Next commit
Remove overflow styles from the navigation screen component
  • Loading branch information
youknowriad committed Oct 14, 2022
commit 4012d0874ddec67b10d14fc9441d74bb71b7d74a
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,12 @@
import type { ForwardedRef } from 'react';
// eslint-disable-next-line no-restricted-imports
import { motion, MotionProps } from 'framer-motion';
import { css } from '@emotion/react';

/**
* WordPress dependencies
*/
import { focus } from '@wordpress/dom';
import { useContext, useEffect, useMemo, useRef } from '@wordpress/element';
import { useContext, useEffect, useRef } from '@wordpress/element';
import {
useReducedMotion,
useMergeRefs,
Expand All @@ -27,7 +26,6 @@ import {
useContextSystem,
WordPressComponentProps,
} from '../../ui/context';
import { useCx } from '../../utils/hooks/use-cx';
import { View } from '../../view';
import { NavigatorContext } from '../context';
import type { NavigatorScreenProps } from '../types';
Expand Down Expand Up @@ -57,21 +55,6 @@ function NavigatorScreen( props: Props, forwardedRef: ForwardedRef< any > ) {

const previousLocation = usePrevious( location );

const cx = useCx();
const classes = useMemo(
() =>
cx(
css( {
// Ensures horizontal overflow is visually accessible.
overflowX: 'auto',
// In case the root has a height, it should not be exceeded.
maxHeight: '100%',
} ),
className
),
[ className, cx ]
);

// Focus restoration
const isInitialLocation = location.isInitial && ! location.isBack;
useEffect( () => {
Expand Down Expand Up @@ -128,7 +111,7 @@ function NavigatorScreen( props: Props, forwardedRef: ForwardedRef< any > ) {
return (
<View
ref={ mergedWrapperRef }
className={ classes }
className={ className }
{ ...otherProps }
>
{ children }
Expand Down Expand Up @@ -174,7 +157,7 @@ function NavigatorScreen( props: Props, forwardedRef: ForwardedRef< any > ) {
return (
<motion.div
ref={ mergedWrapperRef }
className={ classes }
className={ className }
{ ...otherProps }
{ ...animatedProps }
>
Expand Down