File tree Expand file tree Collapse file tree 3 files changed +20
-0
lines changed
packages/material-ui/src/withMobileDialog Expand file tree Collapse file tree 3 files changed +20
-0
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ https://material-ui.dev/* https://material-ui.com/:splat 301!
22
22
/r/ts-issue-template https://www.typescriptlang.org/play/#code/JYWwDg9gTgLgBAKjgQwM5wEoFNkGN4BmUEIcA5FDvmQNwBQokscA3nXHAPSdwwAWWOLhKQAdllEx0ATwgBXOHNRYAJnQC+cIiXIABEMhhYowZABsAtHOCdhlMnToE5o-MAii4AESwgIACgBKVnYuHgBNeSghCBUsDSA 302
23
23
/r/custom-component-variants /customization/components/#adding-new-component-variants
24
24
/r/x-license https://material-ui.com/store/items/material-ui-x/
25
+ /r/migration-v4 https://next.material-ui.com/guides/migration-v4/
25
26
26
27
# Legacy redirection
27
28
# Added in chronological order
Original file line number Diff line number Diff line change @@ -2,12 +2,25 @@ import * as React from 'react';
2
2
import PropTypes from 'prop-types' ;
3
3
import withWidth , { isWidthDown } from '../withWidth' ;
4
4
5
+ let warnedOnce = false ;
6
+
5
7
/**
6
8
* Dialog will responsively be full screen *at or below* the given breakpoint
7
9
* (defaults to 'sm' for mobile devices).
8
10
* Notice that this Higher-order Component is incompatible with server-side rendering.
9
11
*/
10
12
const withMobileDialog = ( options = { } ) => ( Component ) => {
13
+ if ( process . env . NODE_ENV !== 'production' ) {
14
+ if ( ! warnedOnce ) {
15
+ console . warn (
16
+ [
17
+ 'Material-UI: The `withMobileDialog` function is deprecated.' ,
18
+ 'Head to https://material-ui.com/r/migration-v4/#dialog for a migration path.' ,
19
+ ] . join ( '\n' ) ,
20
+ ) ;
21
+ warnedOnce = true ;
22
+ }
23
+ }
11
24
const { breakpoint = 'sm' } = options ;
12
25
13
26
function WithMobileDialog ( props ) {
Original file line number Diff line number Diff line change @@ -3,6 +3,7 @@ import { expect } from 'chai';
3
3
import { createShallow } from '@material-ui/core/test-utils' ;
4
4
import Dialog from '../Dialog' ;
5
5
import withMobileDialog from './withMobileDialog' ;
6
+ import { consoleWarnMock } from 'test/utils/consoleErrorMock' ;
6
7
7
8
describe ( 'withMobileDialog' , ( ) => {
8
9
let shallow ;
@@ -12,6 +13,11 @@ describe('withMobileDialog', () => {
12
13
13
14
before ( ( ) => {
14
15
shallow = createShallow ( { dive : true } ) ;
16
+ consoleWarnMock . spy ( ) ;
17
+ } ) ;
18
+
19
+ after ( ( ) => {
20
+ consoleWarnMock . reset ( ) ;
15
21
} ) ;
16
22
17
23
function isFullScreen ( breakpoints , width ) {
You can’t perform that action at this time.
0 commit comments