Skip to content

Commit

Permalink
Fix incorrect usage of React.ElementConfig and React.ElementRef in xp…
Browse files Browse the repository at this point in the history
…lat (facebook#37083)

Summary:
Pull Request resolved: facebook#37083

`React.ElementConfig<a polymophic type>` will result in unpredictable behavior in Flow due to some types being unresolved. Since the type is already broken in most cases, I use $FlowFixMe as the type for those type arguments that are currently inferred as empty.

Changelog: [Internal]

Reviewed By: NickGerleman

Differential Revision: D44774275

fbshipit-source-id: bb950379102d41e729593af644d25670d9071ab4
  • Loading branch information
SamChou19815 authored and facebook-github-bot committed Apr 26, 2023
1 parent b4466c7 commit 0e59e2a
Show file tree
Hide file tree
Showing 10 changed files with 10 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ function keyExtractor(request: NetworkRequestInfo): string {
* Show all the intercepted network requests over the InspectorPanel.
*/
class NetworkOverlay extends React.Component<Props, State> {
_requestsListView: ?React.ElementRef<typeof FlatList>;
_requestsListView: ?React.ElementRef<Class<FlatList<NetworkRequestInfo>>>;
_detailScrollView: ?React.ElementRef<typeof ScrollView>;

// Metrics are used to decide when if the request list should be sticky, and
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export default ({
name: 'onEndReached',
description:
'Scroll to end of list or tap Test button to see `onEndReached` triggered.',
render: function (): React.Element<typeof FlatList_onEndReached> {
render: function () {
return <FlatList_onEndReached />;
},
}: RNTesterModuleExample);
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ export default ({
name: 'onStartReached',
description:
'Scroll to start of list or tap Test button to see `onStartReached` triggered.',
render: function (): React.Element<typeof FlatList_onStartReached> {
render: function () {
return <FlatList_onStartReached />;
},
}: RNTesterModuleExample);
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ export default {
title: 'SectionList Content Inset',
platform: 'ios',
name: 'SectionList-contentInset',
render: function (): React.Element<typeof SectionList_contentInset> {
render: function (): React.MixedElement {
return <SectionList_contentInset />;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ export function SectionList_inverted(): React.Node {
export default {
title: 'SectionList Inverted',
name: 'SectionList-inverted',
render: function (): React.Element<typeof SectionList_inverted> {
render: function (): React.MixedElement {
return <SectionList_inverted />;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export default {
title: 'SectionList onEndReached',
name: 'SectionList-onEndReached',
description: 'Test onEndReached behavior',
render: function (): React.Element<typeof SectionList_onEndReached> {
render: function (): React.MixedElement {
return <SectionList_onEndReached />;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -73,9 +73,7 @@ const styles = StyleSheet.create({
export default {
title: 'SectionList On Viewable Items Changed',
name: 'SectionList_onViewableItemsChanged',
render: function (): React.Element<
typeof SectionList_onViewableItemsChanged,
> {
render: function (): React.MixedElement {
return (
<SectionList_onViewableItemsChanged
viewabilityConfig={VIEWABILITY_CONFIG}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -358,7 +358,7 @@ const styles = StyleSheet.create({
export default {
title: 'SectionList scrollable',
name: 'SectionList-scrollable',
render: function (): React.Element<typeof SectionList_scrollable> {
render: function (): React.MixedElement {
return <SectionList_scrollable />;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,7 @@ export default {
title: 'SectionList Sticky Headers Enabled',
name: 'SectionList-stickyHeadersEnabled',
description: 'Toggle sticky headers on/off',
render: function (): React.Element<
typeof SectionList_stickySectionHeadersEnabled,
> {
render: function (): React.MixedElement {
return <SectionList_stickySectionHeadersEnabled />;
},
};
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ const styles = StyleSheet.create({
export default {
title: 'SectionList With Separators',
name: 'SectionList-withSeparators',
render: function (): React.Element<typeof SectionList_withSeparators> {
render: function (): React.MixedElement {
return <SectionList_withSeparators />;
},
};

0 comments on commit 0e59e2a

Please sign in to comment.