55 * LICENSE file in the root directory of this source tree.
66 *
77 * @format
8+ * @flow
89 */
910
1011'use strict' ;
@@ -13,10 +14,10 @@ const React = require('react');
1314const createReactClass = require ( 'create-react-class' ) ;
1415const ReactNative = require ( 'react-native' ) ;
1516const RCTNativeAppEventEmitter = require ( 'RCTNativeAppEventEmitter' ) ;
16- const Subscribable = require ( 'Subscribable' ) ;
1717const { View} = ReactNative ;
1818
1919const { TestModule} = ReactNative . NativeModules ;
20+ import type EmitterSubscription from 'EmitterSubscription' ;
2021
2122const reactViewWidth = 111 ;
2223const reactViewHeight = 222 ;
@@ -25,16 +26,21 @@ let finalState = false;
2526
2627const SizeFlexibilityUpdateTest = createReactClass ( {
2728 displayName : 'SizeFlexibilityUpdateTest' ,
28- mixins : [ Subscribable . Mixin ] ,
29+ _subscription : ( null : ? EmitterSubscription ) ,
2930
3031 UNSAFE_componentWillMount : function ( ) {
31- this . addListenerOn (
32- RCTNativeAppEventEmitter ,
32+ this . _subscription = RCTNativeAppEventEmitter . addListener (
3333 'rootViewDidChangeIntrinsicSize' ,
3434 this . rootViewDidChangeIntrinsicSize ,
3535 ) ;
3636 } ,
3737
38+ componentWillUnmount : function ( ) {
39+ if ( this . _subscription != null ) {
40+ this . _subscription . remove ( ) ;
41+ }
42+ } ,
43+
3844 markPassed : function ( ) {
3945 TestModule . markTestPassed ( true ) ;
4046 finalState = true ;
0 commit comments