From 38d2109f24644d0c4065a9e67bb8fe386b187af7 Mon Sep 17 00:00:00 2001 From: Thomas BARRAS Date: Thu, 27 Sep 2018 14:03:07 -0400 Subject: [PATCH 1/9] TVViewPropTypes, PlatformViewPropTypes, DeprecatedTVViewPropTypes --- .../Components/AppleTV/TVViewPropTypes.js | 53 +++++-------- .../View/PlatformViewPropTypes.android.js | 13 ++++ .../View/PlatformViewPropTypes.ios.js | 15 ++++ .../Components/View/PlatformViewPropTypes.js | 21 ----- .../DeprecatedTVViewPropTypes.js | 76 +++++++++++++++++++ 5 files changed, 125 insertions(+), 53 deletions(-) create mode 100644 Libraries/Components/View/PlatformViewPropTypes.android.js create mode 100644 Libraries/Components/View/PlatformViewPropTypes.ios.js delete mode 100644 Libraries/Components/View/PlatformViewPropTypes.js create mode 100644 Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js diff --git a/Libraries/Components/AppleTV/TVViewPropTypes.js b/Libraries/Components/AppleTV/TVViewPropTypes.js index 764dfbb8ac5d..3d30fbaffa3d 100644 --- a/Libraries/Components/AppleTV/TVViewPropTypes.js +++ b/Libraries/Components/AppleTV/TVViewPropTypes.js @@ -1,30 +1,34 @@ /** - * Copyright (c) Facebook, Inc. and its affiliates. + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. * - * @format + * @providesModule TVViewPropTypes * @flow */ - 'use strict'; -const PropTypes = require('prop-types'); /** * Additional View properties for Apple TV */ -const TVViewPropTypes = { +export type TVViewProps = { /** - * When set to true, this view will be focusable - * and navigable using the TV remote. + * *(Apple TV only)* When set to true, this view will be focusable + * and navigable using the Apple TV remote. + * + * @platform ios */ - isTVSelectable: PropTypes.bool, + isTVSelectable?: bool, /** - * May be set to true to force the TV focus engine to move focus to this view. + * *(Apple TV only)* May be set to true to force the Apple TV focus engine to move focus to this view. + * + * @platform ios */ - hasTVPreferredFocus: PropTypes.bool, + hasTVPreferredFocus?: bool, /** * *(Apple TV only)* Object with properties to control Apple TV parallax effects. @@ -34,51 +38,36 @@ const TVViewPropTypes = { * shiftDistanceY: Defaults to 2.0. * tiltAngle: Defaults to 0.05. * magnification: Defaults to 1.0. - * pressMagnification: Defaults to 1.0. - * pressDuration: Defaults to 0.3. - * pressDelay: Defaults to 0.0. * * @platform ios */ - tvParallaxProperties: PropTypes.object, + tvParallaxProperties?: Object, /** * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 2.0. * * @platform ios */ - tvParallaxShiftDistanceX: PropTypes.number, + tvParallaxShiftDistanceX?: number, /** * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 2.0. * * @platform ios */ - tvParallaxShiftDistanceY: PropTypes.number, + tvParallaxShiftDistanceY?: number, /** * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 0.05. * * @platform ios */ - tvParallaxTiltAngle: PropTypes.number, + tvParallaxTiltAngle?: number, /** * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 1.0. * * @platform ios */ - tvParallaxMagnification: PropTypes.number, -}; - -export type TVViewProps = $ReadOnly<{| - isTVSelectable?: boolean, - hasTVPreferredFocus?: boolean, - tvParallaxProperties?: Object, - tvParallaxShiftDistanceX?: number, - tvParallaxShiftDistanceY?: number, - tvParallaxTiltAngle?: number, tvParallaxMagnification?: number, -|}>; - -module.exports = TVViewPropTypes; +}; \ No newline at end of file diff --git a/Libraries/Components/View/PlatformViewPropTypes.android.js b/Libraries/Components/View/PlatformViewPropTypes.android.js new file mode 100644 index 000000000000..9cd254714711 --- /dev/null +++ b/Libraries/Components/View/PlatformViewPropTypes.android.js @@ -0,0 +1,13 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule PlatformViewPropTypes + * @flow + */ + +export type PlatformViewPropTypes = {}; \ No newline at end of file diff --git a/Libraries/Components/View/PlatformViewPropTypes.ios.js b/Libraries/Components/View/PlatformViewPropTypes.ios.js new file mode 100644 index 000000000000..b80b85300b28 --- /dev/null +++ b/Libraries/Components/View/PlatformViewPropTypes.ios.js @@ -0,0 +1,15 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @providesModule PlatformViewPropTypes + * @flow + */ + +import type {TVViewProps} from 'TVViewPropTypes'; + +export type PlatformViewPropTypes = TVViewProps; \ No newline at end of file diff --git a/Libraries/Components/View/PlatformViewPropTypes.js b/Libraries/Components/View/PlatformViewPropTypes.js deleted file mode 100644 index 282465fdcdd4..000000000000 --- a/Libraries/Components/View/PlatformViewPropTypes.js +++ /dev/null @@ -1,21 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow strict-local - */ - -const Platform = require('Platform'); - -let TVViewPropTypes = {}; -// We need to always include TVViewPropTypes on Android -// as unlike on iOS we can't detect TV devices at build time -// and hence make view manager export a different list of native properties. -if (Platform.isTV || Platform.OS === 'android') { - TVViewPropTypes = require('TVViewPropTypes'); -} - -module.exports = TVViewPropTypes; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js new file mode 100644 index 000000000000..2a14f100c2d7 --- /dev/null +++ b/Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js @@ -0,0 +1,76 @@ +/** + * Copyright (c) 2015-present, Facebook, Inc. + * All rights reserved. + * + * This source code is licensed under the BSD-style license found in the + * LICENSE file in the root directory of this source tree. An additional grant + * of patent rights can be found in the PATENTS file in the same directory. + * + * @flow + * @format + */ +'use strict'; +var PropTypes = require('prop-types'); + +/** + * Additional View properties for Apple TV + */ +var DeprecatedTVViewPropTypes = { + /** + * *(Apple TV only)* When set to true, this view will be focusable + * and navigable using the Apple TV remote. + * + * @platform ios + */ + isTVSelectable: PropTypes.bool, + + /** + * *(Apple TV only)* May be set to true to force the Apple TV focus engine to move focus to this view. + * + * @platform ios + */ + hasTVPreferredFocus: PropTypes.bool, + + /** + * *(Apple TV only)* Object with properties to control Apple TV parallax effects. + * + * enabled: If true, parallax effects are enabled. Defaults to true. + * shiftDistanceX: Defaults to 2.0. + * shiftDistanceY: Defaults to 2.0. + * tiltAngle: Defaults to 0.05. + * magnification: Defaults to 1.0. + * + * @platform ios + */ + tvParallaxProperties: PropTypes.object, + + /** + * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 2.0. + * + * @platform ios + */ + tvParallaxShiftDistanceX: PropTypes.number, + + /** + * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 2.0. + * + * @platform ios + */ + tvParallaxShiftDistanceY: PropTypes.number, + + /** + * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 0.05. + * + * @platform ios + */ + tvParallaxTiltAngle: PropTypes.number, + + /** + * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 1.0. + * + * @platform ios + */ + tvParallaxMagnification: PropTypes.number, +}; + +module.exports = DeprecatedTVViewPropTypes; From 415fa86cbcf94029f91988647a6f715d0a9484cc Mon Sep 17 00:00:00 2001 From: Thomas BARRAS Date: Thu, 27 Sep 2018 14:10:06 -0400 Subject: [PATCH 2/9] UPDATE: @format --- Libraries/Components/AppleTV/TVViewPropTypes.js | 7 ++++--- Libraries/Components/View/PlatformViewPropTypes.android.js | 3 ++- Libraries/Components/View/PlatformViewPropTypes.ios.js | 3 ++- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/Libraries/Components/AppleTV/TVViewPropTypes.js b/Libraries/Components/AppleTV/TVViewPropTypes.js index 3d30fbaffa3d..02a3282b8a9f 100644 --- a/Libraries/Components/AppleTV/TVViewPropTypes.js +++ b/Libraries/Components/AppleTV/TVViewPropTypes.js @@ -7,6 +7,7 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule TVViewPropTypes + * @format * @flow */ 'use strict'; @@ -21,14 +22,14 @@ export type TVViewProps = { * * @platform ios */ - isTVSelectable?: bool, + isTVSelectable?: boolean, /** * *(Apple TV only)* May be set to true to force the Apple TV focus engine to move focus to this view. * * @platform ios */ - hasTVPreferredFocus?: bool, + hasTVPreferredFocus?: boolean, /** * *(Apple TV only)* Object with properties to control Apple TV parallax effects. @@ -70,4 +71,4 @@ export type TVViewProps = { * @platform ios */ tvParallaxMagnification?: number, -}; \ No newline at end of file +}; diff --git a/Libraries/Components/View/PlatformViewPropTypes.android.js b/Libraries/Components/View/PlatformViewPropTypes.android.js index 9cd254714711..6e68229fe36b 100644 --- a/Libraries/Components/View/PlatformViewPropTypes.android.js +++ b/Libraries/Components/View/PlatformViewPropTypes.android.js @@ -7,7 +7,8 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule PlatformViewPropTypes + * @format * @flow */ -export type PlatformViewPropTypes = {}; \ No newline at end of file +export type PlatformViewPropTypes = {}; diff --git a/Libraries/Components/View/PlatformViewPropTypes.ios.js b/Libraries/Components/View/PlatformViewPropTypes.ios.js index b80b85300b28..642a6d81198b 100644 --- a/Libraries/Components/View/PlatformViewPropTypes.ios.js +++ b/Libraries/Components/View/PlatformViewPropTypes.ios.js @@ -7,9 +7,10 @@ * of patent rights can be found in the PATENTS file in the same directory. * * @providesModule PlatformViewPropTypes + * @format * @flow */ import type {TVViewProps} from 'TVViewPropTypes'; -export type PlatformViewPropTypes = TVViewProps; \ No newline at end of file +export type PlatformViewPropTypes = TVViewProps; From 396b19dde7d936859365c3fabafb4a722bd78f3a Mon Sep 17 00:00:00 2001 From: Thomas BARRAS Date: Thu, 27 Sep 2018 14:17:24 -0400 Subject: [PATCH 3/9] UPDATE: DeprecatedTVViewPropTypes clean + rm comments --- .../DeprecatedTVViewPropTypes.js | 53 +------------------ 1 file changed, 1 insertion(+), 52 deletions(-) diff --git a/Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js index 2a14f100c2d7..27e6ee430d41 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js @@ -12,64 +12,13 @@ 'use strict'; var PropTypes = require('prop-types'); -/** - * Additional View properties for Apple TV - */ -var DeprecatedTVViewPropTypes = { - /** - * *(Apple TV only)* When set to true, this view will be focusable - * and navigable using the Apple TV remote. - * - * @platform ios - */ +const DeprecatedTVViewPropTypes = { isTVSelectable: PropTypes.bool, - - /** - * *(Apple TV only)* May be set to true to force the Apple TV focus engine to move focus to this view. - * - * @platform ios - */ hasTVPreferredFocus: PropTypes.bool, - - /** - * *(Apple TV only)* Object with properties to control Apple TV parallax effects. - * - * enabled: If true, parallax effects are enabled. Defaults to true. - * shiftDistanceX: Defaults to 2.0. - * shiftDistanceY: Defaults to 2.0. - * tiltAngle: Defaults to 0.05. - * magnification: Defaults to 1.0. - * - * @platform ios - */ tvParallaxProperties: PropTypes.object, - - /** - * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 2.0. - * - * @platform ios - */ tvParallaxShiftDistanceX: PropTypes.number, - - /** - * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 2.0. - * - * @platform ios - */ tvParallaxShiftDistanceY: PropTypes.number, - - /** - * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 0.05. - * - * @platform ios - */ tvParallaxTiltAngle: PropTypes.number, - - /** - * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 1.0. - * - * @platform ios - */ tvParallaxMagnification: PropTypes.number, }; From c62a88fe6963afdf4be77a6eb964349510277739 Mon Sep 17 00:00:00 2001 From: Thomas BARRAS Date: Thu, 27 Sep 2018 14:22:17 -0400 Subject: [PATCH 4/9] UPDATE: TVViewPropTypes header --- Libraries/Components/AppleTV/TVViewPropTypes.js | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Libraries/Components/AppleTV/TVViewPropTypes.js b/Libraries/Components/AppleTV/TVViewPropTypes.js index 02a3282b8a9f..bea4904a0824 100644 --- a/Libraries/Components/AppleTV/TVViewPropTypes.js +++ b/Libraries/Components/AppleTV/TVViewPropTypes.js @@ -1,15 +1,13 @@ /** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * - * @providesModule TVViewPropTypes * @format * @flow */ + 'use strict'; /** From 4955d237f677811311de9585098dde9ad28f75f7 Mon Sep 17 00:00:00 2001 From: Thomas BARRAS Date: Thu, 27 Sep 2018 14:33:19 -0400 Subject: [PATCH 5/9] UPDATE: Headers --- .../View/PlatformViewPropTypes.android.js | 10 +++++----- .../Components/View/PlatformViewPropTypes.ios.js | 10 +++++----- .../DeprecatedTVViewPropTypes.js | 14 +++++++------- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/Libraries/Components/View/PlatformViewPropTypes.android.js b/Libraries/Components/View/PlatformViewPropTypes.android.js index 6e68229fe36b..f96fe3a62d81 100644 --- a/Libraries/Components/View/PlatformViewPropTypes.android.js +++ b/Libraries/Components/View/PlatformViewPropTypes.android.js @@ -1,14 +1,14 @@ /** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @providesModule PlatformViewPropTypes * @format * @flow */ +'use strict'; + export type PlatformViewPropTypes = {}; diff --git a/Libraries/Components/View/PlatformViewPropTypes.ios.js b/Libraries/Components/View/PlatformViewPropTypes.ios.js index 642a6d81198b..fc8427506010 100644 --- a/Libraries/Components/View/PlatformViewPropTypes.ios.js +++ b/Libraries/Components/View/PlatformViewPropTypes.ios.js @@ -1,16 +1,16 @@ /** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @providesModule PlatformViewPropTypes * @format * @flow */ +'use strict'; + import type {TVViewProps} from 'TVViewPropTypes'; export type PlatformViewPropTypes = TVViewProps; diff --git a/Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js b/Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js index 27e6ee430d41..90af60cc27da 100644 --- a/Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js +++ b/Libraries/DeprecatedPropTypes/DeprecatedTVViewPropTypes.js @@ -1,16 +1,16 @@ /** - * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) Facebook, Inc. and its affiliates. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * - * @flow * @format + * @flow */ + 'use strict'; -var PropTypes = require('prop-types'); + +const PropTypes = require('prop-types'); const DeprecatedTVViewPropTypes = { isTVSelectable: PropTypes.bool, From f81976a7c60426a1eda099bd15b702d53e363f85 Mon Sep 17 00:00:00 2001 From: Thomas BARRAS Date: Thu, 27 Sep 2018 14:46:34 -0400 Subject: [PATCH 6/9] UPDATE: TVViewPropTypes tvParallaxProperties --- .../Components/AppleTV/TVViewPropTypes.js | 35 +++++++++++++++---- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/Libraries/Components/AppleTV/TVViewPropTypes.js b/Libraries/Components/AppleTV/TVViewPropTypes.js index bea4904a0824..5acb26e52385 100644 --- a/Libraries/Components/AppleTV/TVViewPropTypes.js +++ b/Libraries/Components/AppleTV/TVViewPropTypes.js @@ -10,6 +10,33 @@ 'use strict'; +type TVParallaxPropertiesType = { + /** + * If true, parallax effects are enabled. Defaults to true. + */ + enabled: boolean, + + /** + * Defaults to 2.0. + */ + shiftDistanceX: number, + + /** + * Defaults to 2.0. + */ + shiftDistanceY: number, + + /** + * Defaults to 0.05. + */ + tiltAngle: number, + + /** + * Defaults to 1.0 + */ + magnification: number, +}; + /** * Additional View properties for Apple TV */ @@ -32,15 +59,9 @@ export type TVViewProps = { /** * *(Apple TV only)* Object with properties to control Apple TV parallax effects. * - * enabled: If true, parallax effects are enabled. Defaults to true. - * shiftDistanceX: Defaults to 2.0. - * shiftDistanceY: Defaults to 2.0. - * tiltAngle: Defaults to 0.05. - * magnification: Defaults to 1.0. - * * @platform ios */ - tvParallaxProperties?: Object, + tvParallaxProperties?: TVParallaxPropertiesType, /** * *(Apple TV only)* May be used to change the appearance of the Apple TV parallax effect when this view goes in or out of focus. Defaults to 2.0. From ae91f74362d595082745a90184cf4c8199144907 Mon Sep 17 00:00:00 2001 From: Thomas BARRAS Date: Thu, 27 Sep 2018 15:19:50 -0400 Subject: [PATCH 7/9] UPDATE: TVViewPropTypes $ReadOnly --- Libraries/Components/AppleTV/TVViewPropTypes.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/Libraries/Components/AppleTV/TVViewPropTypes.js b/Libraries/Components/AppleTV/TVViewPropTypes.js index 5acb26e52385..ce3651d5f490 100644 --- a/Libraries/Components/AppleTV/TVViewPropTypes.js +++ b/Libraries/Components/AppleTV/TVViewPropTypes.js @@ -10,7 +10,7 @@ 'use strict'; -type TVParallaxPropertiesType = { +type TVParallaxPropertiesType = $ReadOnly<{| /** * If true, parallax effects are enabled. Defaults to true. */ @@ -35,12 +35,12 @@ type TVParallaxPropertiesType = { * Defaults to 1.0 */ magnification: number, -}; +|}>; /** * Additional View properties for Apple TV */ -export type TVViewProps = { +export type TVViewProps = $ReadOnly<{| /** * *(Apple TV only)* When set to true, this view will be focusable * and navigable using the Apple TV remote. @@ -90,4 +90,4 @@ export type TVViewProps = { * @platform ios */ tvParallaxMagnification?: number, -}; +|}>; From 12d920975df527d026133658cf4ab794c0d73cb6 Mon Sep 17 00:00:00 2001 From: Thomas BARRAS Date: Thu, 4 Oct 2018 16:10:58 -0400 Subject: [PATCH 8/9] UPDATE: remove TimerMixin --- Libraries/Lists/ListView/ListView.js | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/Libraries/Lists/ListView/ListView.js b/Libraries/Lists/ListView/ListView.js index b240620b1504..66a5c261f89e 100644 --- a/Libraries/Lists/ListView/ListView.js +++ b/Libraries/Lists/ListView/ListView.js @@ -18,7 +18,6 @@ const RCTScrollViewManager = require('NativeModules').ScrollViewManager; const ScrollView = require('ScrollView'); const ScrollResponder = require('ScrollResponder'); const StaticRenderer = require('StaticRenderer'); -const TimerMixin = require('react-timer-mixin'); const View = require('View'); const cloneReferencedElement = require('react-clone-referenced-element'); const createReactClass = require('create-react-class'); @@ -216,6 +215,7 @@ type Props = $ReadOnly<{| const ListView = createReactClass({ displayName: 'ListView', + _rafId: (null: ?AnimationFrameID), _childFrames: ([]: Array), _sentEndForContentLength: (null: ?number), _scrollComponent: (null: ?React.ElementRef), @@ -223,7 +223,7 @@ const ListView = createReactClass({ _visibleRows: ({}: Object), scrollProperties: ({}: Object), - mixins: [ScrollResponder.Mixin, TimerMixin], + mixins: [ScrollResponder.Mixin], statics: { DataSource: ListViewDataSource, @@ -347,16 +347,23 @@ const ListView = createReactClass({ contentLength: null, offset: 0, }; + this._childFrames = []; this._visibleRows = {}; this._prevRenderedRowsCount = 0; this._sentEndForContentLength = null; }, + componentWillUnmount: function() { + if (this._rafId != null) { + cancelAnimationFrame(this._rafId); + } + }, + componentDidMount: function() { // do this in animation frame until componentDidMount actually runs after // the component is laid out - this.requestAnimationFrame(() => { + this._rafId = requestAnimationFrame(() => { this._measureAndUpdateScrollProps(); }); }, @@ -384,7 +391,7 @@ const ListView = createReactClass({ }, componentDidUpdate: function() { - this.requestAnimationFrame(() => { + this._rafId = requestAnimationFrame(() => { this._measureAndUpdateScrollProps(); }); }, From b906b30944833f46f864f6f4b903af7d4845a1ae Mon Sep 17 00:00:00 2001 From: Thomas BARRAS Date: Sun, 4 Nov 2018 17:23:25 -0500 Subject: [PATCH 9/9] UPDATE: Flow strict mode --- Libraries/Components/StaticContainer.react.js | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/Libraries/Components/StaticContainer.react.js b/Libraries/Components/StaticContainer.react.js index dc852849c1d6..4772dd4af482 100644 --- a/Libraries/Components/StaticContainer.react.js +++ b/Libraries/Components/StaticContainer.react.js @@ -5,7 +5,7 @@ * LICENSE file in the root directory of this source tree. * * @format - * @flow + * @flow strict-local */ 'use strict'; @@ -27,8 +27,19 @@ const React = require('React'); * Typically, you will not need to use this component and should opt for normal * React reconciliation. */ -class StaticContainer extends React.Component { - shouldComponentUpdate(nextProps: Object): boolean { + +type Props = $ReadOnly<{| + /** + * Whether or not this component should update. + */ + shouldUpdate: ?boolean, + /** + * Content short-circuited by React reconciliation process. + */ + children: React.Node, +|}>; +class StaticContainer extends React.Component { + shouldComponentUpdate(nextProps: Props): boolean { return !!nextProps.shouldUpdate; }