5
5
* This source code is licensed under the license found in the LICENSE file in
6
6
* the root directory of this source tree.
7
7
*/
8
- import * as Filters from 'lib/Filters' ;
9
- import { List , Map } from 'immutable' ;
10
- import PropTypes from 'lib/PropTypes' ;
11
- import React from 'react' ;
12
- import stringCompare from 'lib/stringCompare' ;
13
- import ParseApp from 'lib/ParseApp ' ;
8
+ import * as Filters from 'lib/Filters' ;
9
+ import { List , Map } from 'immutable' ;
10
+ import PropTypes from 'lib/PropTypes' ;
11
+ import React from 'react' ;
12
+ import stringCompare from 'lib/stringCompare' ;
13
+ import { CurrentApp } from 'context/currentApp ' ;
14
14
15
15
function changeField ( schema , filters , index , newField ) {
16
16
let newFilter = new Map ( {
@@ -44,7 +44,8 @@ function deleteRow(filters, index) {
44
44
return filters . delete ( index ) ;
45
45
}
46
46
47
- let Filter = ( { schema, filters, renderRow, onChange, blacklist, className } , context ) => {
47
+ let Filter = ( { schema, filters, renderRow, onChange, blacklist, className } ) => {
48
+ const currentApp = React . useContext ( CurrentApp ) ;
48
49
blacklist = blacklist || [ ] ;
49
50
let available = Filters . availableFilters ( schema , filters ) ;
50
51
return (
@@ -60,7 +61,7 @@ let Filter = ({ schema, filters, renderRow, onChange, blacklist, className }, co
60
61
}
61
62
62
63
// Get the column preference of the current class.
63
- const currentColumnPreference = context . currentApp . columnPreference [ className ] ;
64
+ const currentColumnPreference = currentApp . columnPreference [ className ] ;
64
65
65
66
// Check if the preference exists.
66
67
if ( currentColumnPreference ) {
@@ -137,7 +138,3 @@ Filter.propTypes = {
137
138
'A function for rendering a row of a filter.'
138
139
)
139
140
} ;
140
-
141
- Filter . contextTypes = {
142
- currentApp : PropTypes . instanceOf ( ParseApp )
143
- } ;
0 commit comments