File tree Expand file tree Collapse file tree 1 file changed +16
-4
lines changed
source/views/components/filter Expand file tree Collapse file tree 1 file changed +16
-4
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,10 @@ type Props = {
2020 + onDismiss : ( filters : Array < FilterType > ) => mixed ,
2121 | } ,
2222 } ,
23+ addListener : (
24+ ev : string ,
25+ ( payload : mixed ) => mixed ,
26+ ) = > { remove : ( ) => void } ,
2327 } ,
2428}
2529
@@ -33,6 +37,8 @@ export class FilterView extends React.Component<Props, State> {
3337 return { title}
3438 }
3539
40+ _subscription : ?{ remove : ( ) => void } = null
41+
3642 state = {
3743 filters : [ ] ,
3844 }
@@ -42,11 +48,17 @@ export class FilterView extends React.Component<Props, State> {
4248 return { filters }
4349 }
4450
51+ componentDidMount ( ) {
52+ this . _subscription = this . props . navigation . addListener ( 'willBlur' , ( ) => {
53+ let { onDismiss} = this . props . navigation . state . params
54+ if ( onDismiss ) {
55+ onDismiss ( this . state . filters )
56+ }
57+ } )
58+ }
59+
4560 componentWillUnmount ( ) {
46- let { onDismiss } = this . props . navigation . state . params
47- if ( onDismiss ) {
48- onDismiss ( this . state . filters )
49- }
61+ this . _subscription && this . _subscription . remove ( )
5062 }
5163
5264 onFilterChanged = ( filter : FilterType ) => {
You can’t perform that action at this time.
0 commit comments