Skip to content

Commit cfef04e

Browse files
cpojerfacebook-github-bot
authored andcommitted
Remove fbjs/lib/emptyFunction from react-native
Summary: This removes `emptyFunction` usage from react-native. Reviewed By: yungsters Differential Revision: D13138187 fbshipit-source-id: eaa327884aac2cabb99024077e3407cb99c946d2
1 parent 2de01cb commit cfef04e

File tree

3 files changed

+11
-11
lines changed

3 files changed

+11
-11
lines changed

Libraries/Components/TextInput/TextInput.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ const TouchableWithoutFeedback = require('TouchableWithoutFeedback');
2626
const UIManager = require('UIManager');
2727

2828
const createReactClass = require('create-react-class');
29-
const emptyFunction = require('fbjs/lib/emptyFunction');
3029
const invariant = require('fbjs/lib/invariant');
3130
const requireNativeComponent = require('requireNativeComponent');
3231
const warning = require('fbjs/lib/warning');
@@ -276,6 +275,8 @@ type Props = $ReadOnly<{|
276275
contextMenuHidden?: ?boolean,
277276
|}>;
278277

278+
const emptyFunctionThatReturnsTrue = () => true;
279+
279280
/**
280281
* A foundational component for inputting text into the app via a
281282
* keyboard. Props provide configurability for several features, such as
@@ -999,7 +1000,7 @@ const TextInput = createReactClass({
9991000
onBlur={this._onBlur}
10001001
onChange={this._onChange}
10011002
onSelectionChange={this._onSelectionChange}
1002-
onSelectionChangeShouldSetResponder={emptyFunction.thatReturnsTrue}
1003+
onSelectionChangeShouldSetResponder={emptyFunctionThatReturnsTrue}
10031004
text={this._getText()}
10041005
/>
10051006
);
@@ -1036,7 +1037,7 @@ const TextInput = createReactClass({
10361037
onContentSizeChange={this.props.onContentSizeChange}
10371038
onSelectionChange={this._onSelectionChange}
10381039
onTextInput={this._onTextInput}
1039-
onSelectionChangeShouldSetResponder={emptyFunction.thatReturnsTrue}
1040+
onSelectionChangeShouldSetResponder={emptyFunctionThatReturnsTrue}
10401041
text={this._getText()}
10411042
dataDetectorTypes={this.props.dataDetectorTypes}
10421043
onScroll={this._onScroll}
@@ -1089,7 +1090,7 @@ const TextInput = createReactClass({
10891090
onContentSizeChange={this.props.onContentSizeChange}
10901091
onSelectionChange={this._onSelectionChange}
10911092
onTextInput={this._onTextInput}
1092-
onSelectionChangeShouldSetResponder={emptyFunction.thatReturnsTrue}
1093+
onSelectionChangeShouldSetResponder={emptyFunctionThatReturnsTrue}
10931094
text={this._getText()}
10941095
dataDetectorTypes={this.props.dataDetectorTypes}
10951096
onScroll={this._onScroll}

Libraries/Experimental/SwipeableRow/SwipeableRow.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ const React = require('React');
1717
const StyleSheet = require('StyleSheet');
1818
const View = require('View');
1919

20-
const emptyFunction = require('fbjs/lib/emptyFunction');
21-
2220
import type {LayoutEvent, PressEvent} from 'CoreEventTypes';
2321
import type {GestureState} from 'PanResponder';
2422

@@ -55,6 +53,8 @@ const RIGHT_SWIPE_BOUNCE_BACK_DURATION = 300;
5553
const RIGHT_SWIPE_THRESHOLD = 30 * SLOW_SPEED_SWIPE_FACTOR;
5654
const DEFAULT_SWIPE_THRESHOLD = 30;
5755

56+
const emptyFunction = () => {};
57+
5858
type Props = $ReadOnly<{|
5959
children?: ?React.Node,
6060
isOpen?: ?boolean,

Libraries/vendor/emitter/EventEmitter.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,10 @@
1414
const EmitterSubscription = require('EmitterSubscription');
1515
const EventSubscriptionVendor = require('EventSubscriptionVendor');
1616

17-
const emptyFunction = require('fbjs/lib/emptyFunction');
1817
const invariant = require('fbjs/lib/invariant');
1918

19+
const emptyFunctionThatReturnsTrue = () => true;
20+
2021
/**
2122
* @class EventEmitter
2223
* @description
@@ -155,10 +156,8 @@ class EventEmitter {
155156
] = (this._subscriber.getSubscriptionsForType(eventType): any);
156157
return subscriptions
157158
? subscriptions
158-
.filter(emptyFunction.thatReturnsTrue)
159-
.map(function(subscription) {
160-
return subscription.listener;
161-
})
159+
.filter(emptyFunctionThatReturnsTrue)
160+
.map(subscription => subscription.listener)
162161
: [];
163162
}
164163

0 commit comments

Comments
 (0)