mirror of
https://github.com/status-im/react-native.git
synced 2025-01-15 20:15:11 +00:00
Prettier for Text.js
Summary: Trivial. Reviewed By: sahrens Differential Revision: D6715229 fbshipit-source-id: 13ae84920c98e0d8e8f1b64aeadfa770b64ea3b4
This commit is contained in:
parent
e758cb7f39
commit
bf9cabb03c
@ -8,6 +8,7 @@
|
|||||||
*
|
*
|
||||||
* @providesModule Text
|
* @providesModule Text
|
||||||
* @flow
|
* @flow
|
||||||
|
* @format
|
||||||
*/
|
*/
|
||||||
'use strict';
|
'use strict';
|
||||||
|
|
||||||
@ -422,10 +423,10 @@ const Text = createReactClass({
|
|||||||
return {isInAParentText: true};
|
return {isInAParentText: true};
|
||||||
},
|
},
|
||||||
childContextTypes: {
|
childContextTypes: {
|
||||||
isInAParentText: PropTypes.bool
|
isInAParentText: PropTypes.bool,
|
||||||
},
|
},
|
||||||
contextTypes: {
|
contextTypes: {
|
||||||
isInAParentText: PropTypes.bool
|
isInAParentText: PropTypes.bool,
|
||||||
},
|
},
|
||||||
/**
|
/**
|
||||||
* Only assigned if touch is needed.
|
* Only assigned if touch is needed.
|
||||||
@ -448,8 +449,9 @@ const Text = createReactClass({
|
|||||||
if (this.props.onStartShouldSetResponder || this._hasPressHandler()) {
|
if (this.props.onStartShouldSetResponder || this._hasPressHandler()) {
|
||||||
if (!this._handlers) {
|
if (!this._handlers) {
|
||||||
this._handlers = {
|
this._handlers = {
|
||||||
onStartShouldSetResponder: (): bool => {
|
onStartShouldSetResponder: (): boolean => {
|
||||||
const shouldSetFromProps = this.props.onStartShouldSetResponder &&
|
const shouldSetFromProps =
|
||||||
|
this.props.onStartShouldSetResponder &&
|
||||||
// $FlowFixMe(>=0.41.0)
|
// $FlowFixMe(>=0.41.0)
|
||||||
this.props.onStartShouldSetResponder();
|
this.props.onStartShouldSetResponder();
|
||||||
const setResponder = shouldSetFromProps || this._hasPressHandler();
|
const setResponder = shouldSetFromProps || this._hasPressHandler();
|
||||||
@ -462,7 +464,10 @@ const Text = createReactClass({
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
this.touchableHandleActivePressIn = () => {
|
this.touchableHandleActivePressIn = () => {
|
||||||
if (this.props.suppressHighlighting || !this._hasPressHandler()) {
|
if (
|
||||||
|
this.props.suppressHighlighting ||
|
||||||
|
!this._hasPressHandler()
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -471,7 +476,10 @@ const Text = createReactClass({
|
|||||||
};
|
};
|
||||||
|
|
||||||
this.touchableHandleActivePressOut = () => {
|
this.touchableHandleActivePressOut = () => {
|
||||||
if (this.props.suppressHighlighting || !this._hasPressHandler()) {
|
if (
|
||||||
|
this.props.suppressHighlighting ||
|
||||||
|
!this._hasPressHandler()
|
||||||
|
) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
this.setState({
|
this.setState({
|
||||||
@ -513,12 +521,15 @@ const Text = createReactClass({
|
|||||||
this.props.onResponderTerminate &&
|
this.props.onResponderTerminate &&
|
||||||
this.props.onResponderTerminate.apply(this, arguments);
|
this.props.onResponderTerminate.apply(this, arguments);
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
onResponderTerminationRequest: function(): bool {
|
onResponderTerminationRequest: function(): boolean {
|
||||||
// Allow touchable or props.onResponderTerminationRequest to deny
|
// Allow touchable or props.onResponderTerminationRequest to deny
|
||||||
// the request
|
// the request
|
||||||
var allowTermination = this.touchableHandleResponderTerminationRequest();
|
var allowTermination = this.touchableHandleResponderTerminationRequest();
|
||||||
if (allowTermination && this.props.onResponderTerminationRequest) {
|
if (allowTermination && this.props.onResponderTerminationRequest) {
|
||||||
allowTermination = this.props.onResponderTerminationRequest.apply(this, arguments);
|
allowTermination = this.props.onResponderTerminationRequest.apply(
|
||||||
|
this,
|
||||||
|
arguments,
|
||||||
|
);
|
||||||
}
|
}
|
||||||
return allowTermination;
|
return allowTermination;
|
||||||
}.bind(this),
|
}.bind(this),
|
||||||
@ -533,7 +544,7 @@ const Text = createReactClass({
|
|||||||
if (newProps.selectionColor != null) {
|
if (newProps.selectionColor != null) {
|
||||||
newProps = {
|
newProps = {
|
||||||
...newProps,
|
...newProps,
|
||||||
selectionColor: processColor(newProps.selectionColor)
|
selectionColor: processColor(newProps.selectionColor),
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
if (Touchable.TOUCH_TARGET_DEBUG && newProps.onPress) {
|
if (Touchable.TOUCH_TARGET_DEBUG && newProps.onPress) {
|
||||||
@ -555,13 +566,13 @@ type RectOffset = {
|
|||||||
left: number,
|
left: number,
|
||||||
right: number,
|
right: number,
|
||||||
bottom: number,
|
bottom: number,
|
||||||
}
|
};
|
||||||
|
|
||||||
var PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
var PRESS_RECT_OFFSET = {top: 20, left: 20, right: 20, bottom: 30};
|
||||||
|
|
||||||
var RCTText = createReactNativeComponentClass(
|
var RCTText = createReactNativeComponentClass(
|
||||||
viewConfig.uiViewClassName,
|
viewConfig.uiViewClassName,
|
||||||
() => viewConfig
|
() => viewConfig,
|
||||||
);
|
);
|
||||||
var RCTVirtualText = RCTText;
|
var RCTVirtualText = RCTText;
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user