Skip to content
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 our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix $FlowFixMe in Flatlist #16688

Closed
wants to merge 86 commits into from
Closed
Changes from 1 commit
Commits
Show all changes
86 commits
Select commit Hold shift + click to select a range
ab0e551
Fix $FlowFixMe in Flatlist
cdlewis Nov 4, 2017
bde417f
fix(docs): fixing wrong module name in the example of "Integration wi…
husky-dev Nov 4, 2017
d997a98
Fixed "putExtra" typo in HeadlessJSAndroid
alpparkan Nov 4, 2017
cc3c91f
Fix launchChrome for chromium on Ubuntu
nfeignon Nov 4, 2017
29d2693
Define `pod_target_xcconfig` for PrivateDatabase
ide Nov 4, 2017
ea22c95
- Adding locale prop to DatePickerIOS
robertpaul01 Nov 4, 2017
9b2c586
Fix a few more Flow warnings
Nov 5, 2017
3577d55
packager-worker-for-buck: transformCommand: add test
Nov 6, 2017
403a891
react-native: BundleSegments
Nov 6, 2017
8dc4031
Inverted descent/ascent Android prioritisation to match iOS lineHeigh…
Nov 6, 2017
ad5ddfd
Make RN Events registered disregarding ViewManager use pattern.
Nov 6, 2017
ff02384
Add tintColor to ActionSheetIOS documentation
patrickkempff Nov 6, 2017
2313214
Fix a race condition in the animation module
mhorowitz Nov 6, 2017
84447c4
Add ?Fbt to flow type for the title & message props
Nov 7, 2017
70ad15b
Export YellowBox API
wli Nov 7, 2017
1c2cb79
Rename "js-bundles" to "js-segments"
fromcelticpark Nov 7, 2017
41e9adf
Add prettier config, format script and reformat files
janicduplessis Nov 7, 2017
6d51353
Backed out changeset 322626be193e
ginandi Nov 7, 2017
b5301f8
metro-bundler: allow different run-before-main-module depending on en…
Nov 7, 2017
8e2c451
Add notes for React Native monthly #5
tenodi Nov 7, 2017
5aa0338
Check against integer overflow in RCTNetworking decodeTextData
cdlewis Nov 7, 2017
63d31f9
Fix typo in PULL_REQUEST_TEMPLATE.md
timwangdev Nov 7, 2017
21a3779
Docs: Improve BackHandler documentation (addEventListener and removeE…
Nov 7, 2017
bf651cd
Docs: Add example to CheckBox documentation
Nov 7, 2017
40f96f4
Make RN Events registered disregarding ViewManager use pattern.
Nov 7, 2017
572e104
improve docs for KeyboardAvoidingView
gwmccull Nov 7, 2017
0da7a71
When subscribing for network connectivity broadcasts, also query the …
berickson1 Nov 7, 2017
2044e03
fix #10747 (ScrollView rendered incorrectly with RefreshControl)
vonovak Nov 8, 2017
d39f6f3
RCTAllocatedRootViewTag was moved to RCTUIManagerUtils
shergin Nov 8, 2017
742d636
Introducing RCTSurface, new experimental thread-safe interop layer
shergin Nov 8, 2017
b46cd62
Flatten jsdocs to markdown plaintext
hramos Nov 8, 2017
1f1e41b
Share bundled source URL to RN
Nov 8, 2017
202299f
Rename bundleUrl to jsbundleURL
Nov 8, 2017
9723f43
Remove RAMBundleRegistry subclasses
fromcelticpark Nov 8, 2017
5f4125d
Update Jest to 21.3.0-beta.8
Nov 8, 2017
6ecd4a2
Rename BundleFetcher to SegmentFetcher
fromcelticpark Nov 8, 2017
5c84cdb
BREAKING: Bump metro-bundler to v0.21.0
rafeca Nov 8, 2017
9b011a4
Make direction-aware borders work with APIs >= 17
RSNara Nov 8, 2017
8718876
Rename scaledAssetURLScript function to scaledAssetURLNearBundle
Nov 8, 2017
43f06fa
Fix missing return in example
behrends Nov 8, 2017
1ae5e38
Remove old bundler code from Server class
rafeca Nov 8, 2017
f386954
Rename bundleSource to embeddedBundle
Nov 9, 2017
3cae5cc
Additional markdown adjustments
hramos Nov 9, 2017
4710ed1
Remove shared bridge experiment
Nov 9, 2017
8b3e419
Restore missing ejected banner
hramos Nov 9, 2017
4fd54b0
Refine StyleSheet Flow types
jamesisaac Nov 9, 2017
237db4b
Register split segment paths with RAMBundleRegistry
fromcelticpark Nov 9, 2017
4757046
Adopt new split segments registration approach on iOS
fromcelticpark Nov 9, 2017
1ff0d30
Adopt split segments registration approach on Android
fromcelticpark Nov 9, 2017
8df2544
Backed out changeset eadb184eacdf
Nov 9, 2017
b0ec5df
Fix sections that come from React Fiber
alexeylang Nov 9, 2017
b85810a
Fix website deploys on master
hramos Nov 9, 2017
df29a3d
Fix tvOS compile issues; enable TVEventHandler in Modal (fix #15389)
douglowder Nov 9, 2017
4a6311f
resolve iOS assets from embedded bundle path for iOS platform
Nov 10, 2017
74356b0
Fix typo in Image.android.js & Image.ios.js
solon Nov 10, 2017
93af55d
Fix Jest mocks for NetInfo module.
timwangdev Nov 10, 2017
bf91380
Flow 0.59 xplat/js deploy
Nov 11, 2017
20192a6
Fix dependencies script when its running with dev=false
rafeca Nov 11, 2017
e968e5d
Introducing RCTSurfaceHostingComponent
shergin Nov 12, 2017
3b6e9c7
Introducing RCTSurfaceBackedComponent
shergin Nov 12, 2017
2ee151d
AMA changes to support disk cache
Nov 12, 2017
b885cf6
Pass scriptURL to RCTTestRunner
Nov 12, 2017
1d50dca
Fix asset resolver url handling
fkgozali Nov 13, 2017
f79f7ff
Remove splitting to BridgeCorePackage and ReactNativePackage.
Nov 14, 2017
e1f5103
Cleanup ReactInstanceManager
Nov 14, 2017
e2d4886
Remove android_react_native_perf.use_separate_ui_bg_thread experiment.
Nov 14, 2017
9b8bf83
Remove minNumShakes from ReactInstaneManager
Nov 14, 2017
7a24a96
Fix typo in SafeArea documentation
Nov 14, 2017
a751a7d
Added progress updates for all XMLHttpRequest upload types
allengleyzer Nov 14, 2017
7743a16
Improve types for React Native styles.
nmn Nov 14, 2017
83ddec1
React sync for revisions 589c0a2...2d23a45
Nov 15, 2017
6a11b32
Replace printf with YGLog calls
priteshrnandgaonkar Nov 16, 2017
9e96d93
Unify Systrace native hook argument passing.
Nov 16, 2017
fc8245f
Disable git hooks for the upgrade process
Nov 17, 2017
4026571
Migrate to new documentation format
hramos Nov 17, 2017
063eb94
Update buck to v2017.11.16.01
hramos Nov 17, 2017
76a6e7b
Fix minimumViewTime in ViewabilityHelper
logandaniels Nov 17, 2017
020c917
Make RCTNativeModule::invokeInner explicitely return folly::none in c…
fromcelticpark Nov 17, 2017
ef95d33
Add end to end Delta support to Android devices
rafeca Nov 17, 2017
ce32d29
check if listener is still in the set before calling onHostResume
Nov 17, 2017
7e1c39f
renderApplication() supports async initial render
Nov 17, 2017
d3ba9ef
Mention <ImageBackground> when error is thrown
nkabrown Nov 19, 2017
95b8b33
Correcting the redirection link.
johnthewilson Nov 19, 2017
86ea224
Removed Duplicate data.
johnthewilson Nov 19, 2017
e9cde53
PR feedback
cdlewis Nov 19, 2017
aef196f
Minor bug in random generator for `selection` prop
rozele Nov 20, 2017
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
32 changes: 21 additions & 11 deletions Libraries/Lists/FlatList.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ const MetroListView = require('MetroListView'); // Used as a fallback legacy opt
const React = require('React');
const View = require('View');
const VirtualizedList = require('VirtualizedList');
const ListView = require('ListView');

const invariant = require('fbjs/lib/invariant');

Expand Down Expand Up @@ -326,7 +327,9 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
* Scrolls to the end of the content. May be janky without `getItemLayout` prop.
*/
scrollToEnd(params?: ?{animated?: ?boolean}) {
this._listRef.scrollToEnd(params);
if (this._listRef) {
this._listRef.scrollToEnd(params);
}
}

/**
Expand All @@ -343,7 +346,9 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
viewOffset?: number,
viewPosition?: number,
}) {
this._listRef.scrollToIndex(params);
if (this._listRef) {
this._listRef.scrollToIndex(params);
}
}

/**
Expand All @@ -357,7 +362,9 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
item: ItemT,
viewPosition?: number,
}) {
this._listRef.scrollToItem(params);
if (this._listRef) {
this._listRef.scrollToItem(params);
}
}

/**
Expand All @@ -366,7 +373,9 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
* Check out [scrollToOffset](docs/virtualizedlist.html#scrolltooffset) of VirtualizedList
*/
scrollToOffset(params: {animated?: ?boolean, offset: number}) {
this._listRef.scrollToOffset(params);
if (this._listRef) {
this._listRef.scrollToOffset(params);
}
}

/**
Expand All @@ -375,7 +384,9 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
* taps on items or by navigation actions.
*/
recordInteraction() {
this._listRef.recordInteraction();
if (this._listRef) {
this._listRef.recordInteraction();
}
}

/**
Expand All @@ -384,7 +395,9 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
* @platform ios
*/
flashScrollIndicators() {
this._listRef.flashScrollIndicators();
if (this._listRef) {
this._listRef.flashScrollIndicators();
}
}

/**
Expand Down Expand Up @@ -457,13 +470,10 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
}

_hasWarnedLegacy = false;
_listRef: VirtualizedList;
_listRef: null | VirtualizedList | ListView;
_virtualizedListPairs: Array<ViewabilityConfigCallbackPair> = [];

_captureRef = ref => {
/* $FlowFixMe(>=0.53.0 site=react_native_fb,react_native_oss) This comment
* suppresses an error when upgrading Flow's support for React. To see the
* error delete this comment and run Flow. */
_captureRef = (ref: null | VirtualizedList | ListView) => {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think we need to annotate this, will avoid some duplication.

this._listRef = ref;
};

Expand Down