Skip to content

Commit

Permalink
RN: Delete mergeFast from Text
Browse files Browse the repository at this point in the history
Reviewed By: sahrens, TheSavior

Differential Revision: D7899406

fbshipit-source-id: 35fb14c5af3d01404896342a47af9fa280226c7f
  • Loading branch information
yungsters authored and facebook-github-bot committed May 9, 2018
1 parent 6a1b416 commit a1f2076
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 51 deletions.
35 changes: 17 additions & 18 deletions Libraries/Text/Text.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,27 +18,24 @@ const Touchable = require('Touchable');
const UIManager = require('UIManager');

const createReactNativeComponentClass = require('createReactNativeComponentClass');
const mergeFast = require('mergeFast');
const processColor = require('processColor');

import type {PressEvent} from 'CoreEventTypes';
import type {TextProps} from 'TextProps';
import type {PressRetentionOffset, TextProps} from 'TextProps';

type State = {
type State = {|
touchable: {|
touchState: ?string,
responderID: ?number,
|},
isHighlighted: boolean,
};

type RectOffset = {
top: number,
left: number,
right: number,
bottom: number,
};
|};

const PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};

const viewConfig = {
validAttributes: mergeFast(ReactNativeViewAttributes.UIView, {
validAttributes: {
...ReactNativeViewAttributes.UIView,
isHighlighted: true,
numberOfLines: true,
ellipsizeMode: true,
Expand All @@ -49,7 +46,7 @@ const viewConfig = {
adjustsFontSizeToFit: true,
minimumFontScale: true,
textBreakStrategy: true,
}),
},
uiViewClassName: 'RCTText',
};

Expand All @@ -67,9 +64,10 @@ class Text extends ReactNative.NativeComponent<TextProps, State> {
ellipsizeMode: 'tail',
};

state = mergeFast(Touchable.Mixin.touchableGetInitialState(), {
state = {
...Touchable.Mixin.touchableGetInitialState(),
isHighlighted: false,
});
};

viewConfig = viewConfig;

Expand Down Expand Up @@ -143,7 +141,7 @@ class Text extends ReactNative.NativeComponent<TextProps, State> {
this.props.onLongPress && this.props.onLongPress(e);
};

this.touchableGetPressRectOffset = function(): RectOffset {
this.touchableGetPressRectOffset = function(): PressRetentionOffset {
return this.props.pressRetentionOffset || PRESS_RECT_OFFSET;
};
}
Expand Down Expand Up @@ -230,9 +228,10 @@ var RCTVirtualText = RCTText;

if (UIManager.RCTVirtualText) {
RCTVirtualText = createReactNativeComponentClass('RCTVirtualText', () => ({
validAttributes: mergeFast(ReactNativeViewAttributes.UIView, {
validAttributes: {
...ReactNativeViewAttributes.UIView,
isHighlighted: true,
}),
},
uiViewClassName: 'RCTVirtualText',
}));
}
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Text/TextProps.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,12 +17,12 @@ import type {Node} from 'react';
import type {LayoutEvent, PressEvent} from 'CoreEventTypes';
import type {DangerouslyImpreciseStyleProp} from 'StyleSheet';

type PressRetentionOffset = {
export type PressRetentionOffset = $ReadOnly<{|
top: number,
left: number,
bottom: number,
right: number,
};
|}>;

/**
* @see https://facebook.github.io/react-native/docs/text.html#reference
Expand Down
31 changes: 0 additions & 31 deletions Libraries/Utilities/mergeFast.js

This file was deleted.

0 comments on commit a1f2076

Please sign in to comment.