remove createrReactClass from SizeFlexibilityUpdateTest (#21715)
Summary: Related to #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: https://github.com/facebook/react-native/pull/21715 Reviewed By: TheSavior Differential Revision: D10341543 Pulled By: RSNara fbshipit-source-id: 748f9a0176b6cd865d956df774f6dec1ead21562
This commit is contained in:
parent
89850583f4
commit
bb6a69075b
|
@ -11,7 +11,6 @@
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
const React = require('react');
|
const React = require('react');
|
||||||
const createReactClass = require('create-react-class');
|
|
||||||
const ReactNative = require('react-native');
|
const ReactNative = require('react-native');
|
||||||
const RCTNativeAppEventEmitter = require('RCTNativeAppEventEmitter');
|
const RCTNativeAppEventEmitter = require('RCTNativeAppEventEmitter');
|
||||||
const {View} = ReactNative;
|
const {View} = ReactNative;
|
||||||
|
@ -24,29 +23,38 @@ const reactViewHeight = 222;
|
||||||
|
|
||||||
let finalState = false;
|
let finalState = false;
|
||||||
|
|
||||||
const SizeFlexibilityUpdateTest = createReactClass({
|
type Props = $ReadOnly<{|
|
||||||
displayName: 'SizeFlexibilityUpdateTest',
|
width: boolean,
|
||||||
_subscription: (null: ?EmitterSubscription),
|
height: boolean,
|
||||||
|
both: boolean,
|
||||||
|
none: boolean,
|
||||||
|
|}>;
|
||||||
|
|
||||||
UNSAFE_componentWillMount: function() {
|
class SizeFlexibilityUpdateTest extends React.Component<Props> {
|
||||||
|
_subscription: ?EmitterSubscription = null;
|
||||||
|
|
||||||
|
UNSAFE_componentWillMount() {
|
||||||
this._subscription = RCTNativeAppEventEmitter.addListener(
|
this._subscription = RCTNativeAppEventEmitter.addListener(
|
||||||
'rootViewDidChangeIntrinsicSize',
|
'rootViewDidChangeIntrinsicSize',
|
||||||
this.rootViewDidChangeIntrinsicSize,
|
this.rootViewDidChangeIntrinsicSize,
|
||||||
);
|
);
|
||||||
},
|
}
|
||||||
|
|
||||||
componentWillUnmount: function() {
|
componentWillUnmount() {
|
||||||
if (this._subscription != null) {
|
if (this._subscription != null) {
|
||||||
this._subscription.remove();
|
this._subscription.remove();
|
||||||
}
|
}
|
||||||
},
|
}
|
||||||
|
|
||||||
markPassed: function() {
|
markPassed = () => {
|
||||||
TestModule.markTestPassed(true);
|
TestModule.markTestPassed(true);
|
||||||
finalState = true;
|
finalState = true;
|
||||||
},
|
};
|
||||||
|
|
||||||
rootViewDidChangeIntrinsicSize: function(intrinsicSize) {
|
rootViewDidChangeIntrinsicSize = (intrinsicSize: {
|
||||||
|
width: number,
|
||||||
|
height: number,
|
||||||
|
}) => {
|
||||||
if (finalState) {
|
if (finalState) {
|
||||||
// If a test reaches its final state, it is not expected to do anything more
|
// If a test reaches its final state, it is not expected to do anything more
|
||||||
TestModule.markTestPassed(false);
|
TestModule.markTestPassed(false);
|
||||||
|
@ -89,13 +97,11 @@ const SizeFlexibilityUpdateTest = createReactClass({
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
};
|
||||||
|
|
||||||
render() {
|
render() {
|
||||||
return <View style={{height: reactViewHeight, width: reactViewWidth}} />;
|
return <View style={{height: reactViewHeight, width: reactViewWidth}} />;
|
||||||
},
|
}
|
||||||
});
|
}
|
||||||
|
|
||||||
SizeFlexibilityUpdateTest.displayName = 'SizeFlexibilityUpdateTest';
|
|
||||||
|
|
||||||
module.exports = SizeFlexibilityUpdateTest;
|
module.exports = SizeFlexibilityUpdateTest;
|
||||||
|
|
Loading…
Reference in New Issue