Skip to content

Commit

Permalink
Remove fbjs/lib/emptyFunction from react-native
Browse files Browse the repository at this point in the history
Summary: This removes `emptyFunction` usage from react-native.

Reviewed By: yungsters

Differential Revision: D13138187

fbshipit-source-id: eaa327884aac2cabb99024077e3407cb99c946d2
  • Loading branch information
cpojer authored and facebook-github-bot committed Nov 26, 2018
1 parent 2de01cb commit cfef04e
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
9 changes: 5 additions & 4 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ const TouchableWithoutFeedback = require('TouchableWithoutFeedback');
const UIManager = require('UIManager');

const createReactClass = require('create-react-class');
const emptyFunction = require('fbjs/lib/emptyFunction');
const invariant = require('fbjs/lib/invariant');
const requireNativeComponent = require('requireNativeComponent');
const warning = require('fbjs/lib/warning');
Expand Down Expand Up @@ -276,6 +275,8 @@ type Props = $ReadOnly<{|
contextMenuHidden?: ?boolean,
|}>;

const emptyFunctionThatReturnsTrue = () => true;

/**
* A foundational component for inputting text into the app via a
* keyboard. Props provide configurability for several features, such as
Expand Down Expand Up @@ -999,7 +1000,7 @@ const TextInput = createReactClass({
onBlur={this._onBlur}
onChange={this._onChange}
onSelectionChange={this._onSelectionChange}
onSelectionChangeShouldSetResponder={emptyFunction.thatReturnsTrue}
onSelectionChangeShouldSetResponder={emptyFunctionThatReturnsTrue}
text={this._getText()}
/>
);
Expand Down Expand Up @@ -1036,7 +1037,7 @@ const TextInput = createReactClass({
onContentSizeChange={this.props.onContentSizeChange}
onSelectionChange={this._onSelectionChange}
onTextInput={this._onTextInput}
onSelectionChangeShouldSetResponder={emptyFunction.thatReturnsTrue}
onSelectionChangeShouldSetResponder={emptyFunctionThatReturnsTrue}
text={this._getText()}
dataDetectorTypes={this.props.dataDetectorTypes}
onScroll={this._onScroll}
Expand Down Expand Up @@ -1089,7 +1090,7 @@ const TextInput = createReactClass({
onContentSizeChange={this.props.onContentSizeChange}
onSelectionChange={this._onSelectionChange}
onTextInput={this._onTextInput}
onSelectionChangeShouldSetResponder={emptyFunction.thatReturnsTrue}
onSelectionChangeShouldSetResponder={emptyFunctionThatReturnsTrue}
text={this._getText()}
dataDetectorTypes={this.props.dataDetectorTypes}
onScroll={this._onScroll}
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Experimental/SwipeableRow/SwipeableRow.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,6 @@ const React = require('React');
const StyleSheet = require('StyleSheet');
const View = require('View');

const emptyFunction = require('fbjs/lib/emptyFunction');

import type {LayoutEvent, PressEvent} from 'CoreEventTypes';
import type {GestureState} from 'PanResponder';

Expand Down Expand Up @@ -55,6 +53,8 @@ const RIGHT_SWIPE_BOUNCE_BACK_DURATION = 300;
const RIGHT_SWIPE_THRESHOLD = 30 * SLOW_SPEED_SWIPE_FACTOR;
const DEFAULT_SWIPE_THRESHOLD = 30;

const emptyFunction = () => {};

type Props = $ReadOnly<{|
children?: ?React.Node,
isOpen?: ?boolean,
Expand Down
9 changes: 4 additions & 5 deletions Libraries/vendor/emitter/EventEmitter.js
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,10 @@
const EmitterSubscription = require('EmitterSubscription');
const EventSubscriptionVendor = require('EventSubscriptionVendor');

const emptyFunction = require('fbjs/lib/emptyFunction');
const invariant = require('fbjs/lib/invariant');

const emptyFunctionThatReturnsTrue = () => true;

/**
* @class EventEmitter
* @description
Expand Down Expand Up @@ -155,10 +156,8 @@ class EventEmitter {
] = (this._subscriber.getSubscriptionsForType(eventType): any);
return subscriptions
? subscriptions
.filter(emptyFunction.thatReturnsTrue)
.map(function(subscription) {
return subscription.listener;
})
.filter(emptyFunctionThatReturnsTrue)
.map(subscription => subscription.listener)
: [];
}

Expand Down

0 comments on commit cfef04e

Please sign in to comment.