Skip to content

Commit

Permalink
Fix lint for moved ReactNative
Browse files Browse the repository at this point in the history
  • Loading branch information
sebmarkbage committed Apr 20, 2016
1 parent 5470972 commit 744548a
Show file tree
Hide file tree
Showing 20 changed files with 58 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

var IOSDefaultEventPluginOrder = [
'ResponderEventPlugin',
'IOSNativeBridgeEventPlugin'
'IOSNativeBridgeEventPlugin',
];

module.exports = IOSDefaultEventPluginOrder;
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ var IOSNativeBridgeEventPlugin = {
return null;
}
return event;
}
},
};

module.exports = IOSNativeBridgeEventPlugin;
8 changes: 4 additions & 4 deletions src/renderers/native/ReactIOS/NativeMethodsMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ var NativeMethodsMixin = {
*/
blur: function() {
TextInputState.blurTextInput(findNodeHandle(this));
}
},
};

function throwOnStylesProp(component, props) {
Expand All @@ -195,10 +195,10 @@ if (__DEV__) {
!NativeMethodsMixin_DEV.componentWillReceiveProps,
'Do not override existing functions.'
);
NativeMethodsMixin_DEV.componentWillMount = function () {
NativeMethodsMixin_DEV.componentWillMount = function() {
throwOnStylesProp(this, this.props);
};
NativeMethodsMixin_DEV.componentWillReceiveProps = function (newProps) {
NativeMethodsMixin_DEV.componentWillReceiveProps = function(newProps) {
throwOnStylesProp(this, newProps);
};
}
Expand All @@ -210,7 +210,7 @@ if (__DEV__) {
var mountSafeCallback = function(context: ReactComponent, callback: ?Function): any {
return function() {
if (!callback || (context.isMounted && !context.isMounted())) {
return;
return undefined;
}
return callback.apply(context, arguments);
};
Expand Down
12 changes: 0 additions & 12 deletions src/renderers/native/ReactNative/ReactNative.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
var ReactNativeComponentTree = require('ReactNativeComponentTree');
var ReactNativeDefaultInjection = require('ReactNativeDefaultInjection');

var ReactCurrentOwner = require('ReactCurrentOwner');
var ReactElement = require('ReactElement');
var ReactInstanceHandles = require('ReactInstanceHandles');
var ReactNativeMount = require('ReactNativeMount');
var ReactUpdates = require('ReactUpdates');

Expand All @@ -45,16 +43,6 @@ var ReactNative = {
/* eslint-enable camelcase */

unmountComponentAtNodeAndRemoveContainer: ReactNativeMount.unmountComponentAtNodeAndRemoveContainer,

// Deprecations (remove for 0.13)
renderComponent: function(
element: ReactElement,
mountInto: number,
callback?: ?(() => void)
): ?ReactComponent {
warning('Use React.render instead of React.renderComponent');
return ReactNative.render(element, mountInto, callback);
},
};

// Inject the runtime into a devtools global hook regardless of browser.
Expand Down
10 changes: 5 additions & 5 deletions src/renderers/native/ReactNative/ReactNativeAttributePayload.js
Original file line number Diff line number Diff line change
Expand Up @@ -408,9 +408,9 @@ function diffProperties(
defaultDiffer(prevProp, nextProp)
);
if (shouldUpdate) {
var nextValue = typeof attributeConfig.process === 'function' ?
attributeConfig.process(nextProp) :
nextProp;
nextValue = typeof attributeConfig.process === 'function' ?
attributeConfig.process(nextProp) :
nextProp;
(updatePayload || (updatePayload = {}))[altKey] = nextValue;
}
} else {
Expand All @@ -437,7 +437,7 @@ function diffProperties(
// Also iterate through all the previous props to catch any that have been
// removed and make sure native gets the signal so it can reset them to the
// default.
for (var propKey in prevProps) {
for (propKey in prevProps) {
if (nextProps[propKey] !== undefined) {
continue; // we've already covered this key in the previous pass
}
Expand Down Expand Up @@ -539,7 +539,7 @@ var ReactNativeAttributePayload = {
nextProps,
validAttributes
);
}
},

};

Expand Down
4 changes: 1 addition & 3 deletions src/renderers/native/ReactNative/ReactNativeBaseComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ var ReactMultiChild = require('ReactMultiChild');
var UIManager = require('UIManager');

var deepFreezeAndThrowOnMutationInDev = require('deepFreezeAndThrowOnMutationInDev');
var invariant = require('invariant');
var warning = require('warning');

var registrationNames = ReactNativeEventEmitter.registrationNames;
var putListener = ReactNativeEventEmitter.putListener;
Expand Down Expand Up @@ -215,7 +213,7 @@ ReactNativeBaseComponent.Mixin = {
context
);
return tag;
}
},
};

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@

function ReactNativeContainerInfo(tag) {
var info = {
_tag: tag
_tag: tag,
};
return info;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
'use strict';

var ReactNativeComponentTree = require('ReactNativeComponentTree');
var ReactNativeTagHandles = require('ReactNativeTagHandles');
var ReactMultiChildUpdateTypes = require('ReactMultiChildUpdateTypes');
var ReactPerf = require('ReactPerf');
var UIManager = require('UIManager');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ function inject() {
*/
EventPluginHub.injection.injectEventPluginsByName({
'ResponderEventPlugin': ResponderEventPlugin,
'IOSNativeBridgeEventPlugin': IOSNativeBridgeEventPlugin
'IOSNativeBridgeEventPlugin': IOSNativeBridgeEventPlugin,
});

ReactUpdates.injection.injectReconcileTransaction(
Expand All @@ -87,7 +87,7 @@ function inject() {
return new ReactSimpleEmptyComponent(
ReactElement.createElement(View, {
collapsable: true,
style: { position: 'absolute' }
style: { position: 'absolute' },
}),
instantiate
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ var ReactNativeEventEmitter = merge(ReactEventEmitterMixin, {
nativeEvent
);
}
}
},
});

module.exports = ReactNativeEventEmitter;
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ var ReactNativeGlobalInteractionHandler = {
} else if (!interactionHandle) {
interactionHandle = InteractionManager.createInteractionHandle();
}
}
},
};

