Permalink
Browse files

Ran rename-unsafe-lifecycles codemod on xplat/js

Reviewed By: trueadm

Differential Revision: D6889214

fbshipit-source-id: e815cda4b09f3650ae3b0b9a44ae6f5fcb48fe25
  • Loading branch information...
bvaughn authored and facebook-github-bot committed Feb 8, 2018
1 parent fa334ce commit 6f007e8957c9bf5652b0184cba65f385050a8236
Showing with 75 additions and 66 deletions.
  1. +1 −1 IntegrationTests/ReactContentSizeUpdateTest.js
  2. +1 −1 IntegrationTests/SizeFlexibilityUpdateTest.js
  3. +3 −3 Libraries/Animated/src/__tests__/Animated-test.js
  4. +1 −1 Libraries/Animated/src/__tests__/AnimatedNative-test.js
  5. +2 −2 Libraries/Animated/src/createAnimatedComponent.js
  6. +2 −2 Libraries/Components/Keyboard/KeyboardAvoidingView.js
  7. +1 −1 Libraries/Components/LazyRenderer.js
  8. +1 −1 Libraries/Components/Navigation/NavigatorIOS.ios.js
  9. +1 −1 Libraries/Components/Picker/PickerAndroid.android.js
  10. +1 −1 Libraries/Components/Picker/PickerIOS.ios.js
  11. +1 −1 Libraries/Components/ScrollResponder.js
  12. +1 −1 Libraries/Components/ScrollView/ScrollView.js
  13. +1 −1 Libraries/Components/Subscribable.js
  14. +2 −2 Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js
  15. +1 −1 Libraries/Components/Touchable/TouchableHighlight.js
  16. +1 −1 Libraries/Components/Touchable/TouchableNativeFeedback.android.js
  17. +1 −1 Libraries/Components/Touchable/TouchableOpacity.js
  18. +1 −1 Libraries/Components/Touchable/TouchableWithoutFeedback.js
  19. +1 −1 Libraries/Components/WebView/WebView.android.js
  20. +1 −1 Libraries/Components/WebView/WebView.ios.js
  21. +1 −1 Libraries/Experimental/Incremental.js
  22. +1 −1 Libraries/Experimental/IncrementalGroup.js
  23. +1 −1 Libraries/Experimental/SwipeableRow/SwipeableListView.js
  24. +2 −2 Libraries/Experimental/SwipeableRow/SwipeableRow.js
  25. +3 −3 Libraries/Experimental/WindowedListView.js
  26. +1 −1 Libraries/Inspector/Inspector.js
  27. +2 −2 Libraries/Lists/FlatList.js
  28. +2 −2 Libraries/Lists/ListView/ListView.js
  29. +1 −1 Libraries/Lists/MetroListView.js
  30. +1 −1 Libraries/Lists/VirtualizedList.js
  31. +2 −2 Libraries/Lists/VirtualizedSectionList.js
  32. +1 −1 Libraries/Modal/Modal.js
  33. +1 −1 RNTester/js/AnimatedGratuitousApp/AnExSet.js
  34. +1 −1 RNTester/js/AnimatedGratuitousApp/AnExTilt.js
  35. +1 −1 RNTester/js/CameraRollView.js
  36. +1 −1 RNTester/js/ImageExample.js
  37. +1 −1 RNTester/js/LayoutAnimationExample.js
  38. +1 −1 RNTester/js/ListViewExample.js
  39. +1 −1 RNTester/js/ListViewGridLayoutExample.js
  40. +1 −1 RNTester/js/ListViewPagingExample.js
  41. +1 −1 RNTester/js/PanResponderExample.js
  42. +1 −1 RNTester/js/PushNotificationIOSExample.js
  43. +1 −1 RNTester/js/RNTesterApp.android.js
  44. +1 −1 RNTester/js/RNTesterApp.ios.js
  45. +1 −1 RNTester/js/RNTesterSettingSwitchRow.js
  46. +1 −1 RNTester/js/SwipeableListViewExample.js
  47. +1 −1 RNTester/js/TextInputExample.android.js
  48. +1 −1 RNTester/js/TextInputExample.ios.js
  49. +1 −1 ReactAndroid/src/androidTest/js/JSResponderTestApp.js
  50. +1 −1 ReactAndroid/src/androidTest/js/PickerAndroidTestModule.js
  51. +1 −1 ReactAndroid/src/androidTest/js/SubviewsClippingTestModule.js
  52. +10 −1 local-cli/templates/HelloNavigation/components/KeyboardSpacer.js
  53. +3 −3 package.json
