Created
March 25, 2020 11:33
-
-
Save AndreiCalazans/8e335aa05fc18f7aa736b26d7826a5ee to your computer and use it in GitHub Desktop.
Patch for React Native 0.58.6
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/node_modules/react-native/Libraries/Components/ScrollResponder.js b/node_modules/react-native/Libraries/Components/ScrollResponder.js | |
index 46fe2a7..10c735c 100644 | |
--- a/node_modules/react-native/Libraries/Components/ScrollResponder.js | |
+++ b/node_modules/react-native/Libraries/Components/ScrollResponder.js | |
@@ -116,6 +116,23 @@ type State = { | |
becameResponderWhileAnimating: boolean, | |
}; | |
+function scrollResponderKeyboardWillShow(e: KeyboardEvent) { | |
+ this.onKeyboardWillShow && this.onKeyboardWillShow(e); | |
+} | |
+ | |
+function scrollResponderKeyboardWillHide(e: KeyboardEvent) { | |
+ this.onKeyboardWillHide && this.onKeyboardWillHide(e); | |
+} | |
+ | |
+function scrollResponderKeyboardDidShow(e: KeyboardEvent) { | |
+ this.onKeyboardDidShow && this.onKeyboardDidShow(e); | |
+} | |
+ | |
+function scrollResponderKeyboardDidHide(e: KeyboardEvent) { | |
+ this.onKeyboardDidHide && this.onKeyboardDidHide(e); | |
+} | |
+ | |
+ | |
const ScrollResponderMixin = { | |
_subscriptionKeyboardWillShow: (null: ?EmitterSubscription), | |
_subscriptionKeyboardWillHide: (null: ?EmitterSubscription), | |
@@ -599,7 +616,7 @@ const ScrollResponderMixin = { | |
* The `keyboardWillShow` is called before input focus. | |
*/ | |
UNSAFE_componentWillMount: function() { | |
- const {keyboardShouldPersistTaps} = this.props; | |
+ const {keyboardShouldPersistTaps, children, ...restProps} = this.props; | |
warning( | |
typeof keyboardShouldPersistTaps !== 'boolean', | |
`'keyboardShouldPersistTaps={${keyboardShouldPersistTaps}}' is deprecated. ` + | |
@@ -612,19 +629,19 @@ const ScrollResponderMixin = { | |
this.additionalScrollOffset = 0; | |
this._subscriptionKeyboardWillShow = Keyboard.addListener( | |
'keyboardWillShow', | |
- this.scrollResponderKeyboardWillShow, | |
+ scrollResponderKeyboardWillShow.bind({ onKeyboardWillShow: this.props.onKeyboardWillShow }), | |
); | |
this._subscriptionKeyboardWillHide = Keyboard.addListener( | |
'keyboardWillHide', | |
- this.scrollResponderKeyboardWillHide, | |
+ scrollResponderKeyboardWillHide.bind({ onKeyboardWillHide: this.props.onKeyboardWillHide }), | |
); | |
this._subscriptionKeyboardDidShow = Keyboard.addListener( | |
'keyboardDidShow', | |
- this.scrollResponderKeyboardDidShow, | |
+ scrollResponderKeyboardDidShow.bind({ onKeyboardDidShow: this.props.onKeyboardDidShow }), | |
); | |
this._subscriptionKeyboardDidHide = Keyboard.addListener( | |
'keyboardDidHide', | |
- this.scrollResponderKeyboardDidHide, | |
+ scrollResponderKeyboardDidHide.bind({ onKeyboardDidHide: this.props.onKeyboardDidHide }), | |
); | |
}, | |
@@ -671,29 +688,27 @@ const ScrollResponderMixin = { | |
* relevant to you. (For example, only if you receive these callbacks after | |
* you had explicitly focused a node etc). | |
*/ | |
- scrollResponderKeyboardWillShow: function(e: KeyboardEvent) { | |
- this.keyboardWillOpenTo = e; | |
- this.props.onKeyboardWillShow && this.props.onKeyboardWillShow(e); | |
- }, | |
- | |
- scrollResponderKeyboardWillHide: function(e: KeyboardEvent) { | |
- this.keyboardWillOpenTo = null; | |
- this.props.onKeyboardWillHide && this.props.onKeyboardWillHide(e); | |
- }, | |
- | |
- scrollResponderKeyboardDidShow: function(e: KeyboardEvent) { | |
- // TODO(7693961): The event for DidShow is not available on iOS yet. | |
- // Use the one from WillShow and do not assign. | |
- if (e) { | |
- this.keyboardWillOpenTo = e; | |
- } | |
- this.props.onKeyboardDidShow && this.props.onKeyboardDidShow(e); | |
- }, | |
- | |
- scrollResponderKeyboardDidHide: function(e: KeyboardEvent) { | |
- this.keyboardWillOpenTo = null; | |
- this.props.onKeyboardDidHide && this.props.onKeyboardDidHide(e); | |
- }, | |
+ // scrollResponderKeyboardWillShow: function scrollResponderKeyboardWillShow(e: KeyboardEvent) { | |
+ // console.log("wtf man? ", this.props.children) | |
+ // // this.keyboardWillOpenTo = e; | |
+ // // this.props.onKeyboardWillShow && this.props.onKeyboardWillShow(e); | |
+ // }, | |
+ // scrollResponderKeyboardWillHide: function scrollResponderKeyboardWillHide(e: KeyboardEvent) { | |
+ // this.keyboardWillOpenTo = null; | |
+ // this.props.onKeyboardWillHide && this.props.onKeyboardWillHide(e); | |
+ // }, | |
+ // scrollResponderKeyboardDidShow: function scrollResponderKeyboardDidShow(e: KeyboardEvent) { | |
+ // // TODO(7693961): The event for DidShow is not available on iOS yet. | |
+ // // Use the one from WillShow and do not assign. | |
+ // if (e) { | |
+ // this.keyboardWillOpenTo = e; | |
+ // } | |
+ // this.props.onKeyboardDidShow && this.props.onKeyboardDidShow(e); | |
+ // }, | |
+ // scrollResponderKeyboardDidHide: function scrollResponderKeyboardDidHide(e: KeyboardEvent) { | |
+ // this.keyboardWillOpenTo = null; | |
+ // this.props.onKeyboardDidHide && this.props.onKeyboardDidHide(e); | |
+ // }, | |
}; | |
const ScrollResponder = { | |
diff --git a/node_modules/react-native/Libraries/Components/Touchable/Touchable.js b/node_modules/react-native/Libraries/Components/Touchable/Touchable.js | |
index 5383de2..f201785 100644 | |
--- a/node_modules/react-native/Libraries/Components/Touchable/Touchable.js | |
+++ b/node_modules/react-native/Libraries/Components/Touchable/Touchable.js | |
@@ -359,18 +359,24 @@ const TouchableMixin = { | |
return; | |
} | |
+ function defaultFn() {}; | |
this._tvEventHandler = new TVEventHandler(); | |
- this._tvEventHandler.enable(this, function(cmp, evt) { | |
- const myTag = ReactNative.findNodeHandle(cmp); | |
+ this._tvEventHandler.enable({ | |
+ myTag: ReactNative.findNodeHandle(this), | |
+ touchableHandleFocus: this.props.onFocus ? this.props.onFocus.bind({}) : defaultFn, | |
+ touchableHandleBlur: this.props.onBlur ? this.props.onBlur.bind({}) : defaultFn, | |
+ touchableHandlePress: this.props.onPress ? this.props.onPress.bind({}) : defaultFn, | |
+ disabled: this.props.disabled, | |
+ }, function handleCallback(cmp, evt) { | |
evt.dispatchConfig = {}; | |
- if (myTag === evt.tag) { | |
+ if (cmp.myTag === evt.tag) { | |
if (evt.eventType === 'focus') { | |
cmp.touchableHandleFocus(evt); | |
} else if (evt.eventType === 'blur') { | |
cmp.touchableHandleBlur(evt); | |
} else if (evt.eventType === 'select') { | |
cmp.touchableHandlePress && | |
- !cmp.props.disabled && | |
+ !cmp.disabled && | |
cmp.touchableHandlePress(evt); | |
} | |
} | |
diff --git a/node_modules/react-native/Libraries/Lists/VirtualizedList.js b/node_modules/react-native/Libraries/Lists/VirtualizedList.js | |
index 9e10cbe..e086418 100644 | |
--- a/node_modules/react-native/Libraries/Lists/VirtualizedList.js | |
+++ b/node_modules/react-native/Libraries/Lists/VirtualizedList.js | |
@@ -783,10 +783,14 @@ class VirtualizedList extends React.PureComponent<Props, State> { | |
_usedIndexForKey = false; | |
_keylessItemComponentName = ''; | |
const spacerKey = !horizontal ? 'height' : 'width'; | |
- const lastInitialIndex = this.props.initialScrollIndex | |
+ let lastInitialIndex = this.props.initialScrollIndex | |
? -1 | |
: this.props.initialNumToRender - 1; | |
const {first, last} = this.state; | |
+ | |
+ // When the first index reaches passed the initialNumToRender, we skip the initialNumToRender first number of element so they are not rendered anymore. | |
+ // This is to prevent the focus from jumping to the initial window when scrolling back up from the bottom of the list, while in-between windows are being mounted / rendered. | |
+ lastInitialIndex = first >= this.props.initialNumToRender ? -1 : lastInitialIndex; | |
this._pushCells( | |
cells, | |
stickyHeaderIndices, | |
diff --git a/node_modules/react-native/Libraries/Renderer/oss/.ReactNativeRenderer-prod.js.swp b/node_modules/react-native/Libraries/Renderer/oss/.ReactNativeRenderer-prod.js.swp | |
new file mode 100644 | |
index 0000000..4f2ede8 | |
Binary files /dev/null and b/node_modules/react-native/Libraries/Renderer/oss/.ReactNativeRenderer-prod.js.swp differ | |
diff --git a/node_modules/react-native/Libraries/Renderer/oss/InternalFiber.js b/node_modules/react-native/Libraries/Renderer/oss/InternalFiber.js | |
new file mode 100644 | |
index 0000000..d7b3db4 | |
--- /dev/null | |
+++ b/node_modules/react-native/Libraries/Renderer/oss/InternalFiber.js | |
@@ -0,0 +1,14 @@ | |
+var internalFibers = new WeakMap(); | |
+ | |
+function setFiber(comp, fiber) { | |
+ internalFibers.set(comp, fiber); | |
+} | |
+ | |
+function getFiber(comp) { | |
+ return internalFibers.get(comp); | |
+} | |
+ | |
+module.exports = { | |
+ setFiber, | |
+ getFiber | |
+} | |
diff --git a/node_modules/react-native/Libraries/Renderer/oss/ReactFabric-prod.js b/node_modules/react-native/Libraries/Renderer/oss/ReactFabric-prod.js | |
index 95eeffc..2122b04 100644 | |
--- a/node_modules/react-native/Libraries/Renderer/oss/ReactFabric-prod.js | |
+++ b/node_modules/react-native/Libraries/Renderer/oss/ReactFabric-prod.js | |
@@ -12,6 +12,7 @@ | |
"use strict"; | |
require("InitializeCore"); | |
+var internalFiber = require('./InternalFiber'); | |
var ReactNativeViewConfigRegistry = require("ReactNativeViewConfigRegistry"), | |
UIManager = require("UIManager"), | |
React = require("react"), | |
@@ -2404,12 +2405,12 @@ function applyDerivedStateFromProps( | |
} | |
var classComponentUpdater = { | |
isMounted: function(component) { | |
- return (component = component._reactInternalFiber) | |
+ return (component = internalFiber.getFiber(component)) | |
? 2 === isFiberMountedImpl(component) | |
: !1; | |
}, | |
enqueueSetState: function(inst, payload, callback) { | |
- inst = inst._reactInternalFiber; | |
+ inst = internalFiber.getFiber(inst); | |
var currentTime = requestCurrentTime(); | |
currentTime = computeExpirationForFiber(currentTime, inst); | |
var update = createUpdate(currentTime); | |
@@ -2420,7 +2421,7 @@ var classComponentUpdater = { | |
scheduleWork(inst, currentTime); | |
}, | |
enqueueReplaceState: function(inst, payload, callback) { | |
- inst = inst._reactInternalFiber; | |
+ inst = internalFiber.getFiber(inst); | |
var currentTime = requestCurrentTime(); | |
currentTime = computeExpirationForFiber(currentTime, inst); | |
var update = createUpdate(currentTime); | |
@@ -2432,7 +2433,7 @@ var classComponentUpdater = { | |
scheduleWork(inst, currentTime); | |
}, | |
enqueueForceUpdate: function(inst, callback) { | |
- inst = inst._reactInternalFiber; | |
+ inst = internalFiber.getFiber(inst); | |
var currentTime = requestCurrentTime(); | |
currentTime = computeExpirationForFiber(currentTime, inst); | |
var update = createUpdate(currentTime); | |
@@ -2478,7 +2479,7 @@ function constructClassInstance(workInProgress, ctor, props) { | |
null !== ctor.state && void 0 !== ctor.state ? ctor.state : null; | |
ctor.updater = classComponentUpdater; | |
workInProgress.stateNode = ctor; | |
- ctor._reactInternalFiber = workInProgress; | |
+ internalFiber.setFiber(ctor, workInProgress); | |
isLegacyContextConsumer && | |
((workInProgress = workInProgress.stateNode), | |
(workInProgress.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext), | |
@@ -3998,7 +3999,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) { | |
); | |
context.updater = classComponentUpdater; | |
workInProgress.stateNode = context; | |
- context._reactInternalFiber = workInProgress; | |
+ internalFiber.setFiber(context, workInProgress); | |
mountClassInstance( | |
workInProgress, | |
updateExpirationTime, | |
@@ -6098,7 +6099,7 @@ function onUncaughtError(error) { | |
hasUnhandledError || ((hasUnhandledError = !0), (unhandledError = error)); | |
} | |
function findHostInstance(component) { | |
- var fiber = component._reactInternalFiber; | |
+ var fiber = internalFiber.getFiber(component); | |
void 0 === fiber && | |
("function" === typeof component.render | |
? invariant(!1, "Unable to find node on an unmounted component.") | |
@@ -6116,7 +6117,7 @@ function updateContainer(element, container, parentComponent, callback) { | |
current$$1 = computeExpirationForFiber(currentTime, current$$1); | |
currentTime = container.current; | |
a: if (parentComponent) { | |
- parentComponent = parentComponent._reactInternalFiber; | |
+ parentComponent = internalFiber.getFiber(parentComponent); | |
b: { | |
invariant( | |
2 === isFiberMountedImpl(parentComponent) && 1 === parentComponent.tag, | |
diff --git a/node_modules/react-native/Libraries/Renderer/oss/ReactNativeRenderer-prod.js b/node_modules/react-native/Libraries/Renderer/oss/ReactNativeRenderer-prod.js | |
index e9268b6..f291442 100644 | |
--- a/node_modules/react-native/Libraries/Renderer/oss/ReactNativeRenderer-prod.js | |
+++ b/node_modules/react-native/Libraries/Renderer/oss/ReactNativeRenderer-prod.js | |
@@ -21,6 +21,8 @@ var ReactNativeViewConfigRegistry = require("ReactNativeViewConfigRegistry"), | |
TextInputState = require("TextInputState"); | |
var scheduler = require("scheduler"), | |
ExceptionsManager = require("ExceptionsManager"); | |
+var internalFiber = require('./InternalFiber'); | |
+var previousContext = require('./previousContext'); | |
function invariant(condition, format, a, b, c, d, e, f) { | |
if (!condition) { | |
condition = void 0; | |
@@ -1039,46 +1041,121 @@ function batchedUpdates(fn, bookkeeping) { | |
} | |
} | |
var EMPTY_NATIVE_EVENT = {}; | |
-function _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam) { | |
- var nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT, | |
- inst = getInstanceFromTag(rootNodeID); | |
- batchedUpdates(function() { | |
- var events = nativeEvent.target; | |
- for (var events$jscomp$0 = null, i = 0; i < plugins.length; i++) { | |
- var possiblePlugin = plugins[i]; | |
- possiblePlugin && | |
- (possiblePlugin = possiblePlugin.extractEvents( | |
- topLevelType, | |
- inst, | |
- nativeEvent, | |
- events | |
- )) && | |
- (events$jscomp$0 = accumulateInto(events$jscomp$0, possiblePlugin)); | |
+ | |
+function extractEvents( | |
+ topLevelType, | |
+ targetInst, | |
+ nativeEvent, | |
+ nativeEventTarget | |
+) { | |
+ var events = null; | |
+ for (var i = 0; i < plugins.length; i++) { | |
+ // Not every plugin in the ordering may be loaded at runtime. | |
+ var possiblePlugin = plugins[i]; | |
+ if (possiblePlugin) { | |
+ var extractedEvents = possiblePlugin.extractEvents( | |
+ topLevelType, | |
+ targetInst, | |
+ nativeEvent, | |
+ nativeEventTarget | |
+ ); | |
+ if (extractedEvents) { | |
+ events = accumulateInto(events, extractedEvents); | |
+ } | |
} | |
- events = events$jscomp$0; | |
- null !== events && (eventQueue = accumulateInto(eventQueue, events)); | |
- events = eventQueue; | |
- eventQueue = null; | |
- if ( | |
- events && | |
- (forEachAccumulated(events, executeDispatchesAndReleaseTopLevel), | |
- invariant( | |
- !eventQueue, | |
- "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." | |
- ), | |
- hasRethrowError) | |
- ) | |
- throw ((events = rethrowError), | |
- (hasRethrowError = !1), | |
- (rethrowError = null), | |
- events); | |
+ } | |
+ return events; | |
+} | |
+ | |
+function runEventsInBatch(events) { | |
+ if (events !== null) { | |
+ eventQueue = accumulateInto(eventQueue, events); | |
+ } | |
+ | |
+ // Set `eventQueue` to null before processing it so that we can tell if more | |
+ // events get enqueued while processing. | |
+ var processingEventQueue = eventQueue; | |
+ eventQueue = null; | |
+ | |
+ if (!processingEventQueue) { | |
+ return; | |
+ } | |
+ | |
+ forEachAccumulated(processingEventQueue, executeDispatchesAndReleaseTopLevel); | |
+} | |
+ | |
+function runExtractedEventsInBatch( | |
+ topLevelType, | |
+ targetInst, | |
+ nativeEvent, | |
+ nativeEventTarget | |
+) { | |
+ var events = extractEvents( | |
+ topLevelType, | |
+ targetInst, | |
+ nativeEvent, | |
+ nativeEventTarget | |
+ ); | |
+ runEventsInBatch(events); | |
+} | |
+ | |
+ | |
+ | |
+function _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam) { | |
+ var nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT; | |
+ var inst = getInstanceFromTag(rootNodeID); | |
+ batchedUpdates(function onBatch() { | |
+ runExtractedEventsInBatch( | |
+ topLevelType, | |
+ inst, | |
+ nativeEvent, | |
+ nativeEvent.target | |
+ ); | |
}); | |
+ // React Native doesn't use ReactControlledComponent but if it did, here's | |
+ // where it would do it. | |
} | |
+ | |
+// function _receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam) { | |
+// var nativeEvent = nativeEventParam || EMPTY_NATIVE_EVENT, | |
+// inst = getInstanceFromTag(rootNodeID); | |
+// batchedUpdates(function() { | |
+// var events = nativeEvent.target; | |
+// for (var events$jscomp$0 = null, i = 0; i < plugins.length; i++) { | |
+// var possiblePlugin = plugins[i]; | |
+// possiblePlugin && | |
+// (possiblePlugin = possiblePlugin.extractEvents( | |
+// topLevelType, | |
+// inst, | |
+// nativeEvent, | |
+// events | |
+// )) && | |
+// (events$jscomp$0 = accumulateInto(events$jscomp$0, possiblePlugin)); | |
+// } | |
+// events = events$jscomp$0; | |
+// null !== events && (eventQueue = accumulateInto(eventQueue, events)); | |
+// events = eventQueue; | |
+// eventQueue = null; | |
+// if ( | |
+// events && | |
+// (forEachAccumulated(events, executeDispatchesAndReleaseTopLevel), | |
+// invariant( | |
+// !eventQueue, | |
+// "processEventQueue(): Additional events were enqueued while processing an event queue. Support for this has not yet been implemented." | |
+// ), | |
+// hasRethrowError) | |
+// ) | |
+// throw ((events = rethrowError), | |
+// (hasRethrowError = !1), | |
+// (rethrowError = null), | |
+// events); | |
+// }); | |
+// } | |
RCTEventEmitter.register({ | |
- receiveEvent: function(rootNodeID, topLevelType, nativeEventParam) { | |
+ receiveEvent: function receiveEvent(rootNodeID, topLevelType, nativeEventParam) { | |
_receiveRootNodeIDEvent(rootNodeID, topLevelType, nativeEventParam); | |
}, | |
- receiveTouches: function(eventTopLevelType, touches, changedIndices) { | |
+ receiveTouches: function receiveTouches(eventTopLevelType, touches, changedIndices) { | |
if ( | |
"topTouchEnd" === eventTopLevelType || | |
"topTouchCancel" === eventTopLevelType | |
@@ -1683,8 +1760,7 @@ function push(cursor, value) { | |
} | |
var emptyContextObject = {}, | |
contextStackCursor = { current: emptyContextObject }, | |
- didPerformWorkStackCursor = { current: !1 }, | |
- previousContext = emptyContextObject; | |
+ didPerformWorkStackCursor = { current: !1 }; | |
function getMaskedContext(workInProgress, unmaskedContext) { | |
var contextTypes = workInProgress.type.contextTypes; | |
if (!contextTypes) return emptyContextObject; | |
@@ -1742,7 +1818,7 @@ function pushContextProvider(workInProgress) { | |
instance = | |
(instance && instance.__reactInternalMemoizedMergedChildContext) || | |
emptyContextObject; | |
- previousContext = contextStackCursor.current; | |
+ previousContext.set(contextStackCursor.current) | |
push(contextStackCursor, instance, workInProgress); | |
push( | |
didPerformWorkStackCursor, | |
@@ -1758,13 +1834,14 @@ function invalidateContextProvider(workInProgress, type, didChange) { | |
"Expected to have an instance by this point. This error is likely caused by a bug in React. Please file an issue." | |
); | |
didChange | |
- ? ((type = processChildContext(workInProgress, type, previousContext)), | |
+ ? ((type = processChildContext(workInProgress, type, previousContext.get())), | |
(instance.__reactInternalMemoizedMergedChildContext = type), | |
pop(didPerformWorkStackCursor, workInProgress), | |
pop(contextStackCursor, workInProgress), | |
push(contextStackCursor, type, workInProgress)) | |
: pop(didPerformWorkStackCursor, workInProgress); | |
push(didPerformWorkStackCursor, didChange, workInProgress); | |
+ previousContext.set({}); // @andrei? | |
} | |
var onCommitFiberRoot = null, | |
onCommitFiberUnmount = null; | |
@@ -2424,12 +2501,12 @@ function applyDerivedStateFromProps( | |
} | |
var classComponentUpdater = { | |
isMounted: function(component) { | |
- return (component = component._reactInternalFiber) | |
+ return (component = internalFiber.getFiber(component)) | |
? 2 === isFiberMountedImpl(component) | |
: !1; | |
}, | |
enqueueSetState: function(inst, payload, callback) { | |
- inst = inst._reactInternalFiber; | |
+ inst = internalFiber.getFiber(inst); | |
var currentTime = requestCurrentTime(); | |
currentTime = computeExpirationForFiber(currentTime, inst); | |
var update = createUpdate(currentTime); | |
@@ -2440,7 +2517,7 @@ var classComponentUpdater = { | |
scheduleWork(inst, currentTime); | |
}, | |
enqueueReplaceState: function(inst, payload, callback) { | |
- inst = inst._reactInternalFiber; | |
+ inst = internalFiber.getFiber(inst); | |
var currentTime = requestCurrentTime(); | |
currentTime = computeExpirationForFiber(currentTime, inst); | |
var update = createUpdate(currentTime); | |
@@ -2452,7 +2529,7 @@ var classComponentUpdater = { | |
scheduleWork(inst, currentTime); | |
}, | |
enqueueForceUpdate: function(inst, callback) { | |
- inst = inst._reactInternalFiber; | |
+ inst = internalFiber.getFiber(inst); | |
var currentTime = requestCurrentTime(); | |
currentTime = computeExpirationForFiber(currentTime, inst); | |
var update = createUpdate(currentTime); | |
@@ -2486,7 +2563,7 @@ function constructClassInstance(workInProgress, ctor, props) { | |
"object" === typeof context && null !== context | |
? (context = ReactCurrentOwner$4.currentDispatcher.readContext(context)) | |
: ((unmaskedContext = isContextProvider(ctor) | |
- ? previousContext | |
+ ? previousContext.get() | |
: contextStackCursor.current), | |
(isLegacyContextConsumer = ctor.contextTypes), | |
(context = (isLegacyContextConsumer = | |
@@ -2498,7 +2575,7 @@ function constructClassInstance(workInProgress, ctor, props) { | |
null !== ctor.state && void 0 !== ctor.state ? ctor.state : null; | |
ctor.updater = classComponentUpdater; | |
workInProgress.stateNode = ctor; | |
- ctor._reactInternalFiber = workInProgress; | |
+ internalFiber.setFiber(ctor, workInProgress); | |
isLegacyContextConsumer && | |
((workInProgress = workInProgress.stateNode), | |
(workInProgress.__reactInternalMemoizedUnmaskedChildContext = unmaskedContext), | |
@@ -2535,7 +2612,7 @@ function mountClassInstance( | |
contextType | |
)) | |
: ((contextType = isContextProvider(ctor) | |
- ? previousContext | |
+ ? previousContext.get() | |
: contextStackCursor.current), | |
(instance.context = getMaskedContext(workInProgress, contextType))); | |
contextType = workInProgress.updateQueue; | |
@@ -3484,7 +3561,7 @@ function updateFunctionComponent( | |
renderExpirationTime | |
) { | |
var unmaskedContext = isContextProvider(Component) | |
- ? previousContext | |
+ ? previousContext.get() | |
: contextStackCursor.current; | |
unmaskedContext = getMaskedContext(workInProgress, unmaskedContext); | |
prepareToReadContext(workInProgress, renderExpirationTime); | |
@@ -3539,7 +3616,7 @@ function updateClassComponent( | |
contextType | |
)) | |
: ((contextType = isContextProvider(Component) | |
- ? previousContext | |
+ ? previousContext.get() | |
: contextStackCursor.current), | |
(contextType = getMaskedContext(workInProgress, contextType))); | |
var getDerivedStateFromProps = Component.getDerivedStateFromProps, | |
@@ -3626,7 +3703,7 @@ function updateClassComponent( | |
contextType | |
)) | |
: ((contextType = isContextProvider(Component) | |
- ? previousContext | |
+ ? previousContext.get() | |
: contextStackCursor.current), | |
(contextType = getMaskedContext(workInProgress, contextType))), | |
(getDerivedStateFromProps = Component.getDerivedStateFromProps), | |
@@ -4018,7 +4095,7 @@ function beginWork(current$$1, workInProgress, renderExpirationTime) { | |
); | |
context.updater = classComponentUpdater; | |
workInProgress.stateNode = context; | |
- context._reactInternalFiber = workInProgress; | |
+ internalFiber.setFiber(context, workInProgress); | |
mountClassInstance( | |
workInProgress, | |
updateExpirationTime, | |
@@ -6275,7 +6352,7 @@ function onUncaughtError(error) { | |
hasUnhandledError || ((hasUnhandledError = !0), (unhandledError = error)); | |
} | |
function findHostInstance(component) { | |
- var fiber = component._reactInternalFiber; | |
+ var fiber = internalFiber.getFiber(component); | |
void 0 === fiber && | |
("function" === typeof component.render | |
? invariant(!1, "Unable to find node on an unmounted component.") | |
@@ -6293,7 +6370,7 @@ function updateContainer(element, container, parentComponent, callback) { | |
current$$1 = computeExpirationForFiber(currentTime, current$$1); | |
currentTime = container.current; | |
a: if (parentComponent) { | |
- parentComponent = parentComponent._reactInternalFiber; | |
+ parentComponent = internalFiber.getFiber(parentComponent); | |
b: { | |
invariant( | |
2 === isFiberMountedImpl(parentComponent) && 1 === parentComponent.tag, | |
diff --git a/node_modules/react-native/Libraries/Renderer/oss/previousContext.js b/node_modules/react-native/Libraries/Renderer/oss/previousContext.js | |
new file mode 100644 | |
index 0000000..b693cb3 | |
--- /dev/null | |
+++ b/node_modules/react-native/Libraries/Renderer/oss/previousContext.js | |
@@ -0,0 +1,15 @@ | |
+var previousContext = {}; | |
+ | |
+function setPreviousContext(newContext) { | |
+ previousContext = newContext; | |
+} | |
+ | |
+function getPreviousContext() { | |
+ return previousContext; | |
+} | |
+ | |
+module.exports = { | |
+ set: setPreviousContext, | |
+ get: getPreviousContext | |
+} | |
+ | |
diff --git a/node_modules/react-native/Libraries/Renderer/shims/ReactNative.js b/node_modules/react-native/Libraries/Renderer/shims/ReactNative.js | |
index 13a5985..35097b6 100644 | |
--- a/node_modules/react-native/Libraries/Renderer/shims/ReactNative.js | |
+++ b/node_modules/react-native/Libraries/Renderer/shims/ReactNative.js | |
@@ -14,10 +14,10 @@ import type {ReactNativeType} from 'ReactNativeTypes'; | |
let ReactNative; | |
-if (__DEV__) { | |
- ReactNative = require('ReactNativeRenderer-dev'); | |
-} else { | |
+// if (__DEV__) { | |
+ // ReactNative = require('ReactNativeRenderer-dev'); | |
+// } else { | |
ReactNative = require('ReactNativeRenderer-prod'); | |
-} | |
+// } | |
module.exports = (ReactNative: ReactNativeType); | |
diff --git a/node_modules/react-native/Libraries/Text/Text.js b/node_modules/react-native/Libraries/Text/Text.js | |
index 35df724..76a37d0 100644 | |
--- a/node_modules/react-native/Libraries/Text/Text.js | |
+++ b/node_modules/react-native/Libraries/Text/Text.js | |
@@ -144,19 +144,7 @@ class TouchableText extends React.Component<Props, State> { | |
}; | |
} | |
} | |
- return ( | |
- <TextAncestor.Consumer> | |
- {hasTextAncestor => | |
- hasTextAncestor ? ( | |
- <RCTVirtualText {...props} ref={props.forwardedRef} /> | |
- ) : ( | |
- <TextAncestor.Provider value={true}> | |
- <RCTText {...props} ref={props.forwardedRef} /> | |
- </TextAncestor.Provider> | |
- ) | |
- } | |
- </TextAncestor.Consumer> | |
- ); | |
+ return <RCTText {...props} ref={props.forwardedRef} />; | |
} | |
_createResponseHandlers(): ResponseHandlers { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment