Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: upgrade React to v16.6.3#225

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Open
aleclarson wants to merge13 commits intoptmt:master
base:master
Choose a base branch
Loading
fromaleclarson:alpha
Open
Show file tree
Hide file tree
Changes fromall commits
Commits
Show all changes
13 commits
Select commitHold shift + click to select a range
a452209
feat: upgrade React to v16.6.3
aleclarsonJan 29, 2019
c3a959d
Log query name for fetchRelayQuery
alexeylangJan 11, 2018
7d2f74b
RN: Remove React Stack Systrace Logic
yungstersFeb 20, 2018
a24dedb
Move TouchHistoryMath from React Repo to React Native
sebmarkbageApr 6, 2018
d14d4a7
Move takeSnapshot from React repo to RN
sebmarkbageApr 8, 2018
9246b13
fix: delete ReactNativePropRegistry
aleclarsonJan 28, 2019
a9c2266
fix: stop using ReactNativeComponentTree
aleclarsonJan 28, 2019
d2ad9c7
fix: stop using ReactNativeBridgeEventPlugin
aleclarsonJan 28, 2019
11144a8
throw when <View> exists in <Text>
aleclarsonJan 28, 2019
b412767
fix: remove unused Renderer shims
aleclarsonJan 28, 2019
9c0e377
fix: add @providesModule to updated Renderer shims
aleclarsonJan 28, 2019
d40506d
React sync for revisions 6bf5e85...aa94237
aleclarsonMar 14, 2019
a8e563b
fix: add @providesModule to Renderer shims
aleclarsonMar 31, 2019
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletionsLibraries/Components/ScrollResponder.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -26,7 +26,6 @@ const performanceNow = require('fbjs/lib/performanceNow');
const warning = require('fbjs/lib/warning');

const { ScrollViewManager } = require('NativeModules');
const { getInstanceFromNode } = require('ReactNativeComponentTree');

/**
* Mixin that can be integrated in order to handle scrolling that plays well
Expand DownExpand Up@@ -117,15 +116,6 @@ type State = {
};
type Event = Object;

function isTagInstanceOfTextInput(tag) {
const instance = getInstanceFromNode(tag);
return instance && instance.viewConfig && (
instance.viewConfig.uiViewClassName === 'AndroidTextInput' ||
instance.viewConfig.uiViewClassName === 'RCTMultilineTextInputView' ||
instance.viewConfig.uiViewClassName === 'RCTSinglelineTextInputView'
);
}

const ScrollResponderMixin = {
mixins: [Subscribable.Mixin],
scrollResponderMixinGetInitialState: function(): State {
Expand DownExpand Up@@ -208,10 +198,7 @@ const ScrollResponderMixin = {
const {keyboardShouldPersistTaps} = this.props;
const keyboardNeverPersistTaps = !keyboardShouldPersistTaps ||
keyboardShouldPersistTaps === 'never';
if (keyboardNeverPersistTaps &&
currentlyFocusedTextInput != null &&
!isTagInstanceOfTextInput(e.target)
) {
if (keyboardNeverPersistTaps && currentlyFocusedTextInput != null) {
return true;
}
return this.scrollResponderIsAnimating();
Expand Down
4 changes: 2 additions & 2 deletionsLibraries/Components/View/View.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -61,8 +61,8 @@ const View = createReactClass({

render: function() {
invariant(
!(this.context.isInAParentText && Platform.OS === 'android'),
'Nesting of <View> within <Text> is notsupported on Android.');
!this.context.isInAParentText,
'Nesting of <View> within <Text> is notcurrently supported.');

// 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
Expand Down
2 changes: 1 addition & 1 deletionLibraries/Core/InitializeCore.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -103,7 +103,7 @@ Object.defineProperty(global.process, 'argv',
// Setup the Systrace profiling hooks if necessary
if (global.__RCTProfileIsProfiling) {
const Systrace = require('Systrace');
Systrace.installReactHook(true);
Systrace.installReactHook();
Systrace.setEnabled(true);
}

Expand Down
2 changes: 1 addition & 1 deletionLibraries/Interaction/PanResponder.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -12,7 +12,7 @@
'use strict';

const InteractionManager = require('./InteractionManager');
const TouchHistoryMath = require('TouchHistoryMath');
const TouchHistoryMath = require('./TouchHistoryMath');

const currentCentroidXOfTouchesChangedAfter = TouchHistoryMath.currentCentroidXOfTouchesChangedAfter;
const currentCentroidYOfTouchesChangedAfter = TouchHistoryMath.currentCentroidYOfTouchesChangedAfter;
Expand Down
151 changes: 151 additions & 0 deletionsLibraries/Interaction/TouchHistoryMath.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
/**
* Copyright (c) 2016-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.
*/