@@ -30,7 +30,7 @@ var ReactContentSizeUpdateTest = createReactClass({
mixins: [Subscribable.Mixin,
TimerMixin],
componentWillMount: function() {
UNSAFE_componentWillMount: function() {
this.addListenerOn(
RCTNativeAppEventEmitter,
'rootViewDidChangeIntrinsicSize',
@@ -27,7 +27,7 @@ var SizeFlexibilityUpdateTest = createReactClass({
displayName: 'SizeFlexibilityUpdateTest',
mixins: [Subscribable.Mixin],
componentWillMount: function() {
UNSAFE_componentWillMount: function() {
this.addListenerOn(
RCTNativeAppEventEmitter,
'rootViewDidChangeIntrinsicSize',
@@ -94,11 +94,11 @@ describe('Animated tests', () => {
opacity: anim,
},
};
c.componentWillMount();
c.UNSAFE_componentWillMount();
expect(anim.__detach).not.toBeCalled();
c._component = {};
c.componentWillReceiveProps({
c.UNSAFE_componentWillReceiveProps({
style: {
opacity: anim,
},
@@ -120,7 +120,7 @@ describe('Animated tests', () => {
opacity: anim,
},
};
c.componentWillMount();
c.UNSAFE_componentWillMount();
Animated.timing(anim, {toValue: 10, duration: 1000}).start(callback);
c._component = {};
@@ -29,7 +29,7 @@ const NativeAnimatedHelper = require('NativeAnimatedHelper');
function createAndMountComponent(ComponentClass, props) {
const component = new ComponentClass();
component.props = props;
component.componentWillMount();
component.UNSAFE_componentWillMount();
// Simulate that refs were set.
component._component = {};
component.componentDidMount();
@@ -42,7 +42,7 @@ function createAnimatedComponent(Component: any): any {
this._component.setNativeProps(props);
}
componentWillMount() {
UNSAFE_componentWillMount() {
this._attachProps(this.props);
}
@@ -127,7 +127,7 @@ function createAnimatedComponent(Component: any): any {
oldPropsAnimated && oldPropsAnimated.__detach();
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
this._attachProps(newProps);
}
@@ -133,7 +133,7 @@ const KeyboardAvoidingView = createReactClass({
this.frame = event.nativeEvent.layout;
},
componentWillUpdate(nextProps: Object, nextState: Object, nextContext?: Object): void {
UNSAFE_componentWillUpdate(nextProps: Object, nextState: Object, nextContext?: Object): void {
if (nextState.bottom === this.state.bottom &&
this.props.behavior === 'height' &&
nextProps.behavior === 'height') {
@@ -143,7 +143,7 @@ const KeyboardAvoidingView = createReactClass({
}
},
componentWillMount() {
UNSAFE_componentWillMount() {
if (Platform.OS === 'ios') {
this.subscriptions = [
Keyboard.addListener('keyboardWillChangeFrame', this._onKeyboardChange),
@@ -23,7 +23,7 @@ var LazyRenderer = createReactClass({
render: PropTypes.func.isRequired,
},
componentWillMount: function(): void {
UNSAFE_componentWillMount: function(): void {
this.setState({
_lazyRender : true,
});
@@ -515,7 +515,7 @@ var NavigatorIOS = createReactClass({
navigator: (undefined: ?Object),
componentWillMount: function() {
UNSAFE_componentWillMount: function() {
// Precompute a pack of callbacks that's frequently generated and passed to
// instances.
this.navigator = {
@@ -66,7 +66,7 @@ class PickerAndroid extends React.Component<{
};
}
componentWillReceiveProps(nextProps) {
UNSAFE_componentWillReceiveProps(nextProps) {
this.setState(this._stateFromProps(nextProps));
}
@@ -41,7 +41,7 @@ var PickerIOS = createReactClass({
return this._stateFromProps(this.props);
},
componentWillReceiveProps: function(nextProps) {
UNSAFE_componentWillReceiveProps: function(nextProps) {
this.setState(this._stateFromProps(nextProps));
},
@@ -548,7 +548,7 @@ const ScrollResponderMixin = {
*
* The `keyboardWillShow` is called before input focus.
*/
componentWillMount: function() {
UNSAFE_componentWillMount: function() {
const {keyboardShouldPersistTaps} = this.props;
warning(
typeof keyboardShouldPersistTaps !== 'boolean',
@@ -510,7 +510,7 @@ const ScrollView = createReactClass({
};
},
componentWillMount: function() {
UNSAFE_componentWillMount: function() {
this._scrollAnimatedValue = new Animated.Value(this.props.contentOffset ? this.props.contentOffset.y : 0);
this._scrollAnimatedValue.setOffset(this.props.contentInset ? this.props.contentInset.top : 0);
this._stickyHeaderRefs = new Map();
@@ -25,7 +25,7 @@ var Subscribable = {};
Subscribable.Mixin = {
componentWillMount: function() {
UNSAFE_componentWillMount: function() {
this._subscribableSubscriptions = [];
},
@@ -102,13 +102,13 @@ class TabBarItemIOS extends React.Component {
hasBeenSelected: false,
};
componentWillMount() {
UNSAFE_componentWillMount() {
if (this.props.selected) {
this.setState({hasBeenSelected: true});
}
}
componentWillReceiveProps(nextProps: { selected?: boolean }) {
UNSAFE_componentWillReceiveProps(nextProps: { selected?: boolean }) {
if (this.state.hasBeenSelected || nextProps.selected) {
this.setState({hasBeenSelected: true});
}
@@ -203,7 +203,7 @@ const TouchableHighlight = createReactClass({
clearTimeout(this._hideTimeout);
},
componentWillReceiveProps: function(nextProps) {
UNSAFE_componentWillReceiveProps: function(nextProps) {
ensurePositiveDelayProps(nextProps);
},
@@ -147,7 +147,7 @@ var TouchableNativeFeedback = createReactClass({
ensurePositiveDelayProps(this.props);
},
componentWillReceiveProps: function(nextProps) {
UNSAFE_componentWillReceiveProps: function(nextProps) {
ensurePositiveDelayProps(nextProps);
},
@@ -158,7 +158,7 @@ var TouchableOpacity = createReactClass({
ensurePositiveDelayProps(this.props);
},
componentWillReceiveProps: function(nextProps) {
UNSAFE_componentWillReceiveProps: function(nextProps) {
ensurePositiveDelayProps(nextProps);
},
@@ -122,7 +122,7 @@ const TouchableWithoutFeedback = createReactClass({
ensurePositiveDelayProps(this.props);
},
componentWillReceiveProps: function(nextProps: Object) {
UNSAFE_componentWillReceiveProps: function(nextProps: Object) {
ensurePositiveDelayProps(nextProps);
},
@@ -247,7 +247,7 @@ class WebView extends React.Component {
startInLoadingState: true,
};
componentWillMount() {
UNSAFE_componentWillMount() {
if (this.props.startInLoadingState) {
this.setState({viewState: WebViewState.LOADING});
}
@@ -410,7 +410,7 @@ class WebView extends React.Component {
startInLoadingState: true,
};
componentWillMount() {
UNSAFE_componentWillMount() {
if (this.props.startInLoadingState) {
this.setState({viewState: WebViewState.LOADING});
}
@@ -129,7 +129,7 @@ class Incremental extends React.Component<Props, State> {
return ctx.groupId + ':' + this._incrementId + '-' + this.props.name;
}
componentWillMount() {
UNSAFE_componentWillMount() {
const ctx = this.context.incrementalGroup;
if (!ctx) {
return;
@@ -37,7 +37,7 @@ import type {Props, Context} from 'Incremental';
class IncrementalGroup extends React.Component<Props & {disabled?: boolean}> {
context: Context;
_groupInc: string;
componentWillMount() {
UNSAFE_componentWillMount() {
this._groupInc = `g${++_groupCounter}-`;
DEBUG && infoLog(
'create IncrementalGroup with id ' + this.getGroupId()
@@ -105,7 +105,7 @@ class SwipeableListView extends React.Component<Props, State> {
};
}
componentWillReceiveProps(nextProps: Props): void {
UNSAFE_componentWillReceiveProps(nextProps: Props): void {
if (this.state.dataSource.getDataSource() !== nextProps.dataSource.getDataSource()) {
this.setState({
dataSource: nextProps.dataSource,
@@ -125,7 +125,7 @@ const SwipeableRow = createReactClass({
};
},
componentWillMount(): void {
UNSAFE_componentWillMount(): void {
this._panResponder = PanResponder.create({
onMoveShouldSetPanResponderCapture: this._handleMoveShouldSetPanResponderCapture,
onPanResponderGrant: this._handlePanResponderGrant,
@@ -149,7 +149,7 @@ const SwipeableRow = createReactClass({
}
},
componentWillReceiveProps(nextProps: Object): void {
UNSAFE_componentWillReceiveProps(nextProps: Object): void {
/**
* We do not need an "animateOpen(noCallback)" because this animation is
* handled internally by this component.
@@ -243,7 +243,7 @@ class WindowedListView extends React.Component<Props, State> {
DEBUG && infoLog(' knope');
return false;
}
componentWillReceiveProps() {
UNSAFE_componentWillReceiveProps() {
this._computeRowsToRenderBatcher.schedule();
}
_onMomentumScrollEnd = (e: Object) => {
@@ -624,7 +624,7 @@ class CellRenderer extends React.Component<CellProps> {
_perfUpdateID: number = 0;
_asyncCookie: any;
_includeInLayoutLatch: boolean = false;
componentWillMount() {
UNSAFE_componentWillMount() {
if (this.props.asyncRowPerfEventName) {
this._perfUpdateID = g_perf_update_id++;
this._asyncCookie = Systrace.beginAsyncEvent(
@@ -694,7 +694,7 @@ class CellRenderer extends React.Component<CellProps> {
this.props.onProgressChange({rowKey: this.props.rowKey, inProgress: false});
this.props.onWillUnmount(this.props.rowKey);
}
componentWillReceiveProps(newProps) {
UNSAFE_componentWillReceiveProps(newProps) {
if (newProps.includeInLayout && !this.props.includeInLayout) {
invariant(this._offscreenRenderDone, 'Should never try to add to layout before render done');
this._includeInLayoutLatch = true; // Once we render in layout, make sure it sticks.
@@ -92,7 +92,7 @@ class Inspector extends React.Component<{
hook.off('react-devtools', this.attachToDevtools);
}
componentWillReceiveProps(newProps: Object) {
UNSAFE_componentWillReceiveProps(newProps: Object) {
this.setState({inspectedViewTag: newProps.inspectedViewTag});
}
@@ -423,11 +423,11 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
}
}
componentWillMount() {
UNSAFE_componentWillMount() {
this._checkProps(this.props);
}
componentWillReceiveProps(nextProps: Props<ItemT>) {
UNSAFE_componentWillReceiveProps(nextProps: Props<ItemT>) {
invariant(
nextProps.numColumns === this.props.numColumns,
'Changing numColumns on the fly is not supported. Change the key prop on FlatList when ' +
@@ -354,7 +354,7 @@ var ListView = createReactClass({
return this._scrollComponent.getInnerViewNode();
},
componentWillMount: function() {
UNSAFE_componentWillMount: function() {
// this data should never trigger a render pass, so don't put in state
this.scrollProperties = {
visibleLength: null,
@@ -375,7 +375,7 @@ var ListView = createReactClass({
});
},
componentWillReceiveProps: function(nextProps: Object) {
UNSAFE_componentWillReceiveProps: function(nextProps: Object) {
if (
this.props.dataSource !== nextProps.dataSource ||
this.props.initialListSize !== nextProps.initialListSize
@@ -135,7 +135,7 @@ class MetroListView extends React.Component<Props, $FlowFixMeState> {
}),
sectionHeaderData: {},
});
componentWillReceiveProps(newProps: Props) {
UNSAFE_componentWillReceiveProps(newProps: Props) {
this.setState(state => this._computeState(newProps, state));
}
render() {
@@ -611,7 +611,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
this._fillRateHelper.deactivateAndFlush();
}
componentWillReceiveProps(newProps: Props) {
UNSAFE_componentWillReceiveProps(newProps: Props) {
const {data, extraData, getItemCount, maxToRenderPerBatch} = newProps;
// first and last could be stale (e.g. if a new, shorter items props is passed in), so we make
// sure we're rendering a reasonable range here.
@@ -361,7 +361,7 @@ class VirtualizedSectionList<SectionT: SectionBase> extends React.PureComponent<
this.state = this._computeState(props);
}
componentWillReceiveProps(nextProps: Props<SectionT>) {
UNSAFE_componentWillReceiveProps(nextProps: Props<SectionT>) {
this.setState(this._computeState(nextProps));
}
@@ -446,7 +446,7 @@ class ItemWithSeparator extends React.Component<
},
};
componentWillReceiveProps(props: ItemWithSeparatorProps) {
UNSAFE_componentWillReceiveProps(props: ItemWithSeparatorProps) {
this.setState(state => ({
separatorProps: {
...this.state.separatorProps,
View
@@ -151,7 +151,7 @@ class Modal extends React.Component<Object> {
}
}
componentWillReceiveProps(nextProps: Object) {
UNSAFE_componentWillReceiveProps(nextProps: Object) {
Modal._confirmProps(nextProps);
}
@@ -75,7 +75,7 @@ class AnExSet extends React.Component<Object, any> {
);
}
componentWillMount() {
UNSAFE_componentWillMount() {
this.state.dismissY = new Animated.Value(0);
this.state.dismissResponder = PanResponder.create({
onStartShouldSetPanResponder: () => this.props.isActive,
@@ -77,7 +77,7 @@ class AnExTilt extends React.Component<Object, any> {
}).start();
}
componentWillMount() {
UNSAFE_componentWillMount() {
this._startBurnsZoom();
}
Oops, something went wrong.

0 comments on commit 6f007e8

Please sign in to comment.