React sync for revisions 7a3416f...725c054
Reviewed By: bvaughn Differential Revision: D7565731 fbshipit-source-id: 91d76a11b7c91dab2fb3295418d1372ca9c1b572
This commit is contained in:
Родитель
ba45895a3f
Коммит
906dde06b3
|
@ -10,104 +10,4 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
/**
|
||||
* This is a temporary fork of View.js for Fabric purpose.
|
||||
* Do not use outside of Fabric tree.
|
||||
*/
|
||||
|
||||
const Platform = require('Platform');
|
||||
const React = require('React');
|
||||
const ReactNativeStyleAttributes = require('ReactNativeStyleAttributes');
|
||||
const ReactNativeViewAttributes = require('ReactNativeViewAttributes');
|
||||
const ViewPropTypes = require('ViewPropTypes');
|
||||
const {NativeMethodsMixin} = require('ReactFabricInternals');
|
||||
const {ViewContextTypes} = require('ViewContext');
|
||||
|
||||
const createReactClass = require('create-react-class');
|
||||
const invariant = require('fbjs/lib/invariant');
|
||||
const requireFabricComponent = require('requireFabricComponent');
|
||||
|
||||
import type {ViewProps} from 'ViewPropTypes';
|
||||
import type {ViewChildContext} from 'ViewContext';
|
||||
|
||||
export type Props = ViewProps;
|
||||
|
||||
/**
|
||||
* The most fundamental component for building a UI.
|
||||
*
|
||||
* See http://facebook.github.io/react-native/docs/view.html
|
||||
*/
|
||||
const View = createReactClass({
|
||||
displayName: 'View',
|
||||
// TODO: We should probably expose the mixins, viewConfig, and statics publicly. For example,
|
||||
// one of the props is of type AccessibilityComponentType. That is defined as a const[] above,
|
||||
// but it is not rendered by the docs, since `statics` below is not rendered. So its Possible
|
||||
// values had to be hardcoded.
|
||||
mixins: [NativeMethodsMixin],
|
||||
|
||||
// `propTypes` should not be accessed directly on View since this wrapper only
|
||||
// exists for DEV mode. However it's important for them to be declared.
|
||||
// If the object passed to `createClass` specifies `propTypes`, Flow will
|
||||
// create a static type from it.
|
||||
propTypes: ViewPropTypes,
|
||||
|
||||
/**
|
||||
* `NativeMethodsMixin` will look for this when invoking `setNativeProps`. We
|
||||
* make `this` look like an actual native component class.
|
||||
*/
|
||||
viewConfig: {
|
||||
uiViewClassName: 'RCTView',
|
||||
validAttributes: ReactNativeViewAttributes.RCTView,
|
||||
},
|
||||
|
||||
childContextTypes: ViewContextTypes,
|
||||
|
||||
getChildContext(): ViewChildContext {
|
||||
return {
|
||||
isInAParentText: false,
|
||||
};
|
||||
},
|
||||
|
||||
render() {
|
||||
invariant(
|
||||
!(this.context.isInAParentText && Platform.OS === 'android'),
|
||||
'Nesting of <View> within <Text> is not supported on Android.',
|
||||
);
|
||||
|
||||
// WARNING: This method will not be used in production mode as in that mode we
|
||||
// replace wrapper component View with generated native wrapper RCTView. Avoid
|
||||
// adding functionality this component that you'd want to be available in both
|
||||
// dev and prod modes.
|
||||
return <RCTView {...this.props} />;
|
||||
},
|
||||
});
|
||||
|
||||
const RCTView = requireFabricComponent('RCTView', View, {
|
||||
nativeOnly: {
|
||||
nativeBackgroundAndroid: true,
|
||||
nativeForegroundAndroid: true,
|
||||
},
|
||||
fabric: true,
|
||||
});
|
||||
|
||||
if (__DEV__) {
|
||||
const UIManager = require('UIManager');
|
||||
const viewConfig =
|
||||
(UIManager.viewConfigs && UIManager.viewConfigs.RCTView) || {};
|
||||
for (const prop in viewConfig.nativeProps) {
|
||||
const viewAny: any = View; // Appease flow
|
||||
if (!viewAny.propTypes[prop] && !ReactNativeStyleAttributes[prop]) {
|
||||
throw new Error(
|
||||
'View is missing propType for native prop `' + prop + '`',
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let ViewToExport = RCTView;
|
||||
if (__DEV__) {
|
||||
ViewToExport = View;
|
||||
}
|
||||
|
||||
// No one should depend on the DEV-mode createClass View wrapper.
|
||||
module.exports = ((ViewToExport: any): typeof RCTView);
|
||||
module.exports = require('View');
|
||||
|
|
|
@ -14,19 +14,15 @@
|
|||
const {
|
||||
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
|
||||
} = require('ReactFabric');
|
||||
const createReactNativeComponentClass = require('createReactNativeComponentClass');
|
||||
|
||||
import type {NativeMethodsMixinType} from 'ReactNativeTypes';
|
||||
|
||||
const {
|
||||
NativeMethodsMixin,
|
||||
ReactNativeBridgeEventPlugin,
|
||||
createReactNativeComponentClass,
|
||||
} = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
||||
const {NativeMethodsMixin} = __SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
||||
|
||||
module.exports = {
|
||||
NativeMethodsMixin: ((NativeMethodsMixin: any): $Exact<
|
||||
NativeMethodsMixinType,
|
||||
>),
|
||||
ReactNativeBridgeEventPlugin,
|
||||
createReactNativeComponentClass,
|
||||
};
|
||||
|
|
|
@ -11,10 +11,7 @@
|
|||
'use strict';
|
||||
|
||||
const Platform = require('Platform');
|
||||
const {
|
||||
ReactNativeBridgeEventPlugin,
|
||||
createReactNativeComponentClass,
|
||||
} = require('ReactFabricInternals');
|
||||
const {createReactNativeComponentClass} = require('ReactFabricInternals');
|
||||
const ReactNativeStyleAttributes = require('ReactNativeStyleAttributes');
|
||||
const UIManager = require('UIManager');
|
||||
|
||||
|
@ -200,11 +197,6 @@ function requireNativeComponent(
|
|||
hasAttachedDefaultEventTypes = true;
|
||||
}
|
||||
|
||||
// Register this view's event types with the ReactNative renderer.
|
||||
// This enables view managers to be initialized lazily, improving perf,
|
||||
// While also enabling 3rd party components to define custom event types.
|
||||
ReactNativeBridgeEventPlugin.processEventTypes(viewConfig);
|
||||
|
||||
return viewConfig;
|
||||
}
|
||||
|
||||
|
|
|
@ -11,7 +11,6 @@
|
|||
'use strict';
|
||||
|
||||
const Platform = require('Platform');
|
||||
const ReactNativeBridgeEventPlugin = require('ReactNativeBridgeEventPlugin');
|
||||
const ReactNativeStyleAttributes = require('ReactNativeStyleAttributes');
|
||||
const UIManager = require('UIManager');
|
||||
|
||||
|
@ -198,11 +197,6 @@ function requireNativeComponent(
|
|||
hasAttachedDefaultEventTypes = true;
|
||||
}
|
||||
|
||||
// Register this view's event types with the ReactNative renderer.
|
||||
// This enables view managers to be initialized lazily, improving perf,
|
||||
// While also enabling 3rd party components to define custom event types.
|
||||
ReactNativeBridgeEventPlugin.processEventTypes(viewConfig);
|
||||
|
||||
return viewConfig;
|
||||
}
|
||||
|
||||
|
|
|
@ -1 +1 @@
|
|||
7a3416f27532ac25849dfbc505300d469b43bbcc
|
||||
52afbe0ebb6fca0fe480e77c6fa8482870ddb2c9
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -13,6 +13,7 @@
|
|||
require("InitializeCore");
|
||||
var invariant = require("fbjs/lib/invariant"),
|
||||
emptyFunction = require("fbjs/lib/emptyFunction"),
|
||||
ReactNativeViewConfigRegistry = require("ReactNativeViewConfigRegistry"),
|
||||
UIManager = require("UIManager"),
|
||||
TextInputState = require("TextInputState"),
|
||||
deepDiffer = require("deepDiffer"),
|
||||
|
@ -528,7 +529,7 @@ function changeResponder(nextResponderInst, blockHostResponder) {
|
|||
blockHostResponder
|
||||
);
|
||||
}
|
||||
var eventTypes = {
|
||||
var eventTypes$1 = {
|
||||
startShouldSetResponder: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: "onStartShouldSetResponder",
|
||||
|
@ -568,7 +569,7 @@ var eventTypes = {
|
|||
_getResponder: function() {
|
||||
return responderInst;
|
||||
},
|
||||
eventTypes: eventTypes,
|
||||
eventTypes: eventTypes$1,
|
||||
extractEvents: function(
|
||||
topLevelType,
|
||||
targetInst,
|
||||
|
@ -594,12 +595,12 @@ var eventTypes = {
|
|||
isMoveish(topLevelType))
|
||||
) {
|
||||
var JSCompiler_temp = isStartish(topLevelType)
|
||||
? eventTypes.startShouldSetResponder
|
||||
? eventTypes$1.startShouldSetResponder
|
||||
: isMoveish(topLevelType)
|
||||
? eventTypes.moveShouldSetResponder
|
||||
? eventTypes$1.moveShouldSetResponder
|
||||
: "topSelectionChange" === topLevelType
|
||||
? eventTypes.selectionChangeShouldSetResponder
|
||||
: eventTypes.scrollShouldSetResponder;
|
||||
? eventTypes$1.selectionChangeShouldSetResponder
|
||||
: eventTypes$1.scrollShouldSetResponder;
|
||||
if (responderInst)
|
||||
b: {
|
||||
var JSCompiler_temp$jscomp$0 = responderInst;
|
||||
|
@ -685,7 +686,7 @@ var eventTypes = {
|
|||
JSCompiler_temp && JSCompiler_temp !== responderInst
|
||||
? ((JSCompiler_temp$jscomp$0 = void 0),
|
||||
(targetInst = ResponderSyntheticEvent.getPooled(
|
||||
eventTypes.responderGrant,
|
||||
eventTypes$1.responderGrant,
|
||||
JSCompiler_temp,
|
||||
nativeEvent,
|
||||
nativeEventTarget
|
||||
|
@ -695,7 +696,7 @@ var eventTypes = {
|
|||
(depthA = !0 === executeDirectDispatch(targetInst)),
|
||||
responderInst
|
||||
? ((tempA = ResponderSyntheticEvent.getPooled(
|
||||
eventTypes.responderTerminationRequest,
|
||||
eventTypes$1.responderTerminationRequest,
|
||||
responderInst,
|
||||
nativeEvent,
|
||||
nativeEventTarget
|
||||
|
@ -707,7 +708,7 @@ var eventTypes = {
|
|||
tempA.isPersistent() || tempA.constructor.release(tempA),
|
||||
tempB
|
||||
? ((tempA = ResponderSyntheticEvent.getPooled(
|
||||
eventTypes.responderTerminate,
|
||||
eventTypes$1.responderTerminate,
|
||||
responderInst,
|
||||
nativeEvent,
|
||||
nativeEventTarget
|
||||
|
@ -721,7 +722,7 @@ var eventTypes = {
|
|||
)),
|
||||
changeResponder(JSCompiler_temp, depthA))
|
||||
: ((JSCompiler_temp = ResponderSyntheticEvent.getPooled(
|
||||
eventTypes.responderReject,
|
||||
eventTypes$1.responderReject,
|
||||
JSCompiler_temp,
|
||||
nativeEvent,
|
||||
nativeEventTarget
|
||||
|
@ -749,10 +750,10 @@ var eventTypes = {
|
|||
depthA = responderInst && isEndish(topLevelType);
|
||||
if (
|
||||
(JSCompiler_temp$jscomp$0 = JSCompiler_temp$jscomp$0
|
||||
? eventTypes.responderStart
|
||||
? eventTypes$1.responderStart
|
||||
: targetInst
|
||||
? eventTypes.responderMove
|
||||
: depthA ? eventTypes.responderEnd : null)
|
||||
? eventTypes$1.responderMove
|
||||
: depthA ? eventTypes$1.responderEnd : null)
|
||||
)
|
||||
(JSCompiler_temp$jscomp$0 = ResponderSyntheticEvent.getPooled(
|
||||
JSCompiler_temp$jscomp$0,
|
||||
|
@ -803,8 +804,8 @@ var eventTypes = {
|
|||
}
|
||||
if (
|
||||
(topLevelType = JSCompiler_temp$jscomp$0
|
||||
? eventTypes.responderTerminate
|
||||
: topLevelType ? eventTypes.responderRelease : null)
|
||||
? eventTypes$1.responderTerminate
|
||||
: topLevelType ? eventTypes$1.responderRelease : null)
|
||||
)
|
||||
(nativeEvent = ResponderSyntheticEvent.getPooled(
|
||||
topLevelType,
|
||||
|
@ -836,10 +837,12 @@ var eventTypes = {
|
|||
}
|
||||
}
|
||||
},
|
||||
customBubblingEventTypes = {},
|
||||
customDirectEventTypes = {},
|
||||
customBubblingEventTypes$1 =
|
||||
ReactNativeViewConfigRegistry.customBubblingEventTypes,
|
||||
customDirectEventTypes$1 =
|
||||
ReactNativeViewConfigRegistry.customDirectEventTypes,
|
||||
ReactNativeBridgeEventPlugin = {
|
||||
eventTypes: {},
|
||||
eventTypes: ReactNativeViewConfigRegistry.eventTypes,
|
||||
extractEvents: function(
|
||||
topLevelType,
|
||||
targetInst,
|
||||
|
@ -847,8 +850,8 @@ var eventTypes = {
|
|||
nativeEventTarget
|
||||
) {
|
||||
if (null == targetInst) return null;
|
||||
var bubbleDispatchConfig = customBubblingEventTypes[topLevelType],
|
||||
directDispatchConfig = customDirectEventTypes[topLevelType];
|
||||
var bubbleDispatchConfig = customBubblingEventTypes$1[topLevelType],
|
||||
directDispatchConfig = customDirectEventTypes$1[topLevelType];
|
||||
invariant(
|
||||
bubbleDispatchConfig || directDispatchConfig,
|
||||
'Unsupported top level event type "%s" dispatched',
|
||||
|
@ -866,24 +869,6 @@ var eventTypes = {
|
|||
forEachAccumulated(topLevelType, accumulateDirectDispatchesSingle);
|
||||
else return null;
|
||||
return topLevelType;
|
||||
},
|
||||
processEventTypes: function(viewConfig) {
|
||||
var bubblingEventTypes = viewConfig.bubblingEventTypes;
|
||||
viewConfig = viewConfig.directEventTypes;
|
||||
if (null != bubblingEventTypes)
|
||||
for (var _topLevelType in bubblingEventTypes)
|
||||
null == customBubblingEventTypes[_topLevelType] &&
|
||||
(ReactNativeBridgeEventPlugin.eventTypes[
|
||||
_topLevelType
|
||||
] = customBubblingEventTypes[_topLevelType] =
|
||||
bubblingEventTypes[_topLevelType]);
|
||||
if (null != viewConfig)
|
||||
for (var _topLevelType2 in viewConfig)
|
||||
null == customDirectEventTypes[_topLevelType2] &&
|
||||
(ReactNativeBridgeEventPlugin.eventTypes[
|
||||
_topLevelType2
|
||||
] = customDirectEventTypes[_topLevelType2] =
|
||||
viewConfig[_topLevelType2]);
|
||||
}
|
||||
},
|
||||
instanceCache = {},
|
||||
|
@ -968,155 +953,9 @@ function createPortal(children, containerInfo, implementation) {
|
|||
implementation: implementation
|
||||
};
|
||||
}
|
||||
var restoreTarget = null,
|
||||
restoreQueue = null;
|
||||
function restoreStateOfTarget(target) {
|
||||
if ((target = getInstanceFromNode(target))) {
|
||||
invariant(
|
||||
null,
|
||||
"Fiber needs to be injected to handle a fiber target for controlled events. This error is likely caused by a bug in React. Please file an issue."
|
||||
);
|
||||
var props = getFiberCurrentPropsFromNode(target.stateNode);
|
||||
null.restoreControlledState(target.stateNode, target.type, props);
|
||||
}
|
||||
}
|
||||
function _batchedUpdates(fn, bookkeeping) {
|
||||
return fn(bookkeeping);
|
||||
}
|
||||
function _flushInteractiveUpdates() {}
|
||||
var isBatching = !1,
|
||||
TouchHistoryMath = {
|
||||
centroidDimension: function(
|
||||
touchHistory,
|
||||
touchesChangedAfter,
|
||||
isXAxis,
|
||||
ofCurrent
|
||||
) {
|
||||
var touchBank = touchHistory.touchBank,
|
||||
total = 0,
|
||||
count = 0;
|
||||
touchHistory =
|
||||
1 === touchHistory.numberActiveTouches
|
||||
? touchHistory.touchBank[touchHistory.indexOfSingleActiveTouch]
|
||||
: null;
|
||||
if (null !== touchHistory)
|
||||
touchHistory.touchActive &&
|
||||
touchHistory.currentTimeStamp > touchesChangedAfter &&
|
||||
((total +=
|
||||
ofCurrent && isXAxis
|
||||
? touchHistory.currentPageX
|
||||
: ofCurrent && !isXAxis
|
||||
? touchHistory.currentPageY
|
||||
: !ofCurrent && isXAxis
|
||||
? touchHistory.previousPageX
|
||||
: touchHistory.previousPageY),
|
||||
(count = 1));
|
||||
else
|
||||
for (
|
||||
touchHistory = 0;
|
||||
touchHistory < touchBank.length;
|
||||
touchHistory++
|
||||
) {
|
||||
var touchTrack = touchBank[touchHistory];
|
||||
null !== touchTrack &&
|
||||
void 0 !== touchTrack &&
|
||||
touchTrack.touchActive &&
|
||||
touchTrack.currentTimeStamp >= touchesChangedAfter &&
|
||||
((total +=
|
||||
ofCurrent && isXAxis
|
||||
? touchTrack.currentPageX
|
||||
: ofCurrent && !isXAxis
|
||||
? touchTrack.currentPageY
|
||||
: !ofCurrent && isXAxis
|
||||
? touchTrack.previousPageX
|
||||
: touchTrack.previousPageY),
|
||||
count++);
|
||||
}
|
||||
return 0 < count ? total / count : TouchHistoryMath.noCentroid;
|
||||
},
|
||||
currentCentroidXOfTouchesChangedAfter: function(
|
||||
touchHistory,
|
||||
touchesChangedAfter
|
||||
) {
|
||||
return TouchHistoryMath.centroidDimension(
|
||||
touchHistory,
|
||||
touchesChangedAfter,
|
||||
!0,
|
||||
!0
|
||||
);
|
||||
},
|
||||
currentCentroidYOfTouchesChangedAfter: function(
|
||||
touchHistory,
|
||||
touchesChangedAfter
|
||||
) {
|
||||
return TouchHistoryMath.centroidDimension(
|
||||
touchHistory,
|
||||
touchesChangedAfter,
|
||||
!1,
|
||||
!0
|
||||
);
|
||||
},
|
||||
previousCentroidXOfTouchesChangedAfter: function(
|
||||
touchHistory,
|
||||
touchesChangedAfter
|
||||
) {
|
||||
return TouchHistoryMath.centroidDimension(
|
||||
touchHistory,
|
||||
touchesChangedAfter,
|
||||
!0,
|
||||
!1
|
||||
);
|
||||
},
|
||||
previousCentroidYOfTouchesChangedAfter: function(
|
||||
touchHistory,
|
||||
touchesChangedAfter
|
||||
) {
|
||||
return TouchHistoryMath.centroidDimension(
|
||||
touchHistory,
|
||||
touchesChangedAfter,
|
||||
!1,
|
||||
!1
|
||||
);
|
||||
},
|
||||
currentCentroidX: function(touchHistory) {
|
||||
return TouchHistoryMath.centroidDimension(touchHistory, 0, !0, !0);
|
||||
},
|
||||
currentCentroidY: function(touchHistory) {
|
||||
return TouchHistoryMath.centroidDimension(touchHistory, 0, !1, !0);
|
||||
},
|
||||
noCentroid: -1
|
||||
},
|
||||
objects = {},
|
||||
uniqueID = 1,
|
||||
emptyObject$2 = {},
|
||||
ReactNativePropRegistry = (function() {
|
||||
function ReactNativePropRegistry() {
|
||||
if (!(this instanceof ReactNativePropRegistry))
|
||||
throw new TypeError("Cannot call a class as a function");
|
||||
}
|
||||
ReactNativePropRegistry.register = function(object) {
|
||||
var id = ++uniqueID;
|
||||
objects[id] = object;
|
||||
return id;
|
||||
};
|
||||
ReactNativePropRegistry.getByID = function(id) {
|
||||
if (!id) return emptyObject$2;
|
||||
var object = objects[id];
|
||||
return object
|
||||
? object
|
||||
: (console.warn("Invalid style with id `" + id + "`. Skipping ..."),
|
||||
emptyObject$2);
|
||||
};
|
||||
return ReactNativePropRegistry;
|
||||
})(),
|
||||
emptyObject$1 = {},
|
||||
var emptyObject$1 = {},
|
||||
removedKeys = null,
|
||||
removedKeyCount = 0;
|
||||
function resolveObject(idOrObject) {
|
||||
return "number" === typeof idOrObject
|
||||
? ReactNativePropRegistry.getByID(idOrObject)
|
||||
: idOrObject;
|
||||
}
|
||||
function restoreDeletedValuesInNestedArray(
|
||||
updatePayload,
|
||||
node,
|
||||
|
@ -1130,7 +969,7 @@ function restoreDeletedValuesInNestedArray(
|
|||
validAttributes
|
||||
);
|
||||
else if (node && 0 < removedKeyCount)
|
||||
for (i in ((node = resolveObject(node)), removedKeys))
|
||||
for (i in removedKeys)
|
||||
if (removedKeys[i]) {
|
||||
var _nextProp = node[i];
|
||||
if (void 0 !== _nextProp) {
|
||||
|
@ -1169,12 +1008,7 @@ function diffNestedProperty(
|
|||
? clearNestedProperty(updatePayload, prevProp, validAttributes)
|
||||
: updatePayload;
|
||||
if (!Array.isArray(prevProp) && !Array.isArray(nextProp))
|
||||
return diffProperties(
|
||||
updatePayload,
|
||||
resolveObject(prevProp),
|
||||
resolveObject(nextProp),
|
||||
validAttributes
|
||||
);
|
||||
return diffProperties(updatePayload, prevProp, nextProp, validAttributes);
|
||||
if (Array.isArray(prevProp) && Array.isArray(nextProp)) {
|
||||
var minLength =
|
||||
prevProp.length < nextProp.length ? prevProp.length : nextProp.length,
|
||||
|
@ -1204,12 +1038,12 @@ function diffNestedProperty(
|
|||
? diffProperties(
|
||||
updatePayload,
|
||||
flattenStyle(prevProp),
|
||||
resolveObject(nextProp),
|
||||
nextProp,
|
||||
validAttributes
|
||||
)
|
||||
: diffProperties(
|
||||
updatePayload,
|
||||
resolveObject(prevProp),
|
||||
prevProp,
|
||||
flattenStyle(nextProp),
|
||||
validAttributes
|
||||
);
|
||||
|
@ -1217,9 +1051,11 @@ function diffNestedProperty(
|
|||
function addNestedProperty(updatePayload, nextProp, validAttributes) {
|
||||
if (!nextProp) return updatePayload;
|
||||
if (!Array.isArray(nextProp))
|
||||
return (
|
||||
(nextProp = resolveObject(nextProp)),
|
||||
diffProperties(updatePayload, emptyObject$1, nextProp, validAttributes)
|
||||
return diffProperties(
|
||||
updatePayload,
|
||||
emptyObject$1,
|
||||
nextProp,
|
||||
validAttributes
|
||||
);
|
||||
for (var i = 0; i < nextProp.length; i++)
|
||||
updatePayload = addNestedProperty(
|
||||
|
@ -1232,9 +1068,11 @@ function addNestedProperty(updatePayload, nextProp, validAttributes) {
|
|||
function clearNestedProperty(updatePayload, prevProp, validAttributes) {
|
||||
if (!prevProp) return updatePayload;
|
||||
if (!Array.isArray(prevProp))
|
||||
return (
|
||||
(prevProp = resolveObject(prevProp)),
|
||||
diffProperties(updatePayload, prevProp, emptyObject$1, validAttributes)
|
||||
return diffProperties(
|
||||
updatePayload,
|
||||
prevProp,
|
||||
emptyObject$1,
|
||||
validAttributes
|
||||
);
|
||||
for (var i = 0; i < prevProp.length; i++)
|
||||
updatePayload = clearNestedProperty(
|
||||
|
@ -1347,53 +1185,6 @@ function mountSafeCallback(context, callback) {
|
|||
}
|
||||
};
|
||||
}
|
||||
var ReactCurrentOwner =
|
||||
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;
|
||||
function getComponentName(fiber) {
|
||||
fiber = fiber.type;
|
||||
if ("function" === typeof fiber) return fiber.displayName || fiber.name;
|
||||
if ("string" === typeof fiber) return fiber;
|
||||
switch (fiber) {
|
||||
case REACT_FRAGMENT_TYPE:
|
||||
return "ReactFragment";
|
||||
case REACT_PORTAL_TYPE:
|
||||
return "ReactPortal";
|
||||
case REACT_CALL_TYPE:
|
||||
return "ReactCall";
|
||||
case REACT_RETURN_TYPE:
|
||||
return "ReactReturn";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function findHostInstanceFabric() {
|
||||
return null;
|
||||
}
|
||||
function findNodeHandle(componentOrHandle) {
|
||||
if (null == componentOrHandle) return null;
|
||||
if ("number" === typeof componentOrHandle) return componentOrHandle;
|
||||
var internalInstance = componentOrHandle._reactInternalFiber;
|
||||
if (internalInstance) return findHostInstanceFabric(internalInstance);
|
||||
if (componentOrHandle) return componentOrHandle;
|
||||
invariant(
|
||||
("object" === typeof componentOrHandle &&
|
||||
"_nativeTag" in componentOrHandle) ||
|
||||
(null != componentOrHandle.render &&
|
||||
"function" === typeof componentOrHandle.render),
|
||||
"findNodeHandle(...): Argument is not a component (type: %s, keys: %s)",
|
||||
typeof componentOrHandle,
|
||||
Object.keys(componentOrHandle)
|
||||
);
|
||||
invariant(
|
||||
!1,
|
||||
"findNodeHandle(...): Unable to find node handle for unmounted component."
|
||||
);
|
||||
}
|
||||
function findNumericNodeHandleFiber(componentOrHandle) {
|
||||
componentOrHandle = findNodeHandle(componentOrHandle);
|
||||
return null == componentOrHandle || "number" === typeof componentOrHandle
|
||||
? componentOrHandle
|
||||
: componentOrHandle._nativeTag;
|
||||
}
|
||||
function _inherits(subClass, superClass) {
|
||||
if ("function" !== typeof superClass && null !== superClass)
|
||||
throw new TypeError(
|
||||
|
@ -1413,75 +1204,7 @@ function _inherits(subClass, superClass) {
|
|||
? Object.setPrototypeOf(subClass, superClass)
|
||||
: (subClass.__proto__ = superClass));
|
||||
}
|
||||
var ReactNativeComponent = (function(_React$Component) {
|
||||
function ReactNativeComponent() {
|
||||
if (!(this instanceof ReactNativeComponent))
|
||||
throw new TypeError("Cannot call a class as a function");
|
||||
var call = _React$Component.apply(this, arguments);
|
||||
if (!this)
|
||||
throw new ReferenceError(
|
||||
"this hasn't been initialised - super() hasn't been called"
|
||||
);
|
||||
return !call || ("object" !== typeof call && "function" !== typeof call)
|
||||
? this
|
||||
: call;
|
||||
}
|
||||
_inherits(ReactNativeComponent, _React$Component);
|
||||
ReactNativeComponent.prototype.blur = function() {
|
||||
TextInputState.blurTextInput(findNumericNodeHandleFiber(this));
|
||||
};
|
||||
ReactNativeComponent.prototype.focus = function() {
|
||||
TextInputState.focusTextInput(findNumericNodeHandleFiber(this));
|
||||
};
|
||||
ReactNativeComponent.prototype.measure = function(callback) {
|
||||
UIManager.measure(
|
||||
findNumericNodeHandleFiber(this),
|
||||
mountSafeCallback(this, callback)
|
||||
);
|
||||
};
|
||||
ReactNativeComponent.prototype.measureInWindow = function(callback) {
|
||||
UIManager.measureInWindow(
|
||||
findNumericNodeHandleFiber(this),
|
||||
mountSafeCallback(this, callback)
|
||||
);
|
||||
};
|
||||
ReactNativeComponent.prototype.measureLayout = function(
|
||||
relativeToNativeNode,
|
||||
onSuccess,
|
||||
onFail
|
||||
) {
|
||||
UIManager.measureLayout(
|
||||
findNumericNodeHandleFiber(this),
|
||||
relativeToNativeNode,
|
||||
mountSafeCallback(this, onFail),
|
||||
mountSafeCallback(this, onSuccess)
|
||||
);
|
||||
};
|
||||
ReactNativeComponent.prototype.setNativeProps = function(nativeProps) {
|
||||
var maybeInstance = void 0;
|
||||
try {
|
||||
maybeInstance = findNodeHandle(this);
|
||||
} catch (error) {}
|
||||
if (null != maybeInstance) {
|
||||
var viewConfig =
|
||||
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
|
||||
nativeProps = diffProperties(
|
||||
null,
|
||||
emptyObject$1,
|
||||
nativeProps,
|
||||
viewConfig.validAttributes
|
||||
);
|
||||
null != nativeProps &&
|
||||
UIManager.updateView(
|
||||
maybeInstance._nativeTag,
|
||||
viewConfig.uiViewClassName,
|
||||
nativeProps
|
||||
);
|
||||
}
|
||||
};
|
||||
return ReactNativeComponent;
|
||||
})(React.Component),
|
||||
now =
|
||||
var now =
|
||||
"object" === typeof performance && "function" === typeof performance.now
|
||||
? function() {
|
||||
return performance.now();
|
||||
|
@ -1503,8 +1226,24 @@ function setTimeoutCallback() {
|
|||
scheduledCallback = null;
|
||||
null !== callback && callback(frameDeadlineObject);
|
||||
}
|
||||
var viewConfigCallbacks = new Map(),
|
||||
viewConfigs = new Map();
|
||||
var ReactCurrentOwner =
|
||||
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;
|
||||
function getComponentName(fiber) {
|
||||
fiber = fiber.type;
|
||||
if ("function" === typeof fiber) return fiber.displayName || fiber.name;
|
||||
if ("string" === typeof fiber) return fiber;
|
||||
switch (fiber) {
|
||||
case REACT_FRAGMENT_TYPE:
|
||||
return "ReactFragment";
|
||||
case REACT_PORTAL_TYPE:
|
||||
return "ReactPortal";
|
||||
case REACT_CALL_TYPE:
|
||||
return "ReactCall";
|
||||
case REACT_RETURN_TYPE:
|
||||
return "ReactReturn";
|
||||
}
|
||||
return null;
|
||||
}
|
||||
function isFiberMountedImpl(fiber) {
|
||||
var node = fiber;
|
||||
if (fiber.alternate) for (; node["return"]; ) node = node["return"];
|
||||
|
@ -5649,10 +5388,6 @@ function ReactFiberReconciler$1(config) {
|
|||
scheduleWork(currentTime, expirationTime);
|
||||
return expirationTime;
|
||||
}
|
||||
function findHostInstance(fiber) {
|
||||
fiber = findCurrentHostFiber(fiber);
|
||||
return null === fiber ? null : fiber.stateNode;
|
||||
}
|
||||
var getPublicInstance = config.getPublicInstance;
|
||||
config = ReactFiberScheduler(config);
|
||||
var recalculateCurrentTime = config.recalculateCurrentTime,
|
||||
|
@ -5731,7 +5466,19 @@ function ReactFiberReconciler$1(config) {
|
|||
return container.child.stateNode;
|
||||
}
|
||||
},
|
||||
findHostInstance: findHostInstance,
|
||||
findHostInstance: function(component) {
|
||||
var fiber = component._reactInternalFiber;
|
||||
void 0 === fiber &&
|
||||
("function" === typeof component.render
|
||||
? invariant(!1, "Unable to find node on an unmounted component.")
|
||||
: invariant(
|
||||
!1,
|
||||
"Argument appears to not be a ReactComponent. Keys: %s",
|
||||
Object.keys(component)
|
||||
));
|
||||
component = findCurrentHostFiber(fiber);
|
||||
return null === component ? null : component.stateNode;
|
||||
},
|
||||
findHostInstanceWithNoPortals: function(fiber) {
|
||||
fiber = findCurrentHostFiberWithNoPortals(fiber);
|
||||
return null === fiber ? null : fiber.stateNode;
|
||||
|
@ -5741,7 +5488,8 @@ function ReactFiberReconciler$1(config) {
|
|||
return injectInternals(
|
||||
Object.assign({}, devToolsConfig, {
|
||||
findHostInstanceByFiber: function(fiber) {
|
||||
return findHostInstance(fiber);
|
||||
fiber = findCurrentHostFiber(fiber);
|
||||
return null === fiber ? null : fiber.stateNode;
|
||||
},
|
||||
findFiberByHostInstance: function(instance) {
|
||||
return findFiberByHostInstance
|
||||
|
@ -5760,27 +5508,7 @@ var ReactFiberReconciler$2 = Object.freeze({ default: ReactFiberReconciler$1 }),
|
|||
reactReconciler = ReactFiberReconciler$3["default"]
|
||||
? ReactFiberReconciler$3["default"]
|
||||
: ReactFiberReconciler$3,
|
||||
ReactNativeTagHandles = {
|
||||
tagsStartAt: 1,
|
||||
tagCount: 1,
|
||||
allocateTag: function() {
|
||||
for (; this.reactTagIsNativeTopRootID(ReactNativeTagHandles.tagCount); )
|
||||
ReactNativeTagHandles.tagCount++;
|
||||
var tag = ReactNativeTagHandles.tagCount;
|
||||
ReactNativeTagHandles.tagCount++;
|
||||
return tag;
|
||||
},
|
||||
assertRootTag: function(tag) {
|
||||
invariant(
|
||||
this.reactTagIsNativeTopRootID(tag),
|
||||
"Expect a native root tag, instead got %s",
|
||||
tag
|
||||
);
|
||||
},
|
||||
reactTagIsNativeTopRootID: function(reactTag) {
|
||||
return 1 === reactTag % 10;
|
||||
}
|
||||
},
|
||||
nextReactTag = 2,
|
||||
ReactFabricHostComponent = (function() {
|
||||
function ReactFabricHostComponent(tag, viewConfig, props) {
|
||||
if (!(this instanceof ReactFabricHostComponent))
|
||||
|
@ -5843,21 +5571,10 @@ var ReactFiberReconciler$2 = Object.freeze({ default: ReactFiberReconciler$1 }),
|
|||
hostContext,
|
||||
internalInstanceHandle
|
||||
) {
|
||||
hostContext = ReactNativeTagHandles.allocateTag();
|
||||
if (viewConfigs.has(type)) var viewConfig = viewConfigs.get(type);
|
||||
else
|
||||
(viewConfig = viewConfigCallbacks.get(type)),
|
||||
invariant(
|
||||
"function" === typeof viewConfig,
|
||||
"View config not found for name %s",
|
||||
type
|
||||
),
|
||||
viewConfigCallbacks.set(type, null),
|
||||
(viewConfig = viewConfig()),
|
||||
viewConfigs.set(type, viewConfig);
|
||||
invariant(viewConfig, "View config not found for name %s", type);
|
||||
type = viewConfig;
|
||||
viewConfig = diffProperties(
|
||||
hostContext = nextReactTag;
|
||||
nextReactTag += 2;
|
||||
type = ReactNativeViewConfigRegistry.get(type);
|
||||
var updatePayload = diffProperties(
|
||||
null,
|
||||
emptyObject$1,
|
||||
props,
|
||||
|
@ -5867,7 +5584,7 @@ var ReactFiberReconciler$2 = Object.freeze({ default: ReactFiberReconciler$1 }),
|
|||
hostContext,
|
||||
type.uiViewClassName,
|
||||
rootContainerInstance,
|
||||
viewConfig,
|
||||
updatePayload,
|
||||
internalInstanceHandle
|
||||
);
|
||||
props = new ReactFabricHostComponent(hostContext, type, props);
|
||||
|
@ -5879,7 +5596,8 @@ var ReactFiberReconciler$2 = Object.freeze({ default: ReactFiberReconciler$1 }),
|
|||
hostContext,
|
||||
internalInstanceHandle
|
||||
) {
|
||||
hostContext = ReactNativeTagHandles.allocateTag();
|
||||
hostContext = nextReactTag;
|
||||
nextReactTag += 2;
|
||||
return {
|
||||
node: FabricUIManager.createNode(
|
||||
hostContext,
|
||||
|
@ -5968,13 +5686,94 @@ var ReactFiberReconciler$2 = Object.freeze({ default: ReactFiberReconciler$1 }),
|
|||
getInspectorDataForViewTag = function() {
|
||||
invariant(!1, "getInspectorDataForViewTag() is not available in production");
|
||||
};
|
||||
findHostInstanceFabric = ReactFabricRenderer.findHostInstance;
|
||||
_batchedUpdates = ReactFabricRenderer.batchedUpdates;
|
||||
_flushInteractiveUpdates = ReactFabricRenderer.flushInteractiveUpdates;
|
||||
var findHostInstance = ReactFabricRenderer.findHostInstance;
|
||||
function findNodeHandle(componentOrHandle) {
|
||||
if (null == componentOrHandle) return null;
|
||||
if ("number" === typeof componentOrHandle) return componentOrHandle;
|
||||
if (componentOrHandle._nativeTag) return componentOrHandle._nativeTag;
|
||||
if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag)
|
||||
return componentOrHandle.canonical._nativeTag;
|
||||
componentOrHandle = findHostInstance(componentOrHandle);
|
||||
return null == componentOrHandle
|
||||
? componentOrHandle
|
||||
: componentOrHandle.canonical
|
||||
? componentOrHandle.canonical._nativeTag
|
||||
: componentOrHandle._nativeTag;
|
||||
}
|
||||
var roots = new Map(),
|
||||
ReactFabric = {
|
||||
NativeComponent: ReactNativeComponent,
|
||||
findNodeHandle: findNumericNodeHandleFiber,
|
||||
NativeComponent: (function(findNodeHandle, findHostInstance) {
|
||||
return (function(_React$Component) {
|
||||
function ReactNativeComponent() {
|
||||
if (!(this instanceof ReactNativeComponent))
|
||||
throw new TypeError("Cannot call a class as a function");
|
||||
var call = _React$Component.apply(this, arguments);
|
||||
if (!this)
|
||||
throw new ReferenceError(
|
||||
"this hasn't been initialised - super() hasn't been called"
|
||||
);
|
||||
return !call ||
|
||||
("object" !== typeof call && "function" !== typeof call)
|
||||
? this
|
||||
: call;
|
||||
}
|
||||
_inherits(ReactNativeComponent, _React$Component);
|
||||
ReactNativeComponent.prototype.blur = function() {
|
||||
TextInputState.blurTextInput(findNodeHandle(this));
|
||||
};
|
||||
ReactNativeComponent.prototype.focus = function() {
|
||||
TextInputState.focusTextInput(findNodeHandle(this));
|
||||
};
|
||||
ReactNativeComponent.prototype.measure = function(callback) {
|
||||
UIManager.measure(
|
||||
findNodeHandle(this),
|
||||
mountSafeCallback(this, callback)
|
||||
);
|
||||
};
|
||||
ReactNativeComponent.prototype.measureInWindow = function(callback) {
|
||||
UIManager.measureInWindow(
|
||||
findNodeHandle(this),
|
||||
mountSafeCallback(this, callback)
|
||||
);
|
||||
};
|
||||
ReactNativeComponent.prototype.measureLayout = function(
|
||||
relativeToNativeNode,
|
||||
onSuccess,
|
||||
onFail
|
||||
) {
|
||||
UIManager.measureLayout(
|
||||
findNodeHandle(this),
|
||||
relativeToNativeNode,
|
||||
mountSafeCallback(this, onFail),
|
||||
mountSafeCallback(this, onSuccess)
|
||||
);
|
||||
};
|
||||
ReactNativeComponent.prototype.setNativeProps = function(nativeProps) {
|
||||
var maybeInstance = void 0;
|
||||
try {
|
||||
maybeInstance = findHostInstance(this);
|
||||
} catch (error) {}
|
||||
if (null != maybeInstance) {
|
||||
var viewConfig =
|
||||
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
|
||||
nativeProps = diffProperties(
|
||||
null,
|
||||
emptyObject$1,
|
||||
nativeProps,
|
||||
viewConfig.validAttributes
|
||||
);
|
||||
null != nativeProps &&
|
||||
UIManager.updateView(
|
||||
maybeInstance._nativeTag,
|
||||
viewConfig.uiViewClassName,
|
||||
nativeProps
|
||||
);
|
||||
}
|
||||
};
|
||||
return ReactNativeComponent;
|
||||
})(React.Component);
|
||||
})(findNodeHandle, findHostInstance),
|
||||
findNodeHandle: findNodeHandle,
|
||||
render: function(element, containerTag, callback) {
|
||||
var root = roots.get(containerTag);
|
||||
root ||
|
||||
|
@ -5990,9 +5789,6 @@ var roots = new Map(),
|
|||
roots["delete"](containerTag);
|
||||
});
|
||||
},
|
||||
unmountComponentAtNodeAndRemoveContainer: function(containerTag) {
|
||||
ReactFabric.unmountComponentAtNode(containerTag);
|
||||
},
|
||||
createPortal: function(children, containerTag) {
|
||||
return createPortal(
|
||||
children,
|
||||
|
@ -6001,46 +5797,24 @@ var roots = new Map(),
|
|||
2 < arguments.length && void 0 !== arguments[2] ? arguments[2] : null
|
||||
);
|
||||
},
|
||||
unstable_batchedUpdates: function(fn, bookkeeping) {
|
||||
if (isBatching) return fn(bookkeeping);
|
||||
isBatching = !0;
|
||||
try {
|
||||
return _batchedUpdates(fn, bookkeeping);
|
||||
} finally {
|
||||
if (
|
||||
((isBatching = !1), null !== restoreTarget || null !== restoreQueue)
|
||||
)
|
||||
if (
|
||||
(_flushInteractiveUpdates(),
|
||||
restoreTarget &&
|
||||
((bookkeeping = restoreTarget),
|
||||
(fn = restoreQueue),
|
||||
(restoreQueue = restoreTarget = null),
|
||||
restoreStateOfTarget(bookkeeping),
|
||||
fn))
|
||||
)
|
||||
for (bookkeeping = 0; bookkeeping < fn.length; bookkeeping++)
|
||||
restoreStateOfTarget(fn[bookkeeping]);
|
||||
}
|
||||
},
|
||||
flushSync: ReactFabricRenderer.flushSync,
|
||||
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
||||
NativeMethodsMixin: {
|
||||
NativeMethodsMixin: (function(findNodeHandle, findHostInstance) {
|
||||
return {
|
||||
measure: function(callback) {
|
||||
UIManager.measure(
|
||||
findNumericNodeHandleFiber(this),
|
||||
findNodeHandle(this),
|
||||
mountSafeCallback(this, callback)
|
||||
);
|
||||
},
|
||||
measureInWindow: function(callback) {
|
||||
UIManager.measureInWindow(
|
||||
findNumericNodeHandleFiber(this),
|
||||
findNodeHandle(this),
|
||||
mountSafeCallback(this, callback)
|
||||
);
|
||||
},
|
||||
measureLayout: function(relativeToNativeNode, onSuccess, onFail) {
|
||||
UIManager.measureLayout(
|
||||
findNumericNodeHandleFiber(this),
|
||||
findNodeHandle(this),
|
||||
relativeToNativeNode,
|
||||
mountSafeCallback(this, onFail),
|
||||
mountSafeCallback(this, onSuccess)
|
||||
|
@ -6049,7 +5823,7 @@ var roots = new Map(),
|
|||
setNativeProps: function(nativeProps) {
|
||||
var maybeInstance = void 0;
|
||||
try {
|
||||
maybeInstance = findNodeHandle(this);
|
||||
maybeInstance = findHostInstance(this);
|
||||
} catch (error) {}
|
||||
if (null != maybeInstance) {
|
||||
var viewConfig = maybeInstance.viewConfig;
|
||||
|
@ -6068,31 +5842,14 @@ var roots = new Map(),
|
|||
}
|
||||
},
|
||||
focus: function() {
|
||||
TextInputState.focusTextInput(findNumericNodeHandleFiber(this));
|
||||
TextInputState.focusTextInput(findNodeHandle(this));
|
||||
},
|
||||
blur: function() {
|
||||
TextInputState.blurTextInput(findNumericNodeHandleFiber(this));
|
||||
}
|
||||
},
|
||||
ReactNativeBridgeEventPlugin: ReactNativeBridgeEventPlugin,
|
||||
ReactNativeComponentTree: ReactNativeComponentTree,
|
||||
ReactNativePropRegistry: ReactNativePropRegistry,
|
||||
TouchHistoryMath: TouchHistoryMath,
|
||||
createReactNativeComponentClass: function(name, callback) {
|
||||
invariant(
|
||||
!viewConfigCallbacks.has(name),
|
||||
"Tried to register two views with the same name %s",
|
||||
name
|
||||
);
|
||||
viewConfigCallbacks.set(name, callback);
|
||||
return name;
|
||||
},
|
||||
takeSnapshot: function(view, options) {
|
||||
"number" !== typeof view &&
|
||||
"window" !== view &&
|
||||
(view = findNumericNodeHandleFiber(view) || "window");
|
||||
return UIManager.__takeSnapshot(view, options);
|
||||
TextInputState.blurTextInput(findNodeHandle(this));
|
||||
}
|
||||
};
|
||||
})(findNodeHandle, findHostInstance),
|
||||
ReactNativeComponentTree: ReactNativeComponentTree
|
||||
}
|
||||
};
|
||||
ReactFabricRenderer.injectIntoDevTools({
|
||||
|
|
Разница между файлами не показана из-за своего большого размера
Загрузить разницу
|
@ -13,6 +13,7 @@
|
|||
require("InitializeCore");
|
||||
var invariant = require("fbjs/lib/invariant"),
|
||||
emptyFunction = require("fbjs/lib/emptyFunction"),
|
||||
ReactNativeViewConfigRegistry = require("ReactNativeViewConfigRegistry"),
|
||||
UIManager = require("UIManager"),
|
||||
RCTEventEmitter = require("RCTEventEmitter"),
|
||||
TextInputState = require("TextInputState"),
|
||||
|
@ -624,7 +625,7 @@ function changeResponder(nextResponderInst, blockHostResponder) {
|
|||
blockHostResponder
|
||||
);
|
||||
}
|
||||
var eventTypes = {
|
||||
var eventTypes$1 = {
|
||||
startShouldSetResponder: {
|
||||
phasedRegistrationNames: {
|
||||
bubbled: "onStartShouldSetResponder",
|
||||
|
@ -664,7 +665,7 @@ var eventTypes = {
|
|||
_getResponder: function() {
|
||||
return responderInst;
|
||||
},
|
||||
eventTypes: eventTypes,
|
||||
eventTypes: eventTypes$1,
|
||||
extractEvents: function(
|
||||
topLevelType,
|
||||
targetInst,
|
||||
|
@ -690,12 +691,12 @@ var eventTypes = {
|
|||
isMoveish(topLevelType))
|
||||
) {
|
||||
var JSCompiler_temp = isStartish(topLevelType)
|
||||
? eventTypes.startShouldSetResponder
|
||||
? eventTypes$1.startShouldSetResponder
|
||||
: isMoveish(topLevelType)
|
||||
? eventTypes.moveShouldSetResponder
|
||||
? eventTypes$1.moveShouldSetResponder
|
||||
: "topSelectionChange" === topLevelType
|
||||
? eventTypes.selectionChangeShouldSetResponder
|
||||
: eventTypes.scrollShouldSetResponder;
|
||||
? eventTypes$1.selectionChangeShouldSetResponder
|
||||
: eventTypes$1.scrollShouldSetResponder;
|
||||
if (responderInst)
|
||||
b: {
|
||||
var JSCompiler_temp$jscomp$0 = responderInst;
|
||||
|
@ -781,7 +782,7 @@ var eventTypes = {
|
|||
JSCompiler_temp && JSCompiler_temp !== responderInst
|
||||
? ((JSCompiler_temp$jscomp$0 = void 0),
|
||||
(targetInst = ResponderSyntheticEvent.getPooled(
|
||||
eventTypes.responderGrant,
|
||||
eventTypes$1.responderGrant,
|
||||
JSCompiler_temp,
|
||||
nativeEvent,
|
||||
nativeEventTarget
|
||||
|
@ -791,7 +792,7 @@ var eventTypes = {
|
|||
(depthA = !0 === executeDirectDispatch(targetInst)),
|
||||
responderInst
|
||||
? ((tempA = ResponderSyntheticEvent.getPooled(
|
||||
eventTypes.responderTerminationRequest,
|
||||
eventTypes$1.responderTerminationRequest,
|
||||
responderInst,
|
||||
nativeEvent,
|
||||
nativeEventTarget
|
||||
|
@ -803,7 +804,7 @@ var eventTypes = {
|
|||
tempA.isPersistent() || tempA.constructor.release(tempA),
|
||||
tempB
|
||||
? ((tempA = ResponderSyntheticEvent.getPooled(
|
||||
eventTypes.responderTerminate,
|
||||
eventTypes$1.responderTerminate,
|
||||
responderInst,
|
||||
nativeEvent,
|
||||
nativeEventTarget
|
||||
|
@ -817,7 +818,7 @@ var eventTypes = {
|
|||
)),
|
||||
changeResponder(JSCompiler_temp, depthA))
|
||||
: ((JSCompiler_temp = ResponderSyntheticEvent.getPooled(
|
||||
eventTypes.responderReject,
|
||||
eventTypes$1.responderReject,
|
||||
JSCompiler_temp,
|
||||
nativeEvent,
|
||||
nativeEventTarget
|
||||
|
@ -845,10 +846,10 @@ var eventTypes = {
|
|||
depthA = responderInst && isEndish(topLevelType);
|
||||
if (
|
||||
(JSCompiler_temp$jscomp$0 = JSCompiler_temp$jscomp$0
|
||||
? eventTypes.responderStart
|
||||
? eventTypes$1.responderStart
|
||||
: targetInst
|
||||
? eventTypes.responderMove
|
||||
: depthA ? eventTypes.responderEnd : null)
|
||||
? eventTypes$1.responderMove
|
||||
: depthA ? eventTypes$1.responderEnd : null)
|
||||
)
|
||||
(JSCompiler_temp$jscomp$0 = ResponderSyntheticEvent.getPooled(
|
||||
JSCompiler_temp$jscomp$0,
|
||||
|
@ -899,8 +900,8 @@ var eventTypes = {
|
|||
}
|
||||
if (
|
||||
(topLevelType = JSCompiler_temp$jscomp$0
|
||||
? eventTypes.responderTerminate
|
||||
: topLevelType ? eventTypes.responderRelease : null)
|
||||
? eventTypes$1.responderTerminate
|
||||
: topLevelType ? eventTypes$1.responderRelease : null)
|
||||
)
|
||||
(nativeEvent = ResponderSyntheticEvent.getPooled(
|
||||
topLevelType,
|
||||
|
@ -932,10 +933,12 @@ var eventTypes = {
|
|||
}
|
||||
}
|
||||
},
|
||||
customBubblingEventTypes = {},
|
||||
customDirectEventTypes = {},
|
||||
customBubblingEventTypes$1 =
|
||||
ReactNativeViewConfigRegistry.customBubblingEventTypes,
|
||||
customDirectEventTypes$1 =
|
||||
ReactNativeViewConfigRegistry.customDirectEventTypes,
|
||||
ReactNativeBridgeEventPlugin = {
|
||||
eventTypes: {},
|
||||
eventTypes: ReactNativeViewConfigRegistry.eventTypes,
|
||||
extractEvents: function(
|
||||
topLevelType,
|
||||
targetInst,
|
||||
|
@ -943,8 +946,8 @@ var eventTypes = {
|
|||
nativeEventTarget
|
||||
) {
|
||||
if (null == targetInst) return null;
|
||||
var bubbleDispatchConfig = customBubblingEventTypes[topLevelType],
|
||||
directDispatchConfig = customDirectEventTypes[topLevelType];
|
||||
var bubbleDispatchConfig = customBubblingEventTypes$1[topLevelType],
|
||||
directDispatchConfig = customDirectEventTypes$1[topLevelType];
|
||||
invariant(
|
||||
bubbleDispatchConfig || directDispatchConfig,
|
||||
'Unsupported top level event type "%s" dispatched',
|
||||
|
@ -962,24 +965,6 @@ var eventTypes = {
|
|||
forEachAccumulated(topLevelType, accumulateDirectDispatchesSingle);
|
||||
else return null;
|
||||
return topLevelType;
|
||||
},
|
||||
processEventTypes: function(viewConfig) {
|
||||
var bubblingEventTypes = viewConfig.bubblingEventTypes;
|
||||
viewConfig = viewConfig.directEventTypes;
|
||||
if (null != bubblingEventTypes)
|
||||
for (var _topLevelType in bubblingEventTypes)
|
||||
null == customBubblingEventTypes[_topLevelType] &&
|
||||
(ReactNativeBridgeEventPlugin.eventTypes[
|
||||
_topLevelType
|
||||
] = customBubblingEventTypes[_topLevelType] =
|
||||
bubblingEventTypes[_topLevelType]);
|
||||
if (null != viewConfig)
|
||||
for (var _topLevelType2 in viewConfig)
|
||||
null == customDirectEventTypes[_topLevelType2] &&
|
||||
(ReactNativeBridgeEventPlugin.eventTypes[
|
||||
_topLevelType2
|
||||
] = customDirectEventTypes[_topLevelType2] =
|
||||
viewConfig[_topLevelType2]);
|
||||
}
|
||||
},
|
||||
instanceCache = {},
|
||||
|
@ -1067,28 +1052,7 @@ function batchedUpdates(fn, bookkeeping) {
|
|||
restoreStateOfTarget(fn[bookkeeping]);
|
||||
}
|
||||
}
|
||||
var ReactNativeTagHandles = {
|
||||
tagsStartAt: 1,
|
||||
tagCount: 1,
|
||||
allocateTag: function() {
|
||||
for (; this.reactTagIsNativeTopRootID(ReactNativeTagHandles.tagCount); )
|
||||
ReactNativeTagHandles.tagCount++;
|
||||
var tag = ReactNativeTagHandles.tagCount;
|
||||
ReactNativeTagHandles.tagCount++;
|
||||
return tag;
|
||||
},
|
||||
assertRootTag: function(tag) {
|
||||
invariant(
|
||||
this.reactTagIsNativeTopRootID(tag),
|
||||
"Expect a native root tag, instead got %s",
|
||||
tag
|
||||
);
|
||||
},
|
||||
reactTagIsNativeTopRootID: function(reactTag) {
|
||||
return 1 === reactTag % 10;
|
||||
}
|
||||
},
|
||||
EMPTY_NATIVE_EVENT = {};
|
||||
var EMPTY_NATIVE_EVENT = {};
|
||||
function _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam) {
|
||||
var nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT,
|
||||
inst = getInstanceFromTag(rootNodeID);
|
||||
|
@ -1153,10 +1117,7 @@ var ReactNativeEventEmitter = Object.freeze({
|
|||
i.touches = touches;
|
||||
index = null;
|
||||
var target = i.target;
|
||||
null === target ||
|
||||
void 0 === target ||
|
||||
target < ReactNativeTagHandles.tagsStartAt ||
|
||||
(index = target);
|
||||
null === target || void 0 === target || 1 > target || (index = target);
|
||||
_receiveRootNodeIDEvent(index, eventTopLevelType, i);
|
||||
}
|
||||
}
|
||||
|
@ -1197,103 +1158,6 @@ function createPortal(children, containerInfo, implementation) {
|
|||
implementation: implementation
|
||||
};
|
||||
}
|
||||
var TouchHistoryMath = {
|
||||
centroidDimension: function(
|
||||
touchHistory,
|
||||
touchesChangedAfter,
|
||||
isXAxis,
|
||||
ofCurrent
|
||||
) {
|
||||
var touchBank = touchHistory.touchBank,
|
||||
total = 0,
|
||||
count = 0;
|
||||
touchHistory =
|
||||
1 === touchHistory.numberActiveTouches
|
||||
? touchHistory.touchBank[touchHistory.indexOfSingleActiveTouch]
|
||||
: null;
|
||||
if (null !== touchHistory)
|
||||
touchHistory.touchActive &&
|
||||
touchHistory.currentTimeStamp > touchesChangedAfter &&
|
||||
((total +=
|
||||
ofCurrent && isXAxis
|
||||
? touchHistory.currentPageX
|
||||
: ofCurrent && !isXAxis
|
||||
? touchHistory.currentPageY
|
||||
: !ofCurrent && isXAxis
|
||||
? touchHistory.previousPageX
|
||||
: touchHistory.previousPageY),
|
||||
(count = 1));
|
||||
else
|
||||
for (touchHistory = 0; touchHistory < touchBank.length; touchHistory++) {
|
||||
var touchTrack = touchBank[touchHistory];
|
||||
null !== touchTrack &&
|
||||
void 0 !== touchTrack &&
|
||||
touchTrack.touchActive &&
|
||||
touchTrack.currentTimeStamp >= touchesChangedAfter &&
|
||||
((total +=
|
||||
ofCurrent && isXAxis
|
||||
? touchTrack.currentPageX
|
||||
: ofCurrent && !isXAxis
|
||||
? touchTrack.currentPageY
|
||||
: !ofCurrent && isXAxis
|
||||
? touchTrack.previousPageX
|
||||
: touchTrack.previousPageY),
|
||||
count++);
|
||||
}
|
||||
return 0 < count ? total / count : TouchHistoryMath.noCentroid;
|
||||
},
|
||||
currentCentroidXOfTouchesChangedAfter: function(
|
||||
touchHistory,
|
||||
touchesChangedAfter
|
||||
) {
|
||||
return TouchHistoryMath.centroidDimension(
|
||||
touchHistory,
|
||||
touchesChangedAfter,
|
||||
!0,
|
||||
!0
|
||||
);
|
||||
},
|
||||
currentCentroidYOfTouchesChangedAfter: function(
|
||||
touchHistory,
|
||||
touchesChangedAfter
|
||||
) {
|
||||
return TouchHistoryMath.centroidDimension(
|
||||
touchHistory,
|
||||
touchesChangedAfter,
|
||||
!1,
|
||||
!0
|
||||
);
|
||||
},
|
||||
previousCentroidXOfTouchesChangedAfter: function(
|
||||
touchHistory,
|
||||
touchesChangedAfter
|
||||
) {
|
||||
return TouchHistoryMath.centroidDimension(
|
||||
touchHistory,
|
||||
touchesChangedAfter,
|
||||
!0,
|
||||
!1
|
||||
);
|
||||
},
|
||||
previousCentroidYOfTouchesChangedAfter: function(
|
||||
touchHistory,
|
||||
touchesChangedAfter
|
||||
) {
|
||||
return TouchHistoryMath.centroidDimension(
|
||||
touchHistory,
|
||||
touchesChangedAfter,
|
||||
!1,
|
||||
!1
|
||||
);
|
||||
},
|
||||
currentCentroidX: function(touchHistory) {
|
||||
return TouchHistoryMath.centroidDimension(touchHistory, 0, !0, !0);
|
||||
},
|
||||
currentCentroidY: function(touchHistory) {
|
||||
return TouchHistoryMath.centroidDimension(touchHistory, 0, !1, !0);
|
||||
},
|
||||
noCentroid: -1
|
||||
};
|
||||
function getComponentName(fiber) {
|
||||
fiber = fiber.type;
|
||||
if ("function" === typeof fiber) return fiber.displayName || fiber.name;
|
||||
|
@ -1343,37 +1207,9 @@ function getStackAddendumByWorkInProgressFiber(workInProgress) {
|
|||
} while (workInProgress);
|
||||
return info;
|
||||
}
|
||||
var objects = {},
|
||||
uniqueID = 1,
|
||||
emptyObject$2 = {},
|
||||
ReactNativePropRegistry = (function() {
|
||||
function ReactNativePropRegistry() {
|
||||
if (!(this instanceof ReactNativePropRegistry))
|
||||
throw new TypeError("Cannot call a class as a function");
|
||||
}
|
||||
ReactNativePropRegistry.register = function(object) {
|
||||
var id = ++uniqueID;
|
||||
objects[id] = object;
|
||||
return id;
|
||||
};
|
||||
ReactNativePropRegistry.getByID = function(id) {
|
||||
if (!id) return emptyObject$2;
|
||||
var object = objects[id];
|
||||
return object
|
||||
? object
|
||||
: (console.warn("Invalid style with id `" + id + "`. Skipping ..."),
|
||||
emptyObject$2);
|
||||
};
|
||||
return ReactNativePropRegistry;
|
||||
})(),
|
||||
emptyObject$1 = {},
|
||||
var emptyObject$1 = {},
|
||||
removedKeys = null,
|
||||
removedKeyCount = 0;
|
||||
function resolveObject(idOrObject) {
|
||||
return "number" === typeof idOrObject
|
||||
? ReactNativePropRegistry.getByID(idOrObject)
|
||||
: idOrObject;
|
||||
}
|
||||
function restoreDeletedValuesInNestedArray(
|
||||
updatePayload,
|
||||
node,
|
||||
|
@ -1387,7 +1223,7 @@ function restoreDeletedValuesInNestedArray(
|
|||
validAttributes
|
||||
);
|
||||
else if (node && 0 < removedKeyCount)
|
||||
for (i in ((node = resolveObject(node)), removedKeys))
|
||||
for (i in removedKeys)
|
||||
if (removedKeys[i]) {
|
||||
var _nextProp = node[i];
|
||||
if (void 0 !== _nextProp) {
|
||||
|
@ -1426,12 +1262,7 @@ function diffNestedProperty(
|
|||
? clearNestedProperty(updatePayload, prevProp, validAttributes)
|
||||
: updatePayload;
|
||||
if (!Array.isArray(prevProp) && !Array.isArray(nextProp))
|
||||
return diffProperties(
|
||||
updatePayload,
|
||||
resolveObject(prevProp),
|
||||
resolveObject(nextProp),
|
||||
validAttributes
|
||||
);
|
||||
return diffProperties(updatePayload, prevProp, nextProp, validAttributes);
|
||||
if (Array.isArray(prevProp) && Array.isArray(nextProp)) {
|
||||
var minLength =
|
||||
prevProp.length < nextProp.length ? prevProp.length : nextProp.length,
|
||||
|
@ -1461,12 +1292,12 @@ function diffNestedProperty(
|
|||
? diffProperties(
|
||||
updatePayload,
|
||||
flattenStyle(prevProp),
|
||||
resolveObject(nextProp),
|
||||
nextProp,
|
||||
validAttributes
|
||||
)
|
||||
: diffProperties(
|
||||
updatePayload,
|
||||
resolveObject(prevProp),
|
||||
prevProp,
|
||||
flattenStyle(nextProp),
|
||||
validAttributes
|
||||
);
|
||||
|
@ -1474,9 +1305,11 @@ function diffNestedProperty(
|
|||
function addNestedProperty(updatePayload, nextProp, validAttributes) {
|
||||
if (!nextProp) return updatePayload;
|
||||
if (!Array.isArray(nextProp))
|
||||
return (
|
||||
(nextProp = resolveObject(nextProp)),
|
||||
diffProperties(updatePayload, emptyObject$1, nextProp, validAttributes)
|
||||
return diffProperties(
|
||||
updatePayload,
|
||||
emptyObject$1,
|
||||
nextProp,
|
||||
validAttributes
|
||||
);
|
||||
for (var i = 0; i < nextProp.length; i++)
|
||||
updatePayload = addNestedProperty(
|
||||
|
@ -1489,9 +1322,11 @@ function addNestedProperty(updatePayload, nextProp, validAttributes) {
|
|||
function clearNestedProperty(updatePayload, prevProp, validAttributes) {
|
||||
if (!prevProp) return updatePayload;
|
||||
if (!Array.isArray(prevProp))
|
||||
return (
|
||||
(prevProp = resolveObject(prevProp)),
|
||||
diffProperties(updatePayload, prevProp, emptyObject$1, validAttributes)
|
||||
return diffProperties(
|
||||
updatePayload,
|
||||
prevProp,
|
||||
emptyObject$1,
|
||||
validAttributes
|
||||
);
|
||||
for (var i = 0; i < prevProp.length; i++)
|
||||
updatePayload = clearNestedProperty(
|
||||
|
@ -1604,37 +1439,6 @@ function mountSafeCallback(context, callback) {
|
|||
}
|
||||
};
|
||||
}
|
||||
var ReactCurrentOwner =
|
||||
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;
|
||||
function findHostInstance() {
|
||||
return null;
|
||||
}
|
||||
function findNodeHandle(componentOrHandle) {
|
||||
if (null == componentOrHandle) return null;
|
||||
if ("number" === typeof componentOrHandle) return componentOrHandle;
|
||||
var internalInstance = componentOrHandle._reactInternalFiber;
|
||||
if (internalInstance) return findHostInstance(internalInstance) || null;
|
||||
if (componentOrHandle) return componentOrHandle;
|
||||
invariant(
|
||||
("object" === typeof componentOrHandle &&
|
||||
"_nativeTag" in componentOrHandle) ||
|
||||
(null != componentOrHandle.render &&
|
||||
"function" === typeof componentOrHandle.render),
|
||||
"findNodeHandle(...): Argument is not a component (type: %s, keys: %s)",
|
||||
typeof componentOrHandle,
|
||||
Object.keys(componentOrHandle)
|
||||
);
|
||||
invariant(
|
||||
!1,
|
||||
"findNodeHandle(...): Unable to find node handle for unmounted component."
|
||||
);
|
||||
}
|
||||
function findNumericNodeHandleFiber(componentOrHandle) {
|
||||
componentOrHandle = findNodeHandle(componentOrHandle);
|
||||
return null == componentOrHandle || "number" === typeof componentOrHandle
|
||||
? componentOrHandle
|
||||
: componentOrHandle._nativeTag;
|
||||
}
|
||||
function _inherits(subClass, superClass) {
|
||||
if ("function" !== typeof superClass && null !== superClass)
|
||||
throw new TypeError(
|
||||
|
@ -1654,74 +1458,8 @@ function _inherits(subClass, superClass) {
|
|||
? Object.setPrototypeOf(subClass, superClass)
|
||||
: (subClass.__proto__ = superClass));
|
||||
}
|
||||
var ReactNativeComponent = (function(_React$Component) {
|
||||
function ReactNativeComponent() {
|
||||
if (!(this instanceof ReactNativeComponent))
|
||||
throw new TypeError("Cannot call a class as a function");
|
||||
var call = _React$Component.apply(this, arguments);
|
||||
if (!this)
|
||||
throw new ReferenceError(
|
||||
"this hasn't been initialised - super() hasn't been called"
|
||||
);
|
||||
return !call || ("object" !== typeof call && "function" !== typeof call)
|
||||
? this
|
||||
: call;
|
||||
}
|
||||
_inherits(ReactNativeComponent, _React$Component);
|
||||
ReactNativeComponent.prototype.blur = function() {
|
||||
TextInputState.blurTextInput(findNumericNodeHandleFiber(this));
|
||||
};
|
||||
ReactNativeComponent.prototype.focus = function() {
|
||||
TextInputState.focusTextInput(findNumericNodeHandleFiber(this));
|
||||
};
|
||||
ReactNativeComponent.prototype.measure = function(callback) {
|
||||
UIManager.measure(
|
||||
findNumericNodeHandleFiber(this),
|
||||
mountSafeCallback(this, callback)
|
||||
);
|
||||
};
|
||||
ReactNativeComponent.prototype.measureInWindow = function(callback) {
|
||||
UIManager.measureInWindow(
|
||||
findNumericNodeHandleFiber(this),
|
||||
mountSafeCallback(this, callback)
|
||||
);
|
||||
};
|
||||
ReactNativeComponent.prototype.measureLayout = function(
|
||||
relativeToNativeNode,
|
||||
onSuccess,
|
||||
onFail
|
||||
) {
|
||||
UIManager.measureLayout(
|
||||
findNumericNodeHandleFiber(this),
|
||||
relativeToNativeNode,
|
||||
mountSafeCallback(this, onFail),
|
||||
mountSafeCallback(this, onSuccess)
|
||||
);
|
||||
};
|
||||
ReactNativeComponent.prototype.setNativeProps = function(nativeProps) {
|
||||
var maybeInstance = void 0;
|
||||
try {
|
||||
maybeInstance = findNodeHandle(this);
|
||||
} catch (error) {}
|
||||
if (null != maybeInstance) {
|
||||
var viewConfig =
|
||||
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
|
||||
nativeProps = diffProperties(
|
||||
null,
|
||||
emptyObject$1,
|
||||
nativeProps,
|
||||
viewConfig.validAttributes
|
||||
);
|
||||
null != nativeProps &&
|
||||
UIManager.updateView(
|
||||
maybeInstance._nativeTag,
|
||||
viewConfig.uiViewClassName,
|
||||
nativeProps
|
||||
);
|
||||
}
|
||||
};
|
||||
return ReactNativeComponent;
|
||||
})(React.Component);
|
||||
var ReactCurrentOwner =
|
||||
React.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner;
|
||||
function isFiberMountedImpl(fiber) {
|
||||
var node = fiber;
|
||||
if (fiber.alternate) for (; node["return"]; ) node = node["return"];
|
||||
|
@ -6048,10 +5786,6 @@ function ReactFiberReconciler$1(config) {
|
|||
scheduleWork(currentTime, expirationTime);
|
||||
return expirationTime;
|
||||
}
|
||||
function findHostInstance(fiber) {
|
||||
fiber = findCurrentHostFiber(fiber);
|
||||
return null === fiber ? null : fiber.stateNode;
|
||||
}
|
||||
var getPublicInstance = config.getPublicInstance;
|
||||
config = ReactFiberScheduler(config);
|
||||
var recalculateCurrentTime = config.recalculateCurrentTime,
|
||||
|
@ -6130,7 +5864,19 @@ function ReactFiberReconciler$1(config) {
|
|||
return container.child.stateNode;
|
||||
}
|
||||
},
|
||||
findHostInstance: findHostInstance,
|
||||
findHostInstance: function(component) {
|
||||
var fiber = component._reactInternalFiber;
|
||||
void 0 === fiber &&
|
||||
("function" === typeof component.render
|
||||
? invariant(!1, "Unable to find node on an unmounted component.")
|
||||
: invariant(
|
||||
!1,
|
||||
"Argument appears to not be a ReactComponent. Keys: %s",
|
||||
Object.keys(component)
|
||||
));
|
||||
component = findCurrentHostFiber(fiber);
|
||||
return null === component ? null : component.stateNode;
|
||||
},
|
||||
findHostInstanceWithNoPortals: function(fiber) {
|
||||
fiber = findCurrentHostFiberWithNoPortals(fiber);
|
||||
return null === fiber ? null : fiber.stateNode;
|
||||
|
@ -6140,7 +5886,8 @@ function ReactFiberReconciler$1(config) {
|
|||
return injectInternals(
|
||||
Object.assign({}, devToolsConfig, {
|
||||
findHostInstanceByFiber: function(fiber) {
|
||||
return findHostInstance(fiber);
|
||||
fiber = findCurrentHostFiber(fiber);
|
||||
return null === fiber ? null : fiber.stateNode;
|
||||
},
|
||||
findFiberByHostInstance: function(instance) {
|
||||
return findFiberByHostInstance
|
||||
|
@ -6159,8 +5906,6 @@ var ReactFiberReconciler$2 = Object.freeze({ default: ReactFiberReconciler$1 }),
|
|||
reactReconciler = ReactFiberReconciler$3["default"]
|
||||
? ReactFiberReconciler$3["default"]
|
||||
: ReactFiberReconciler$3,
|
||||
viewConfigCallbacks = new Map(),
|
||||
viewConfigs = new Map(),
|
||||
ReactNativeFiberHostComponent = (function() {
|
||||
function ReactNativeFiberHostComponent(tag, viewConfig) {
|
||||
if (!(this instanceof ReactNativeFiberHostComponent))
|
||||
|
@ -6238,6 +5983,13 @@ function setTimeoutCallback() {
|
|||
scheduledCallback = null;
|
||||
null !== callback && callback(frameDeadlineObject);
|
||||
}
|
||||
var nextReactTag = 3;
|
||||
function allocateTag() {
|
||||
var tag = nextReactTag;
|
||||
1 === tag % 10 && (tag += 2);
|
||||
nextReactTag = tag + 2;
|
||||
return tag;
|
||||
}
|
||||
function recursivelyUncacheFiberNode(node) {
|
||||
"number" === typeof node
|
||||
? uncacheFiberNode(node)
|
||||
|
@ -6255,21 +6007,9 @@ var NativeRenderer = reactReconciler({
|
|||
hostContext,
|
||||
internalInstanceHandle
|
||||
) {
|
||||
hostContext = ReactNativeTagHandles.allocateTag();
|
||||
if (viewConfigs.has(type)) var viewConfig = viewConfigs.get(type);
|
||||
else
|
||||
(viewConfig = viewConfigCallbacks.get(type)),
|
||||
invariant(
|
||||
"function" === typeof viewConfig,
|
||||
"View config not found for name %s",
|
||||
type
|
||||
),
|
||||
viewConfigCallbacks.set(type, null),
|
||||
(viewConfig = viewConfig()),
|
||||
viewConfigs.set(type, viewConfig);
|
||||
invariant(viewConfig, "View config not found for name %s", type);
|
||||
type = viewConfig;
|
||||
viewConfig = diffProperties(
|
||||
hostContext = allocateTag();
|
||||
type = ReactNativeViewConfigRegistry.get(type);
|
||||
var updatePayload = diffProperties(
|
||||
null,
|
||||
emptyObject$1,
|
||||
props,
|
||||
|
@ -6279,7 +6019,7 @@ var NativeRenderer = reactReconciler({
|
|||
hostContext,
|
||||
type.uiViewClassName,
|
||||
rootContainerInstance,
|
||||
viewConfig
|
||||
updatePayload
|
||||
);
|
||||
rootContainerInstance = new ReactNativeFiberHostComponent(
|
||||
hostContext,
|
||||
|
@ -6295,7 +6035,7 @@ var NativeRenderer = reactReconciler({
|
|||
hostContext,
|
||||
internalInstanceHandle
|
||||
) {
|
||||
hostContext = ReactNativeTagHandles.allocateTag();
|
||||
hostContext = allocateTag();
|
||||
UIManager.createView(hostContext, "RCTRawText", rootContainerInstance, {
|
||||
text: text
|
||||
});
|
||||
|
@ -6453,13 +6193,96 @@ var NativeRenderer = reactReconciler({
|
|||
getInspectorDataForViewTag = function() {
|
||||
invariant(!1, "getInspectorDataForViewTag() is not available in production");
|
||||
};
|
||||
findHostInstance = NativeRenderer.findHostInstance;
|
||||
var findHostInstance = NativeRenderer.findHostInstance;
|
||||
function findNodeHandle(componentOrHandle) {
|
||||
if (null == componentOrHandle) return null;
|
||||
if ("number" === typeof componentOrHandle) return componentOrHandle;
|
||||
if (componentOrHandle._nativeTag) return componentOrHandle._nativeTag;
|
||||
if (componentOrHandle.canonical && componentOrHandle.canonical._nativeTag)
|
||||
return componentOrHandle.canonical._nativeTag;
|
||||
componentOrHandle = findHostInstance(componentOrHandle);
|
||||
return null == componentOrHandle
|
||||
? componentOrHandle
|
||||
: componentOrHandle.canonical
|
||||
? componentOrHandle.canonical._nativeTag
|
||||
: componentOrHandle._nativeTag;
|
||||
}
|
||||
_batchedUpdates = NativeRenderer.batchedUpdates;
|
||||
_flushInteractiveUpdates = NativeRenderer.flushInteractiveUpdates;
|
||||
var roots = new Map(),
|
||||
ReactNativeRenderer = {
|
||||
NativeComponent: ReactNativeComponent,
|
||||
findNodeHandle: findNumericNodeHandleFiber,
|
||||
NativeComponent: (function(findNodeHandle, findHostInstance) {
|
||||
return (function(_React$Component) {
|
||||
function ReactNativeComponent() {
|
||||
if (!(this instanceof ReactNativeComponent))
|
||||
throw new TypeError("Cannot call a class as a function");
|
||||
var call = _React$Component.apply(this, arguments);
|
||||
if (!this)
|
||||
throw new ReferenceError(
|
||||
"this hasn't been initialised - super() hasn't been called"
|
||||
);
|
||||
return !call ||
|
||||
("object" !== typeof call && "function" !== typeof call)
|
||||
? this
|
||||
: call;
|
||||
}
|
||||
_inherits(ReactNativeComponent, _React$Component);
|
||||
ReactNativeComponent.prototype.blur = function() {
|
||||
TextInputState.blurTextInput(findNodeHandle(this));
|
||||
};
|
||||
ReactNativeComponent.prototype.focus = function() {
|
||||
TextInputState.focusTextInput(findNodeHandle(this));
|
||||
};
|
||||
ReactNativeComponent.prototype.measure = function(callback) {
|
||||
UIManager.measure(
|
||||
findNodeHandle(this),
|
||||
mountSafeCallback(this, callback)
|
||||
);
|
||||
};
|
||||
ReactNativeComponent.prototype.measureInWindow = function(callback) {
|
||||
UIManager.measureInWindow(
|
||||
findNodeHandle(this),
|
||||
mountSafeCallback(this, callback)
|
||||
);
|
||||
};
|
||||
ReactNativeComponent.prototype.measureLayout = function(
|
||||
relativeToNativeNode,
|
||||
onSuccess,
|
||||
onFail
|
||||
) {
|
||||
UIManager.measureLayout(
|
||||
findNodeHandle(this),
|
||||
relativeToNativeNode,
|
||||
mountSafeCallback(this, onFail),
|
||||
mountSafeCallback(this, onSuccess)
|
||||
);
|
||||
};
|
||||
ReactNativeComponent.prototype.setNativeProps = function(nativeProps) {
|
||||
var maybeInstance = void 0;
|
||||
try {
|
||||
maybeInstance = findHostInstance(this);
|
||||
} catch (error) {}
|
||||
if (null != maybeInstance) {
|
||||
var viewConfig =
|
||||
maybeInstance.viewConfig || maybeInstance.canonical.viewConfig;
|
||||
nativeProps = diffProperties(
|
||||
null,
|
||||
emptyObject$1,
|
||||
nativeProps,
|
||||
viewConfig.validAttributes
|
||||
);
|
||||
null != nativeProps &&
|
||||
UIManager.updateView(
|
||||
maybeInstance._nativeTag,
|
||||
viewConfig.uiViewClassName,
|
||||
nativeProps
|
||||
);
|
||||
}
|
||||
};
|
||||
return ReactNativeComponent;
|
||||
})(React.Component);
|
||||
})(findNodeHandle, findHostInstance),
|
||||
findNodeHandle: findNodeHandle,
|
||||
render: function(element, containerTag, callback) {
|
||||
var root = roots.get(containerTag);
|
||||
root ||
|
||||
|
@ -6488,24 +6311,24 @@ var roots = new Map(),
|
|||
);
|
||||
},
|
||||
unstable_batchedUpdates: batchedUpdates,
|
||||
flushSync: NativeRenderer.flushSync,
|
||||
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: {
|
||||
NativeMethodsMixin: {
|
||||
NativeMethodsMixin: (function(findNodeHandle, findHostInstance) {
|
||||
return {
|
||||
measure: function(callback) {
|
||||
UIManager.measure(
|
||||
findNumericNodeHandleFiber(this),
|
||||
findNodeHandle(this),
|
||||
mountSafeCallback(this, callback)
|
||||
);
|
||||
},
|
||||
measureInWindow: function(callback) {
|
||||
UIManager.measureInWindow(
|
||||
findNumericNodeHandleFiber(this),
|
||||
findNodeHandle(this),
|
||||
mountSafeCallback(this, callback)
|
||||
);
|
||||
},
|
||||
measureLayout: function(relativeToNativeNode, onSuccess, onFail) {
|
||||
UIManager.measureLayout(
|
||||
findNumericNodeHandleFiber(this),
|
||||
findNodeHandle(this),
|
||||
relativeToNativeNode,
|
||||
mountSafeCallback(this, onFail),
|
||||
mountSafeCallback(this, onSuccess)
|
||||
|
@ -6514,7 +6337,7 @@ var roots = new Map(),
|
|||
setNativeProps: function(nativeProps) {
|
||||
var maybeInstance = void 0;
|
||||
try {
|
||||
maybeInstance = findNodeHandle(this);
|
||||
maybeInstance = findHostInstance(this);
|
||||
} catch (error) {}
|
||||
if (null != maybeInstance) {
|
||||
var viewConfig = maybeInstance.viewConfig;
|
||||
|
@ -6533,31 +6356,14 @@ var roots = new Map(),
|
|||
}
|
||||
},
|
||||
focus: function() {
|
||||
TextInputState.focusTextInput(findNumericNodeHandleFiber(this));
|
||||
TextInputState.focusTextInput(findNodeHandle(this));
|
||||
},
|
||||
blur: function() {
|
||||
TextInputState.blurTextInput(findNumericNodeHandleFiber(this));
|
||||
TextInputState.blurTextInput(findNodeHandle(this));
|
||||
}
|
||||
},
|
||||
ReactNativeBridgeEventPlugin: ReactNativeBridgeEventPlugin,
|
||||
};
|
||||
})(findNodeHandle, findHostInstance),
|
||||
ReactNativeComponentTree: ReactNativeComponentTree,
|
||||
ReactNativePropRegistry: ReactNativePropRegistry,
|
||||
TouchHistoryMath: TouchHistoryMath,
|
||||
createReactNativeComponentClass: function(name, callback) {
|
||||
invariant(
|
||||
!viewConfigCallbacks.has(name),
|
||||
"Tried to register two views with the same name %s",
|
||||
name
|
||||
);
|
||||
viewConfigCallbacks.set(name, callback);
|
||||
return name;
|
||||
},
|
||||
takeSnapshot: function(view, options) {
|
||||
"number" !== typeof view &&
|
||||
"window" !== view &&
|
||||
(view = findNumericNodeHandleFiber(view) || "window");
|
||||
return UIManager.__takeSnapshot(view, options);
|
||||
},
|
||||
computeComponentStackForErrorReporting: function(reactTag) {
|
||||
return (reactTag = getInstanceFromTag(reactTag))
|
||||
? getStackAddendumByWorkInProgressFiber(reactTag)
|
||||
|
|
|
@ -1,17 +0,0 @@
|
|||
/**
|
||||
* Copyright (c) 2013-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @providesModule ReactNativeBridgeEventPlugin
|
||||
*/
|
||||
|
||||
'use strict';
|
||||
|
||||
const {
|
||||
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
|
||||
} = require('ReactNative');
|
||||
|
||||
module.exports =
|
||||
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactNativeBridgeEventPlugin;
|
|
@ -69,19 +69,9 @@ export type NativeMethodsMixinType = {
|
|||
setNativeProps(nativeProps: Object): void,
|
||||
};
|
||||
|
||||
type ReactNativeBridgeEventPlugin = {
|
||||
processEventTypes(viewConfig: ReactNativeBaseComponentViewConfig): void,
|
||||
};
|
||||
|
||||
type SecretInternalsType = {
|
||||
NativeMethodsMixin: NativeMethodsMixinType,
|
||||
createReactNativeComponentClass(
|
||||
name: string,
|
||||
callback: ViewConfigGetter,
|
||||
): any,
|
||||
ReactNativeBridgeEventPlugin: ReactNativeBridgeEventPlugin,
|
||||
ReactNativeComponentTree: any,
|
||||
ReactNativePropRegistry: any,
|
||||
// TODO (bvaughn) Decide which additional types to expose here?
|
||||
// And how much information to fill in for the above types.
|
||||
};
|
||||
|
@ -104,3 +94,16 @@ export type ReactNativeType = {
|
|||
|
||||
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: SecretInternalsType,
|
||||
};
|
||||
|
||||
export type ReactFabricType = {
|
||||
NativeComponent: any,
|
||||
findNodeHandle(componentOrHandle: any): ?number,
|
||||
render(
|
||||
element: React$Element<any>,
|
||||
containerTag: any,
|
||||
callback: ?Function,
|
||||
): any,
|
||||
unmountComponentAtNode(containerTag: number): any,
|
||||
|
||||
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED: SecretInternalsType,
|
||||
};
|
||||
|
|
|
@ -0,0 +1,106 @@
|
|||
/**
|
||||
* Copyright (c) 2015-present, Facebook, Inc.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @providesModule ReactNativeViewConfigRegistry
|
||||
* @flow
|
||||
*/
|
||||
'use strict';
|
||||
|
||||
import type {
|
||||
ReactNativeBaseComponentViewConfig,
|
||||
ViewConfigGetter,
|
||||
} from './ReactNativeTypes';
|
||||
|
||||
const invariant = require('fbjs/lib/invariant');
|
||||
|
||||
// Event configs
|
||||
const customBubblingEventTypes = {};
|
||||
const customDirectEventTypes = {};
|
||||
const eventTypes = {};
|
||||
|
||||
exports.customBubblingEventTypes = customBubblingEventTypes;
|
||||
exports.customDirectEventTypes = customDirectEventTypes;
|
||||
exports.eventTypes = eventTypes;
|
||||
|
||||
const viewConfigCallbacks = new Map();
|
||||
const viewConfigs = new Map();
|
||||
|
||||
function processEventTypes(
|
||||
viewConfig: ReactNativeBaseComponentViewConfig,
|
||||
): void {
|
||||
const {bubblingEventTypes, directEventTypes} = viewConfig;
|
||||
|
||||
if (__DEV__) {
|
||||
if (bubblingEventTypes != null && directEventTypes != null) {
|
||||
for (const topLevelType in directEventTypes) {
|
||||
invariant(
|
||||
bubblingEventTypes[topLevelType] == null,
|
||||
'Event cannot be both direct and bubbling: %s',
|
||||
topLevelType,
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (bubblingEventTypes != null) {
|
||||
for (const topLevelType in bubblingEventTypes) {
|
||||
if (customBubblingEventTypes[topLevelType] == null) {
|
||||
eventTypes[topLevelType] = customBubblingEventTypes[topLevelType] =
|
||||
bubblingEventTypes[topLevelType];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (directEventTypes != null) {
|
||||
for (const topLevelType in directEventTypes) {
|
||||
if (customDirectEventTypes[topLevelType] == null) {
|
||||
eventTypes[topLevelType] = customDirectEventTypes[topLevelType] =
|
||||
directEventTypes[topLevelType];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Registers a native view/component by name.
|
||||
* A callback is provided to load the view config from UIManager.
|
||||
* The callback is deferred until the view is actually rendered.
|
||||
* This is done to avoid causing Prepack deopts.
|
||||
*/
|
||||
exports.register = function(name: string, callback: ViewConfigGetter): string {
|
||||
invariant(
|
||||
!viewConfigCallbacks.has(name),
|
||||
'Tried to register two views with the same name %s',
|
||||
name,
|
||||
);
|
||||
viewConfigCallbacks.set(name, callback);
|
||||
return name;
|
||||
};
|
||||
|
||||
/**
|
||||
* Retrieves a config for the specified view.
|
||||
* If this is the first time the view has been used,
|
||||
* This configuration will be lazy-loaded from UIManager.
|
||||
*/
|
||||
exports.get = function(name: string): ReactNativeBaseComponentViewConfig {
|
||||
let viewConfig;
|
||||
if (!viewConfigs.has(name)) {
|
||||
const callback = viewConfigCallbacks.get(name);
|
||||
invariant(
|
||||
typeof callback === 'function',
|
||||
'View config not found for name %s',
|
||||
name,
|
||||
);
|
||||
viewConfigCallbacks.set(name, null);
|
||||
viewConfig = callback();
|
||||
processEventTypes(viewConfig);
|
||||
viewConfigs.set(name, viewConfig);
|
||||
} else {
|
||||
viewConfig = viewConfigs.get(name);
|
||||
}
|
||||
invariant(viewConfig, 'View config not found for name %s', name);
|
||||
return viewConfig;
|
||||
};
|
|
@ -10,9 +10,23 @@
|
|||
|
||||
'use strict';
|
||||
|
||||
const {
|
||||
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED,
|
||||
} = require('ReactNative');
|
||||
import type {ViewConfigGetter} from './ReactNativeTypes';
|
||||
|
||||
module.exports =
|
||||
__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.createReactNativeComponentClass;
|
||||
const {register} = require('ReactNativeViewConfigRegistry');
|
||||
|
||||
/**
|
||||
* Creates a renderable ReactNative host component.
|
||||
* Use this method for view configs that are loaded from UIManager.
|
||||
* Use createReactNativeComponentClass() for view configs defined within JavaScript.
|
||||
*
|
||||
* @param {string} config iOS View configuration.
|
||||
* @private
|
||||
*/
|
||||
const createReactNativeComponentClass = function(
|
||||
name: string,
|
||||
callback: ViewConfigGetter,
|
||||
): string {
|
||||
return register(name, callback);
|
||||
};
|
||||
|
||||
module.exports = createReactNativeComponentClass;
|
||||
|
|
|
@ -10,233 +10,4 @@
|
|||
*/
|
||||
'use strict';
|
||||
|
||||
const React = require('React');
|
||||
const ReactNative = require('ReactNative');
|
||||
const ReactNativeViewAttributes = require('ReactNativeViewAttributes');
|
||||
const TextPropTypes = require('TextPropTypes');
|
||||
const Touchable = require('Touchable');
|
||||
const UIManager = require('UIManager');
|
||||
|
||||
const {createReactNativeComponentClass} = require('ReactFabricInternals');
|
||||
const mergeFast = require('mergeFast');
|
||||
const processColor = require('processColor');
|
||||
const {ViewContextTypes} = require('ViewContext');
|
||||
|
||||
import type {PressEvent} from 'CoreEventTypes';
|
||||
import type {TextProps} from 'TextProps';
|
||||
import type {ViewChildContext} from 'ViewContext';
|
||||
|
||||
type State = {
|
||||
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, {
|
||||
isHighlighted: true,
|
||||
numberOfLines: true,
|
||||
ellipsizeMode: true,
|
||||
allowFontScaling: true,
|
||||
disabled: true,
|
||||
selectable: true,
|
||||
selectionColor: true,
|
||||
adjustsFontSizeToFit: true,
|
||||
minimumFontScale: true,
|
||||
textBreakStrategy: true,
|
||||
}),
|
||||
uiViewClassName: 'RCTText',
|
||||
};
|
||||
|
||||
/**
|
||||
* A React component for displaying text.
|
||||
*
|
||||
* See https://facebook.github.io/react-native/docs/text.html
|
||||
*/
|
||||
class Text extends ReactNative.NativeComponent<TextProps, State> {
|
||||
static propTypes = TextPropTypes;
|
||||
static childContextTypes = ViewContextTypes;
|
||||
static contextTypes = ViewContextTypes;
|
||||
|
||||
static defaultProps = {
|
||||
accessible: true,
|
||||
allowFontScaling: true,
|
||||
ellipsizeMode: 'tail',
|
||||
};
|
||||
|
||||
state = mergeFast(Touchable.Mixin.touchableGetInitialState(), {
|
||||
isHighlighted: false,
|
||||
});
|
||||
|
||||
viewConfig = viewConfig;
|
||||
|
||||
getChildContext(): ViewChildContext {
|
||||
return {
|
||||
isInAParentText: true,
|
||||
};
|
||||
}
|
||||
|
||||
_handlers: ?Object;
|
||||
|
||||
_hasPressHandler(): boolean {
|
||||
return !!this.props.onPress || !!this.props.onLongPress;
|
||||
}
|
||||
/**
|
||||
* These are assigned lazily the first time the responder is set to make plain
|
||||
* text nodes as cheap as possible.
|
||||
*/
|
||||
touchableHandleActivePressIn: ?Function;
|
||||
touchableHandleActivePressOut: ?Function;
|
||||
touchableHandlePress: ?Function;
|
||||
touchableHandleLongPress: ?Function;
|
||||
touchableHandleResponderGrant: ?Function;
|
||||
touchableHandleResponderMove: ?Function;
|
||||
touchableHandleResponderRelease: ?Function;
|
||||
touchableHandleResponderTerminate: ?Function;
|
||||
touchableHandleResponderTerminationRequest: ?Function;
|
||||
touchableGetPressRectOffset: ?Function;
|
||||
|
||||
render(): React.Element<any> {
|
||||
let newProps = this.props;
|
||||
if (this.props.onStartShouldSetResponder || this._hasPressHandler()) {
|
||||
if (!this._handlers) {
|
||||
this._handlers = {
|
||||
onStartShouldSetResponder: (): boolean => {
|
||||
const shouldSetFromProps =
|
||||
this.props.onStartShouldSetResponder &&
|
||||
this.props.onStartShouldSetResponder();
|
||||
const setResponder = shouldSetFromProps || this._hasPressHandler();
|
||||
if (setResponder && !this.touchableHandleActivePressIn) {
|
||||
// Attach and bind all the other handlers only the first time a touch
|
||||
// actually happens.
|
||||
for (const key in Touchable.Mixin) {
|
||||
if (typeof Touchable.Mixin[key] === 'function') {
|
||||
(this: any)[key] = Touchable.Mixin[key].bind(this);
|
||||
}
|
||||
}
|
||||
this.touchableHandleActivePressIn = () => {
|
||||
if (
|
||||
this.props.suppressHighlighting ||
|
||||
!this._hasPressHandler()
|
||||
) {
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
isHighlighted: true,
|
||||
});
|
||||
};
|
||||
|
||||
this.touchableHandleActivePressOut = () => {
|
||||
if (
|
||||
this.props.suppressHighlighting ||
|
||||
!this._hasPressHandler()
|
||||
) {
|
||||
return;
|
||||
}
|
||||
this.setState({
|
||||
isHighlighted: false,
|
||||
});
|
||||
};
|
||||
|
||||
this.touchableHandlePress = (e: PressEvent) => {
|
||||
this.props.onPress && this.props.onPress(e);
|
||||
};
|
||||
|
||||
this.touchableHandleLongPress = (e: PressEvent) => {
|
||||
this.props.onLongPress && this.props.onLongPress(e);
|
||||
};
|
||||
|
||||
this.touchableGetPressRectOffset = function(): RectOffset {
|
||||
return this.props.pressRetentionOffset || PRESS_RECT_OFFSET;
|
||||
};
|
||||
}
|
||||
return setResponder;
|
||||
},
|
||||
onResponderGrant: function(e: SyntheticEvent<>, dispatchID: string) {
|
||||
// $FlowFixMe TouchableMixin handlers couldn't actually be null
|
||||
this.touchableHandleResponderGrant(e, dispatchID);
|
||||
this.props.onResponderGrant &&
|
||||
this.props.onResponderGrant.apply(this, arguments);
|
||||
}.bind(this),
|
||||
onResponderMove: function(e: SyntheticEvent<>) {
|
||||
// $FlowFixMe TouchableMixin handlers couldn't actually be null
|
||||
this.touchableHandleResponderMove(e);
|
||||
this.props.onResponderMove &&
|
||||
this.props.onResponderMove.apply(this, arguments);
|
||||
}.bind(this),
|
||||
onResponderRelease: function(e: SyntheticEvent<>) {
|
||||
// $FlowFixMe TouchableMixin handlers couldn't actually be null
|
||||
this.touchableHandleResponderRelease(e);
|
||||
this.props.onResponderRelease &&
|
||||
this.props.onResponderRelease.apply(this, arguments);
|
||||
}.bind(this),
|
||||
onResponderTerminate: function(e: SyntheticEvent<>) {
|
||||
// $FlowFixMe TouchableMixin handlers couldn't actually be null
|
||||
this.touchableHandleResponderTerminate(e);
|
||||
this.props.onResponderTerminate &&
|
||||
this.props.onResponderTerminate.apply(this, arguments);
|
||||
}.bind(this),
|
||||
onResponderTerminationRequest: function(): boolean {
|
||||
// Allow touchable or props.onResponderTerminationRequest to deny
|
||||
// the request
|
||||
// $FlowFixMe TouchableMixin handlers couldn't actually be null
|
||||
var allowTermination = this.touchableHandleResponderTerminationRequest();
|
||||
if (allowTermination && this.props.onResponderTerminationRequest) {
|
||||
allowTermination = this.props.onResponderTerminationRequest.apply(
|
||||
this,
|
||||
arguments,
|
||||
);
|
||||
}
|
||||
return allowTermination;
|
||||
}.bind(this),
|
||||
};
|
||||
}
|
||||
newProps = {
|
||||
...this.props,
|
||||
...this._handlers,
|
||||
isHighlighted: this.state.isHighlighted,
|
||||
};
|
||||
}
|
||||
if (newProps.selectionColor != null) {
|
||||
newProps = {
|
||||
...newProps,
|
||||
selectionColor: processColor(newProps.selectionColor),
|
||||
};
|
||||
}
|
||||
if (Touchable.TOUCH_TARGET_DEBUG && newProps.onPress) {
|
||||
newProps = {
|
||||
...newProps,
|
||||
style: [this.props.style, {color: 'magenta'}],
|
||||
};
|
||||
}
|
||||
if (this.context.isInAParentText) {
|
||||
return <RCTVirtualText {...newProps} />;
|
||||
} else {
|
||||
return <RCTText {...newProps} />;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
var RCTText = createReactNativeComponentClass(
|
||||
viewConfig.uiViewClassName,
|
||||
() => viewConfig,
|
||||
);
|
||||
var RCTVirtualText = RCTText;
|
||||
|
||||
if (UIManager.RCTVirtualText) {
|
||||
RCTVirtualText = createReactNativeComponentClass('RCTVirtualText', () => ({
|
||||
validAttributes: mergeFast(ReactNativeViewAttributes.UIView, {
|
||||
isHighlighted: true,
|
||||
}),
|
||||
uiViewClassName: 'RCTVirtualText',
|
||||
}));
|
||||
}
|
||||
|
||||
module.exports = Text;
|
||||
module.exports = require('Text');
|
||||
|
|
Загрузка…
Ссылка в новой задаче