const TouchHistoryMath = {
/**
* This code is optimized and not intended to look beautiful. This allows
* computing of touch centroids that have moved after `touchesChangedAfter`
* timeStamp. You can compute the current centroid involving all touches
* moves after `touchesChangedAfter`, or you can compute the previous
* centroid of all touches that were moved after `touchesChangedAfter`.
*
* @param {TouchHistoryMath} touchHistory Standard Responder touch track
* data.
* @param {number} touchesChangedAfter timeStamp after which moved touches
* are considered "actively moving" - not just "active".
* @param {boolean} isXAxis Consider `x` dimension vs. `y` dimension.
* @param {boolean} ofCurrent Compute current centroid for actively moving
* touches vs. previous centroid of now actively moving touches.
* @return {number} value of centroid in specified dimension.
*/
centroidDimension: function(
touchHistory,
touchesChangedAfter,
isXAxis,
ofCurrent,
) {
const touchBank = touchHistory.touchBank;
let total = 0;
let count = 0;

const oneTouchData =
touchHistory.numberActiveTouches === 1
? touchHistory.touchBank[touchHistory.indexOfSingleActiveTouch]
: null;

if (oneTouchData !== null) {
if (
oneTouchData.touchActive &&
oneTouchData.currentTimeStamp > touchesChangedAfter
) {
total +=
ofCurrent && isXAxis
? oneTouchData.currentPageX
: ofCurrent && !isXAxis
? oneTouchData.currentPageY
: !ofCurrent && isXAxis
? oneTouchData.previousPageX
: oneTouchData.previousPageY;
count = 1;
}
} else {
for (let i = 0; i < touchBank.length; i++) {
const touchTrack = touchBank[i];
if (
touchTrack !== null &&
touchTrack !== undefined &&
touchTrack.touchActive &&
touchTrack.currentTimeStamp >= touchesChangedAfter
) {
let toAdd; // Yuck, program temporarily in invalid state.
if (ofCurrent && isXAxis) {
toAdd = touchTrack.currentPageX;
} else if (ofCurrent && !isXAxis) {
toAdd = touchTrack.currentPageY;
} else if (!ofCurrent && isXAxis) {
toAdd = touchTrack.previousPageX;
} else {
toAdd = touchTrack.previousPageY;
}
total += toAdd;
count++;
}
}
}
return count > 0 ? total / count : TouchHistoryMath.noCentroid;
},

currentCentroidXOfTouchesChangedAfter: function(
touchHistory,
touchesChangedAfter,
) {
return TouchHistoryMath.centroidDimension(
touchHistory,
touchesChangedAfter,
true, // isXAxis
true, // ofCurrent
);
},

currentCentroidYOfTouchesChangedAfter: function(
touchHistory,
touchesChangedAfter,
) {
return TouchHistoryMath.centroidDimension(
touchHistory,
touchesChangedAfter,
false, // isXAxis
true, // ofCurrent
);
},

previousCentroidXOfTouchesChangedAfter: function(
touchHistory,
touchesChangedAfter,
) {
return TouchHistoryMath.centroidDimension(
touchHistory,
touchesChangedAfter,
true, // isXAxis
false, // ofCurrent
);
},

previousCentroidYOfTouchesChangedAfter: function(
touchHistory,
touchesChangedAfter,
) {
return TouchHistoryMath.centroidDimension(
touchHistory,
touchesChangedAfter,
false, // isXAxis
false, // ofCurrent
);
},

currentCentroidX: function(touchHistory) {
return TouchHistoryMath.centroidDimension(
touchHistory,
0, // touchesChangedAfter
true, // isXAxis
true, // ofCurrent
);
},

currentCentroidY: function(touchHistory) {
return TouchHistoryMath.centroidDimension(
touchHistory,
0, // touchesChangedAfter
false, // isXAxis
true, // ofCurrent
);
},

noCentroid: -1,
};

module.exports = TouchHistoryMath;
64 changes: 8 additions & 56 deletionsLibraries/Performance/Systrace.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -34,7 +34,6 @@ let _asyncCookie = 0;
const _markStack = [];
let _markStackIndex = -1;
let _canInstallReactHook = false;
let _useFiber = false;

// Implements a subset of User Timing API necessary for React measurements.
// https://developer.mozilla.org/en-US/docs/Web/API/User_Timing_API
Expand DownExpand Up@@ -100,54 +99,13 @@ const userTimingPolyfill = __DEV__ ? {
},
} : null;

