Skip to content

Commit bb6a690

Browse files
nissy-devfacebook-github-bot
authored andcommitted
remove createrReactClass from SizeFlexibilityUpdateTest (facebook#21715)
Summary: Related to facebook#21581 . Removed createReactClass from the IntegrationTests/SizeFlexibilityUpdateTest.js - [x] npm run prettier - [x] npm run flow-check-ios - [x] npm run flow-check-android [GENERAL] [ENHANCEMENT] [IntegrationTests/SizeFlexibilityUpdateTest.js] - remove createReactClass dependency Pull Request resolved: facebook#21715 Reviewed By: TheSavior Differential Revision: D10341543 Pulled By: RSNara fbshipit-source-id: 748f9a0176b6cd865d956df774f6dec1ead21562
1 parent 8985058 commit bb6a690

File tree

1 file changed

+22
-16
lines changed

1 file changed

+22
-16
lines changed

IntegrationTests/SizeFlexibilityUpdateTest.js

Lines changed: 22 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
'use strict';
1212

1313
const React = require('react');
14-
const createReactClass = require('create-react-class');
1514
const ReactNative = require('react-native');
1615
const RCTNativeAppEventEmitter = require('RCTNativeAppEventEmitter');
1716
const {View} = ReactNative;
@@ -24,29 +23,38 @@ const reactViewHeight = 222;
2423

2524
let finalState = false;
2625

27-
const SizeFlexibilityUpdateTest = createReactClass({
28-
displayName: 'SizeFlexibilityUpdateTest',
29-
_subscription: (null: ?EmitterSubscription),
26+
type Props = $ReadOnly<{|
27+
width: boolean,
28+
height: boolean,
29+
both: boolean,
30+
none: boolean,
31+
|}>;
3032

31-
UNSAFE_componentWillMount: function() {
33+
class SizeFlexibilityUpdateTest extends React.Component<Props> {
34+
_subscription: ?EmitterSubscription = null;
35+
36+
UNSAFE_componentWillMount() {
3237
this._subscription = RCTNativeAppEventEmitter.addListener(
3338
'rootViewDidChangeIntrinsicSize',
3439
this.rootViewDidChangeIntrinsicSize,
3540
);
36-
},
41+
}
3742

38-
componentWillUnmount: function() {
43+
componentWillUnmount() {
3944
if (this._subscription != null) {
4045
this._subscription.remove();
4146
}
42-
},
47+
}
4348

44-
markPassed: function() {
49+
markPassed = () => {
4550
TestModule.markTestPassed(true);
4651
finalState = true;
47-
},
52+
};
4853

49-
rootViewDidChangeIntrinsicSize: function(intrinsicSize) {
54+
rootViewDidChangeIntrinsicSize = (intrinsicSize: {
55+
width: number,
56+
height: number,
57+
}) => {
5058
if (finalState) {
5159
// If a test reaches its final state, it is not expected to do anything more
5260
TestModule.markTestPassed(false);
@@ -89,13 +97,11 @@ const SizeFlexibilityUpdateTest = createReactClass({
8997
return;
9098
}
9199
}
92-
},
100+
};
93101

94102
render() {
95103
return <View style={{height: reactViewHeight, width: reactViewWidth}} />;
96-
},
97-
});
98-
99-
SizeFlexibilityUpdateTest.displayName = 'SizeFlexibilityUpdateTest';
104+
}
105+
}
100106

101107
module.exports = SizeFlexibilityUpdateTest;

0 commit comments

Comments
 (0)