module.exports = ReactNativeGlobalInteractionHandler;
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
*/
'use strict';

var ReactNativeTagHandles = require('ReactNativeTagHandles');
var UIManager = require('UIManager');

var ReactNativeGlobalResponderHandler = {
Expand All @@ -23,7 +22,7 @@ var ReactNativeGlobalResponderHandler = {
} else {
UIManager.clearJSResponder();
}
}
},
};

module.exports = ReactNativeGlobalResponderHandler;
4 changes: 2 additions & 2 deletions src/renderers/native/ReactNative/ReactNativeMount.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ var ReactNativeMount = {

if (!ReactNativeTagHandles.reactTagIsNativeTopRootID(containerTag)) {
console.error('You cannot render into anything but a top root');
return;
return null;
}

ReactNativeTagHandles.assertRootTag(containerTag);
Expand Down Expand Up @@ -225,7 +225,7 @@ var ReactNativeMount = {
// Call back into native to remove all of the subviews from this container
ReactReconciler.unmountComponent(instance);
UIManager.removeSubviewsFromContainerWithID(containerID);
}
},

};

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ var ON_DOM_READY_QUEUEING = {
*/
close: function() {
this.reactMountReady.notifyAll();
}
},
};

/**
Expand Down Expand Up @@ -88,7 +88,7 @@ var Mixin = {
destructor: function() {
CallbackQueue.release(this.reactMountReady);
this.reactMountReady = null;
}
},
};

Object.assign(
Expand Down
6 changes: 2 additions & 4 deletions src/renderers/native/ReactNative/ReactNativeTagHandles.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
'use strict';

var invariant = require('invariant');
var warning = require('warning');

/**
* Keeps track of allocating and associating native "tags" which are numeric,
Expand All @@ -28,7 +27,6 @@ var warning = require('warning');
* unmount a component with a `rootNodeID`, then mount a new one in its place,
*/
var INITIAL_TAG_COUNT = 1;
var NATIVE_TOP_ROOT_ID_SEPARATOR = '{TOP_LEVEL}';
var ReactNativeTagHandles = {
tagsStartAt: INITIAL_TAG_COUNT,
tagCount: INITIAL_TAG_COUNT,
Expand All @@ -46,14 +44,14 @@ var ReactNativeTagHandles = {
assertRootTag: function(tag: number): void {
invariant(
this.reactTagIsNativeTopRootID(tag),
'Expect a native root tag, instead got ', tag
'Expect a native root tag, instead got %s', tag
);
},

reactTagIsNativeTopRootID: function(reactTag: number): bool {
// We reserve all tags that are 1 mod 10 for native root views
return reactTag % 10 === 1;
}
},
};