// A hook to get React Stack markers in Systrace.
const reactDebugToolHook = __DEV__ ? {
onBeforeMountComponent(debugID) {
const ReactComponentTreeHook = require('ReactGlobalSharedState').ReactComponentTreeHook;
const displayName = ReactComponentTreeHook.getDisplayName(debugID);
Systrace.beginEvent(`ReactReconciler.mountComponent(${displayName})`);
},
onMountComponent(debugID) {
Systrace.endEvent();
},
onBeforeUpdateComponent(debugID) {
const ReactComponentTreeHook = require('ReactGlobalSharedState').ReactComponentTreeHook;
const displayName = ReactComponentTreeHook.getDisplayName(debugID);
Systrace.beginEvent(`ReactReconciler.updateComponent(${displayName})`);
},
onUpdateComponent(debugID) {
Systrace.endEvent();
},
onBeforeUnmountComponent(debugID) {
const ReactComponentTreeHook = require('ReactGlobalSharedState').ReactComponentTreeHook;
const displayName = ReactComponentTreeHook.getDisplayName(debugID);
Systrace.beginEvent(`ReactReconciler.unmountComponent(${displayName})`);
},
onUnmountComponent(debugID) {
Systrace.endEvent();
},
onBeginLifeCycleTimer(debugID, timerType) {
const ReactComponentTreeHook = require('ReactGlobalSharedState').ReactComponentTreeHook;
const displayName = ReactComponentTreeHook.getDisplayName(debugID);
Systrace.beginEvent(`${displayName}.${timerType}()`);
},
onEndLifeCycleTimer(debugID, timerType) {
Systrace.endEvent();
},
} : null;

const Systrace = {
installReactHook(useFiber: boolean) {
installReactHook() {
if (_enabled) {
if (__DEV__) {
if (useFiber) {
global.performance = userTimingPolyfill;
} else {
require('ReactDebugTool').addHook(reactDebugToolHook);
}
global.performance = userTimingPolyfill;
}
}
_useFiber = useFiber;
_canInstallReactHook = true;
},

Expand All@@ -160,17 +118,8 @@ const Systrace = {
global.nativeTraceEndLegacy && global.nativeTraceEndLegacy(TRACE_TAG_JS_VM_CALLS);
}
if (_canInstallReactHook) {
if (_useFiber) {
if (enabled && global.performance === undefined) {
global.performance = userTimingPolyfill;
}
} else {
const ReactDebugTool = require('ReactDebugTool');
if (enabled) {
ReactDebugTool.addHook(reactDebugToolHook);
} else {
ReactDebugTool.removeHook(reactDebugToolHook);
}
if (enabled && global.performance === undefined) {
global.performance = userTimingPolyfill;
}
}
}
Expand DownExpand Up@@ -240,7 +189,10 @@ const Systrace = {
* therefore async variant of profiling is used
**/
attachToRelayProfiler(relayProfiler: RelayProfiler) {
relayProfiler.attachProfileHandler('*', (name) => {
relayProfiler.attachProfileHandler('*', (name, state?) => {
if (state != null && state.queryName !== undefined) {
name += '_' + state.queryName;
}
const cookie = Systrace.beginAsyncEvent(name);
return () => {
Systrace.endAsyncEvent(name, cookie);
Expand Down
6 changes: 0 additions & 6 deletionsLibraries/ReactNative/requireNativeComponent.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -13,7 +13,6 @@
'use strict';

const Platform = require('Platform');
const ReactNativeBridgeEventPlugin = require('ReactNativeBridgeEventPlugin');
const ReactNativeStyleAttributes = require('ReactNativeStyleAttributes');
const UIManager = require('UIManager');

Expand DownExpand Up@@ -185,11 +184,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;
}

Expand Down
48 changes: 48 additions & 0 deletionsLibraries/ReactNative/takeSnapshot.js
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
/**
* 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 takeSnapshot
* @format
* @flow
*/

const ReactNative = require('ReactNative');
const UIManager = require('UIManager');

/**
* Capture an image of the screen, window or an individual view. The image
* will be stored in a temporary file that will only exist for as long as the
* app is running.
*
* The `view` argument can be the literal string `window` if you want to
* capture the entire window, or it can be a reference to a specific
* React Native component.
*
* The `options` argument may include:
* - width/height (number) - the width and height of the image to capture.
* - format (string) - either 'png' or 'jpeg'. Defaults to 'png'.
* - quality (number) - the quality when using jpeg. 0.0 - 1.0 (default).
*
* Returns a Promise.
* @platform ios
*/
module.exports = function takeSnapshot(
view?: 'window' | React$Element<any> | number,
options?: {
width?: number,
height?: number,
format?: 'png' | 'jpeg',
quality?: number,
},
): Promise<any> {
if (typeof view !== 'number' && view !== 'window') {
view = ReactNative.findNodeHandle(view) || 'window';
}

// Call the hidden '__takeSnapshot' method; the main one throws an error to
// prevent accidental backwards-incompatible usage.
return UIManager.__takeSnapshot(view, options);
};
2 changes: 1 addition & 1 deletionLibraries/Renderer/REVISION
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
9491dee79586d21c115cd4d5986c81b7d88d2b3f
8e25ed20bd27d126f670d04680db85209f779056
Loading

[8]ページ先頭

©2009-2025 Movatter.jp