diff --git a/Libraries/Components/TextInput/TextInput.js b/Libraries/Components/TextInput/TextInput.js index d1f4bd9cb..4bd556a83 100644 --- a/Libraries/Components/TextInput/TextInput.js +++ b/Libraries/Components/TextInput/TextInput.js @@ -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'); @@ -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 @@ -999,7 +1000,7 @@ const TextInput = createReactClass({ onBlur={this._onBlur} onChange={this._onChange} onSelectionChange={this._onSelectionChange} - onSelectionChangeShouldSetResponder={emptyFunction.thatReturnsTrue} + onSelectionChangeShouldSetResponder={emptyFunctionThatReturnsTrue} text={this._getText()} /> ); @@ -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} @@ -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} diff --git a/Libraries/Experimental/SwipeableRow/SwipeableRow.js b/Libraries/Experimental/SwipeableRow/SwipeableRow.js index 76eb13dcf..de707a354 100644 --- a/Libraries/Experimental/SwipeableRow/SwipeableRow.js +++ b/Libraries/Experimental/SwipeableRow/SwipeableRow.js @@ -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'; @@ -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, diff --git a/Libraries/vendor/emitter/EventEmitter.js b/Libraries/vendor/emitter/EventEmitter.js index b268fd804..0a897a8ec 100644 --- a/Libraries/vendor/emitter/EventEmitter.js +++ b/Libraries/vendor/emitter/EventEmitter.js @@ -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 @@ -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) : []; }