Stop using deprecated lifecycle methods

Summary:
Some lifecycle methods are deprecated now. Where they can be replaced easily I replaced them. Where they can't be updated easily I marked them as unsafe, as if a bigger refactoring is required for those components, we'd better convert them to function components instead.

Didn't update the plugins as they are ideally updated by their owners.

Didn't update styled components, there is a separate task for that.

Reviewed By: jknoxville

Differential Revision: D18780579

fbshipit-source-id: 132a3789875ab6a3caee582b0e5f7feb7dc4a4c1
This commit is contained in:
Michel Weststrate
2019-12-03 06:48:36 -08:00
committed by Facebook Github Bot
parent 01deb97a5d
commit c332f4145a
12 changed files with 22 additions and 28 deletions

View File

@@ -65,8 +65,9 @@ class LocationsButton extends Component<Props, State> {
retreivingBookmarks: false,
};
componentWillMount() {
componentDidMount() {
document.addEventListener('keydown', this.keyDown);
this.updateBookmarks();
}
componentWillUnmount() {
@@ -101,10 +102,6 @@ class LocationsButton extends Component<Props, State> {
});
};
componentDidMount() {
this.updateBookmarks();
}
render() {
const {currentURI} = this.props;
const {bookmarks} = this.state;

View File

@@ -68,7 +68,7 @@ class ScreenCaptureButtons extends Component<Props, State> {
this.checkIfRecordingIsAvailable();
}
componentWillReceiveProps(nextProps: Props) {
UNSAFE_componentWillReceiveProps(nextProps: Props) {
if (nextProps.selectedDevice !== this.props.selectedDevice) {
this.checkIfRecordingIsAvailable(nextProps);
}