module.exports = ReactNativeTagHandles;
6 changes: 3 additions & 3 deletions src/renderers/native/ReactNative/ReactNativeTextComponent.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@ Object.assign(ReactNativeTextComponent.prototype, {
// TODO: nativeParent should have this context already. Stop abusing context.
invariant(
context.isInAParentText,
'RawText "' + this._stringText + '" must be wrapped in an explicit ' +
'<Text> component.'
'RawText "%s" must be wrapped in an explicit <Text> component.',
this._stringText
);
this._nativeParent = nativeParent;
var tag = ReactNativeTagHandles.allocateTag();
Expand Down Expand Up @@ -74,7 +74,7 @@ Object.assign(ReactNativeTextComponent.prototype, {
this._currentElement = null;
this._stringText = null;
this._rootNodeID = null;
}
},

});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,10 +87,10 @@ describe('ReactNativeAttributePayload', function() {

it('should do deep diffs of Objects by default', () => {
expect(diff(
{a: [1], b: {k: [3,4]}, c: {k: [4,4]} },
{a: [2], b: {k: [3,4]}, c: {k: [4,5]} },
{a: [1], b: {k: [3, 4]}, c: {k: [4, 4]} },
{a: [2], b: {k: [3, 4]}, c: {k: [4, 5]} },
{a: true, b: true, c: true}
)).toEqual({a: [2], c: {k: [4,5]}});
)).toEqual({a: [2], c: {k: [4, 5]}});
});

it('should work with undefined styles', () => {
Expand Down Expand Up @@ -222,10 +222,25 @@ describe('ReactNativeAttributePayload', function() {
// Note that if the property changes from one function to another, we don't
// need to send an update.
expect(diff(
{a: function() { return 1; }, b: function() { return 2; }, c: 3},
{b: function() { return 9; }, c: function() { return 3; }, },
{
a: function() {
return 1;
},
b: function() {
return 2;
},
c: 3,
},
{
b: function() {
return 9;
},
c: function() {
return 3;
},
},
{a: true, b: true, c: true}
)).toEqual({a: null, c: true});
});

});
});
1 change: 0 additions & 1 deletion src/renderers/native/ReactNative/findNodeHandle.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@

var ReactCurrentOwner = require('ReactCurrentOwner');
var ReactInstanceMap = require('ReactInstanceMap');
var ReactNativeTagHandles = require('ReactNativeTagHandles');

var invariant = require('invariant');
var warning = require('warning');
Expand Down
17 changes: 9 additions & 8 deletions src/renderers/shared/event/eventPlugins/PanResponder.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* @providesModule PanResponder
*/

"use strict";
'use strict';

var TouchHistoryMath = require('TouchHistoryMath');

Expand Down Expand Up @@ -320,25 +320,25 @@ var PanResponder = {
gestureState.y0 = currentCentroidY(e.touchHistory);
gestureState.dx = 0;
gestureState.dy = 0;
config.onPanResponderGrant && config.onPanResponderGrant(e, gestureState);
if (config.onPanResponderGrant) config.onPanResponderGrant(e, gestureState);
// TODO: t7467124 investigate if this can be removed
return config.onShouldBlockNativeResponder === undefined ? true :
config.onShouldBlockNativeResponder();
},

onResponderReject: function(e) {
config.onPanResponderReject && config.onPanResponderReject(e, gestureState);
if (config.onPanResponderReject) config.onPanResponderReject(e, gestureState);
},

onResponderRelease: function(e) {
config.onPanResponderRelease && config.onPanResponderRelease(e, gestureState);
if (config.onPanResponderRelease) config.onPanResponderRelease(e, gestureState);
PanResponder._initializeGestureState(gestureState);
},

onResponderStart: function(e) {
var touchHistory = e.touchHistory;
gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
config.onPanResponderStart && config.onPanResponderStart(e, gestureState);
if (config.onPanResponderStart) config.onPanResponderStart(e, gestureState);
},

onResponderMove: function(e) {
Expand All @@ -351,18 +351,19 @@ var PanResponder = {
// Filter out any touch moves past the first one - we would have
// already processed multi-touch geometry during the first event.
PanResponder._updateGestureStateOnMove(gestureState, touchHistory);
config.onPanResponderMove && config.onPanResponderMove(e, gestureState);
if (config.onPanResponderMove) config.onPanResponderMove(e, gestureState);
},

onResponderEnd: function(e) {
var touchHistory = e.touchHistory;
gestureState.numberActiveTouches = touchHistory.numberActiveTouches;
config.onPanResponderEnd && config.onPanResponderEnd(e, gestureState);
if (config.onPanResponderEnd) config.onPanResponderEnd(e, gestureState);
},

onResponderTerminate: function(e) {
config.onPanResponderTerminate &&
if (config.onPanResponderTerminate) {
config.onPanResponderTerminate(e, gestureState);
}
PanResponder._initializeGestureState(gestureState);
},

Expand Down
Loading

0 comments on commit 744548a

Please sign in to comment.