From 9f33fe258312987f490cc0f3a71c0c4f93494e7f Mon Sep 17 00:00:00 2001 From: Adam Ernst Date: Wed, 6 Dec 2017 17:25:06 -0800 Subject: [PATCH] Upgrade to 1.9.1 Reviewed By: vjeux Differential Revision: D6497877 fbshipit-source-id: 3b88b96e375ddf1fbe039a0593569bbdde40a2dc --- .../Animated/src/AnimatedImplementation.js | 38 +++++++-------- .../Animated/src/NativeAnimatedHelper.js | 4 +- Libraries/Animated/src/nodes/AnimatedValue.js | 26 +++++----- .../Animated/src/nodes/AnimatedValueXY.js | 48 +++++++++---------- Libraries/Blob/URL.js | 4 +- Libraries/CameraRoll/CameraRoll.js | 4 +- Libraries/Lists/ViewabilityHelper.js | 22 ++++----- Libraries/ReactNative/AppRegistry.js | 12 ++--- Libraries/ReactNative/YellowBox.js | 3 +- RNTester/js/CheckBoxExample.js | 6 ++- .../server/util/debugger-ui/DeltaPatcher.js | 16 +++---- package.json | 2 +- 12 files changed, 96 insertions(+), 89 deletions(-) diff --git a/Libraries/Animated/src/AnimatedImplementation.js b/Libraries/Animated/src/AnimatedImplementation.js index ef5669276..08d69c3bd 100644 --- a/Libraries/Animated/src/AnimatedImplementation.js +++ b/Libraries/Animated/src/AnimatedImplementation.js @@ -528,14 +528,14 @@ module.exports = { ValueXY: AnimatedValueXY, /** * Exported to use the Interpolation type in flow. - * + * * See http://facebook.github.io/react-native/docs/animated.html#interpolation */ Interpolation: AnimatedInterpolation, /** * Exported for ease of type checking. All animated values derive from this * class. - * + * * See http://facebook.github.io/react-native/docs/animated.html#node */ Node: AnimatedNode, @@ -557,7 +557,7 @@ module.exports = { /** * Animates a value according to an analytical spring model based on * damped harmonic oscillation. - * + * * See http://facebook.github.io/react-native/docs/animated.html#spring */ spring, @@ -565,7 +565,7 @@ module.exports = { /** * Creates a new Animated value composed from two Animated values added * together. - * + * * See http://facebook.github.io/react-native/docs/animated.html#add */ add, @@ -573,7 +573,7 @@ module.exports = { /** * Creates a new Animated value composed by dividing the first Animated value * by the second Animated value. - * + * * See http://facebook.github.io/react-native/docs/animated.html#divide */ divide, @@ -581,7 +581,7 @@ module.exports = { /** * Creates a new Animated value composed from two Animated values multiplied * together. - * + * * See http://facebook.github.io/react-native/docs/animated.html#multiply */ multiply, @@ -589,7 +589,7 @@ module.exports = { /** * Creates a new Animated value that is the (non-negative) modulo of the * provided Animated value. - * + * * See http://facebook.github.io/react-native/docs/animated.html#modulo */ modulo, @@ -598,14 +598,14 @@ module.exports = { * Create a new Animated value that is limited between 2 values. It uses the * difference between the last value so even if the value is far from the * bounds it will start changing when the value starts getting closer again. - * + * * See http://facebook.github.io/react-native/docs/animated.html#diffclamp */ diffClamp, /** * Starts an animation after the given delay. - * + * * See http://facebook.github.io/react-native/docs/animated.html#delay */ delay, @@ -613,7 +613,7 @@ module.exports = { * Starts an array of animations in order, waiting for each to complete * before starting the next. If the current running animation is stopped, no * following animations will be started. - * + * * See http://facebook.github.io/react-native/docs/animated.html#sequence */ sequence, @@ -621,44 +621,44 @@ module.exports = { * Starts an array of animations all at the same time. By default, if one * of the animations is stopped, they will all be stopped. You can override * this with the `stopTogether` flag. - * + * * See http://facebook.github.io/react-native/docs/animated.html#parallel */ parallel, /** * Array of animations may run in parallel (overlap), but are started in * sequence with successive delays. Nice for doing trailing effects. - * + * * See http://facebook.github.io/react-native/docs/animated.html#stagger */ stagger, /** * Loops a given animation continuously, so that each time it reaches the * end, it resets and begins again from the start. - * + * * See http://facebook.github.io/react-native/docs/animated.html#loop - */ + */ loop, /** * Takes an array of mappings and extracts values from each arg accordingly, * then calls `setValue` on the mapped outputs. - * + * * See http://facebook.github.io/react-native/docs/animated.html#event */ event, /** * Make any React component Animatable. Used to create `Animated.View`, etc. - * + * * See http://facebook.github.io/react-native/docs/animated.html#createanimatedcomponent */ createAnimatedComponent, /** - * Imperative API to attach an animated value to an event on a view. Prefer + * Imperative API to attach an animated value to an event on a view. Prefer * using `Animated.event` with `useNativeDrive: true` if possible. - * + * * See http://facebook.github.io/react-native/docs/animated.html#attachnativeevent */ attachNativeEvent, @@ -666,7 +666,7 @@ module.exports = { /** * Advanced imperative API for snooping on animated events that are passed in * through props. Use values directly where possible. - * + * * See http://facebook.github.io/react-native/docs/animated.html#forkevent */ forkEvent, diff --git a/Libraries/Animated/src/NativeAnimatedHelper.js b/Libraries/Animated/src/NativeAnimatedHelper.js index 521ecfa7f..ab7c7df15 100644 --- a/Libraries/Animated/src/NativeAnimatedHelper.js +++ b/Libraries/Animated/src/NativeAnimatedHelper.js @@ -173,7 +173,9 @@ function validateTransform(configs: Array): void { configs.forEach(config => { if (!TRANSFORM_WHITELIST.hasOwnProperty(config.property)) { throw new Error( - `Property '${config.property}' is not supported by native animated module`, + `Property '${ + config.property + }' is not supported by native animated module`, ); } }); diff --git a/Libraries/Animated/src/nodes/AnimatedValue.js b/Libraries/Animated/src/nodes/AnimatedValue.js index 03a8077e2..49f440471 100644 --- a/Libraries/Animated/src/nodes/AnimatedValue.js +++ b/Libraries/Animated/src/nodes/AnimatedValue.js @@ -68,7 +68,7 @@ function _flush(rootNode: AnimatedValue): void { * multiple properties in a synchronized fashion, but can only be driven by one * mechanism at a time. Using a new mechanism (e.g. starting a new animation, * or calling `setValue`) will stop any previous ones. - * + * * See http://facebook.github.io/react-native/docs/animatedvalue.html */ class AnimatedValue extends AnimatedWithChildren { @@ -108,7 +108,7 @@ class AnimatedValue extends AnimatedWithChildren { /** * Directly set the value. This will stop any animations running on the value * and update all the bound properties. - * + * * See http://facebook.github.io/react-native/docs/animatedvalue.html#setvalue */ setValue(value: number): void { @@ -129,7 +129,7 @@ class AnimatedValue extends AnimatedWithChildren { * Sets an offset that is applied on top of whatever value is set, whether via * `setValue`, an animation, or `Animated.event`. Useful for compensating * things like the start of a pan gesture. - * + * * See http://facebook.github.io/react-native/docs/animatedvalue.html#setoffset */ setOffset(offset: number): void { @@ -142,7 +142,7 @@ class AnimatedValue extends AnimatedWithChildren { /** * Merges the offset value into the base value and resets the offset to zero. * The final output of the value is unchanged. - * + * * See http://facebook.github.io/react-native/docs/animatedvalue.html#flattenoffset */ flattenOffset(): void { @@ -156,7 +156,7 @@ class AnimatedValue extends AnimatedWithChildren { /** * Sets the offset value to the base value, and resets the base value to zero. * The final output of the value is unchanged. - * + * * See http://facebook.github.io/react-native/docs/animatedvalue.html#extractoffset */ extractOffset(): void { @@ -171,7 +171,7 @@ class AnimatedValue extends AnimatedWithChildren { * Adds an asynchronous listener to the value so you can observe updates from * animations. This is useful because there is no way to * synchronously read the value because it might be driven natively. - * + * * See http://facebook.github.io/react-native/docs/animatedvalue.html#addlistener */ addListener(callback: ValueListenerCallback): string { @@ -184,9 +184,9 @@ class AnimatedValue extends AnimatedWithChildren { } /** - * Unregister a listener. The `id` param shall match the identifier - * previously returned by `addListener()`. - * + * Unregister a listener. The `id` param shall match the identifier + * previously returned by `addListener()`. + * * See http://facebook.github.io/react-native/docs/animatedvalue.html#removelistener */ removeListener(id: string): void { @@ -198,7 +198,7 @@ class AnimatedValue extends AnimatedWithChildren { /** * Remove all registered listeners. - * + * * See http://facebook.github.io/react-native/docs/animatedvalue.html#removealllisteners */ removeAllListeners(): void { @@ -239,7 +239,7 @@ class AnimatedValue extends AnimatedWithChildren { * Stops any running animation or tracking. `callback` is invoked with the * final value after stopping the animation, which is useful for updating * state to match the animation position with layout. - * + * * See http://facebook.github.io/react-native/docs/animatedvalue.html#stopanimation */ stopAnimation(callback?: ?(value: number) => void): void { @@ -251,7 +251,7 @@ class AnimatedValue extends AnimatedWithChildren { /** * Stops any animation and resets the value to its original. - * + * * See http://facebook.github.io/react-native/docs/animatedvalue.html#resetanimation */ resetAnimation(callback?: ?(value: number) => void): void { @@ -270,7 +270,7 @@ class AnimatedValue extends AnimatedWithChildren { /** * Typically only used internally, but could be used by a custom Animation * class. - * + * * See http://facebook.github.io/react-native/docs/animatedvalue.html#animate */ animate(animation: Animation, callback: ?EndCallback): void { diff --git a/Libraries/Animated/src/nodes/AnimatedValueXY.js b/Libraries/Animated/src/nodes/AnimatedValueXY.js index d04fe0940..496ccd795 100644 --- a/Libraries/Animated/src/nodes/AnimatedValueXY.js +++ b/Libraries/Animated/src/nodes/AnimatedValueXY.js @@ -22,9 +22,9 @@ type ValueXYListenerCallback = (value: {x: number, y: number}) => void; let _uniqueId = 1; /** - * 2D Value for driving 2D animations, such as pan gestures. Almost identical + * 2D Value for driving 2D animations, such as pan gestures. Almost identical * API to normal `Animated.Value`, but multiplexed. - * + * * See http://facebook.github.io/react-native/docs/animatedvaluexy.html */ class AnimatedValueXY extends AnimatedWithChildren { @@ -55,7 +55,7 @@ class AnimatedValueXY extends AnimatedWithChildren { /** * Directly set the value. This will stop any animations running on the value * and update all the bound properties. - * + * * See http://facebook.github.io/react-native/docs/animatedvaluexy.html#setvalue */ setValue(value: {x: number, y: number}) { @@ -64,10 +64,10 @@ class AnimatedValueXY extends AnimatedWithChildren { } /** - * Sets an offset that is applied on top of whatever value is set, whether - * via `setValue`, an animation, or `Animated.event`. Useful for compensating + * Sets an offset that is applied on top of whatever value is set, whether + * via `setValue`, an animation, or `Animated.event`. Useful for compensating * things like the start of a pan gesture. - * + * * See http://facebook.github.io/react-native/docs/animatedvaluexy.html#setoffset */ setOffset(offset: {x: number, y: number}) { @@ -76,9 +76,9 @@ class AnimatedValueXY extends AnimatedWithChildren { } /** - * Merges the offset value into the base value and resets the offset to zero. + * Merges the offset value into the base value and resets the offset to zero. * The final output of the value is unchanged. - * + * * See http://facebook.github.io/react-native/docs/animatedvaluexy.html#flattenoffset */ flattenOffset(): void { @@ -87,9 +87,9 @@ class AnimatedValueXY extends AnimatedWithChildren { } /** - * Sets the offset value to the base value, and resets the base value to + * Sets the offset value to the base value, and resets the base value to * zero. The final output of the value is unchanged. - * + * * See http://facebook.github.io/react-native/docs/animatedvaluexy.html#extractoffset */ extractOffset(): void { @@ -106,7 +106,7 @@ class AnimatedValueXY extends AnimatedWithChildren { /** * Stops any animation and resets the value to its original. - * + * * See http://facebook.github.io/react-native/docs/animatedvaluexy.html#resetanimation */ resetAnimation(callback?: (value: {x: number, y: number}) => void): void { @@ -116,10 +116,10 @@ class AnimatedValueXY extends AnimatedWithChildren { } /** - * Stops any running animation or tracking. `callback` is invoked with the - * final value after stopping the animation, which is useful for updating + * Stops any running animation or tracking. `callback` is invoked with the + * final value after stopping the animation, which is useful for updating * state to match the animation position with layout. - * + * * See http://facebook.github.io/react-native/docs/animatedvaluexy.html#stopanimation */ stopAnimation(callback?: (value: {x: number, y: number}) => void): void { @@ -129,12 +129,12 @@ class AnimatedValueXY extends AnimatedWithChildren { } /** - * Adds an asynchronous listener to the value so you can observe updates from - * animations. This is useful because there is no way to synchronously read + * Adds an asynchronous listener to the value so you can observe updates from + * animations. This is useful because there is no way to synchronously read * the value because it might be driven natively. - * + * * Returns a string that serves as an identifier for the listener. - * + * * See http://facebook.github.io/react-native/docs/animatedvaluexy.html#addlistener */ addListener(callback: ValueXYListenerCallback): string { @@ -150,9 +150,9 @@ class AnimatedValueXY extends AnimatedWithChildren { } /** - * Unregister a listener. The `id` param shall match the identifier - * previously returned by `addListener()`. - * + * Unregister a listener. The `id` param shall match the identifier + * previously returned by `addListener()`. + * * See http://facebook.github.io/react-native/docs/animatedvaluexy.html#removelistener */ removeListener(id: string): void { @@ -163,7 +163,7 @@ class AnimatedValueXY extends AnimatedWithChildren { /** * Remove all registered listeners. - * + * * See http://facebook.github.io/react-native/docs/animatedvaluexy.html#removealllisteners */ removeAllListeners(): void { @@ -174,7 +174,7 @@ class AnimatedValueXY extends AnimatedWithChildren { /** * Converts `{x, y}` into `{left, top}` for use in style. - * + * * See http://facebook.github.io/react-native/docs/animatedvaluexy.html#getlayout */ getLayout(): {[key: string]: AnimatedValue} { @@ -186,7 +186,7 @@ class AnimatedValueXY extends AnimatedWithChildren { /** * Converts `{x, y}` into a useable translation transform. - * + * * See http://facebook.github.io/react-native/docs/animatedvaluexy.html#gettranslatetransform */ getTranslateTransform(): Array<{[key: string]: AnimatedValue}> { diff --git a/Libraries/Blob/URL.js b/Libraries/Blob/URL.js index eddddf258..ed40cae65 100644 --- a/Libraries/Blob/URL.js +++ b/Libraries/Blob/URL.js @@ -59,7 +59,9 @@ class URL { if (BLOB_URL_PREFIX === null) { throw new Error('Cannot create URL for blob!'); } - return `${BLOB_URL_PREFIX}${blob.blobId}?offset=${blob.offset}&size=${blob.size}`; + return `${BLOB_URL_PREFIX}${blob.blobId}?offset=${blob.offset}&size=${ + blob.size + }`; } static revokeObjectURL(url: string) { diff --git a/Libraries/CameraRoll/CameraRoll.js b/Libraries/CameraRoll/CameraRoll.js index eccad7d52..709532e04 100644 --- a/Libraries/CameraRoll/CameraRoll.js +++ b/Libraries/CameraRoll/CameraRoll.js @@ -63,8 +63,8 @@ const getPhotosParamChecker = createStrictShapeTypeChecker({ groupName: PropTypes.string, /** - * Specifies filter on asset type - */ + * Specifies filter on asset type + */ assetType: PropTypes.oneOf(Object.keys(ASSET_TYPE_OPTIONS)), /** diff --git a/Libraries/Lists/ViewabilityHelper.js b/Libraries/Lists/ViewabilityHelper.js index 858bb4d07..03c84abdb 100644 --- a/Libraries/Lists/ViewabilityHelper.js +++ b/Libraries/Lists/ViewabilityHelper.js @@ -60,17 +60,17 @@ export type ViewabilityConfig = {| |}; /** -* A Utility class for calculating viewable items based on current metrics like scroll position and -* layout. -* -* An item is said to be in a "viewable" state when any of the following -* is true for longer than `minimumViewTime` milliseconds (after an interaction if `waitForInteraction` -* is true): -* -* - Occupying >= `viewAreaCoveragePercentThreshold` of the view area XOR fraction of the item -* visible in the view area >= `itemVisiblePercentThreshold`. -* - Entirely visible on screen -*/ + * A Utility class for calculating viewable items based on current metrics like scroll position and + * layout. + * + * An item is said to be in a "viewable" state when any of the following + * is true for longer than `minimumViewTime` milliseconds (after an interaction if `waitForInteraction` + * is true): + * + * - Occupying >= `viewAreaCoveragePercentThreshold` of the view area XOR fraction of the item + * visible in the view area >= `itemVisiblePercentThreshold`. + * - Entirely visible on screen + */ class ViewabilityHelper { _config: ViewabilityConfig; _hasInteracted: boolean = false; diff --git a/Libraries/ReactNative/AppRegistry.js b/Libraries/ReactNative/AppRegistry.js index c7d0ebe6d..98699f18f 100644 --- a/Libraries/ReactNative/AppRegistry.js +++ b/Libraries/ReactNative/AppRegistry.js @@ -59,7 +59,7 @@ let wrapperComponentProvider: ?WrapperComponentProvider; /** * `AppRegistry` is the JavaScript entry point to running all React Native apps. - * + * * See http://facebook.github.io/react-native/docs/appregistry.html */ const AppRegistry = { @@ -89,7 +89,7 @@ const AppRegistry = { /** * Registers an app's root component. - * + * * See http://facebook.github.io/react-native/docs/appregistry.html#registercomponent */ registerComponent( @@ -155,7 +155,7 @@ const AppRegistry = { /** * Loads the JavaScript bundle and runs the app. - * + * * See http://facebook.github.io/react-native/docs/appregistry.html#runapplication */ runApplication(appKey: string, appParameters: any): void { @@ -197,8 +197,8 @@ const AppRegistry = { }, /** - * Stops an application when a view should be destroyed. - * + * Stops an application when a view should be destroyed. + * * See http://facebook.github.io/react-native/docs/appregistry.html#unmountapplicationcomponentatroottag */ unmountApplicationComponentAtRootTag(rootTag: number): void { @@ -207,7 +207,7 @@ const AppRegistry = { /** * Register a headless task. A headless task is a bit of code that runs without a UI. - * + * * See http://facebook.github.io/react-native/docs/appregistry.html#registerheadlesstask */ registerHeadlessTask(taskKey: string, task: TaskProvider): void { diff --git a/Libraries/ReactNative/YellowBox.js b/Libraries/ReactNative/YellowBox.js index 88e786ab0..08421ad25 100644 --- a/Libraries/ReactNative/YellowBox.js +++ b/Libraries/ReactNative/YellowBox.js @@ -398,7 +398,8 @@ class YellowBox extends React.Component< onDismissAll={() => this.dismissWarning(null)} onMinimize={() => this.setState({inspecting: null})} toggleStacktrace={() => - this.setState({stacktraceVisible: !stacktraceVisible})} + this.setState({stacktraceVisible: !stacktraceVisible}) + } /> ) : null; diff --git a/RNTester/js/CheckBoxExample.js b/RNTester/js/CheckBoxExample.js index 9e7b8f5db..42e689180 100644 --- a/RNTester/js/CheckBoxExample.js +++ b/RNTester/js/CheckBoxExample.js @@ -75,13 +75,15 @@ class EventCheckBoxExample extends React.Component<{}, $FlowFixMeState> { - this.setState({eventCheckBoxRegressionIsOn: value})} + this.setState({eventCheckBoxRegressionIsOn: value}) + } style={{marginBottom: 10}} value={this.state.eventCheckBoxRegressionIsOn} /> - this.setState({eventCheckBoxRegressionIsOn: value})} + this.setState({eventCheckBoxRegressionIsOn: value}) + } style={{marginBottom: 10}} value={this.state.eventCheckBoxRegressionIsOn} /> diff --git a/local-cli/server/util/debugger-ui/DeltaPatcher.js b/local-cli/server/util/debugger-ui/DeltaPatcher.js index d087db202..1787307b9 100644 --- a/local-cli/server/util/debugger-ui/DeltaPatcher.js +++ b/local-cli/server/util/debugger-ui/DeltaPatcher.js @@ -10,14 +10,14 @@ */ /** - * This file is a copy of the reference `DeltaPatcher`, located in - * metro. The reason to not reuse that file is that in this context - * we cannot have flow annotations or CJS syntax (since this file is directly) - * injected into a static HTML page. - * - * TODO: Find a simple and lightweight way to compile `DeltaPatcher` to avoid - * having this duplicated file. - */ + * This file is a copy of the reference `DeltaPatcher`, located in + * metro. The reason to not reuse that file is that in this context + * we cannot have flow annotations or CJS syntax (since this file is directly) + * injected into a static HTML page. + * + * TODO: Find a simple and lightweight way to compile `DeltaPatcher` to avoid + * having this duplicated file. + */ (function(global) { 'use strict'; diff --git a/package.json b/package.json index 78f04ad68..75f4ae565 100644 --- a/package.json +++ b/package.json @@ -208,7 +208,7 @@ "eslint-plugin-react": "^7.2.1", "flow-bin": "^0.60.1", "jest": "21.3.0-beta.13", - "prettier": "1.7.0", + "prettier": "1.9.1", "react": "16.2.0", "react-test-renderer": "16.2.0", "shelljs": "^0.7.8",