Skip to content

Commit

Permalink
Fix up lint errors under react-native-github (#33622)
Browse files Browse the repository at this point in the history
Summary:
Pull Request resolved: #33622

Changelog: [Internal] Clean up eslint errors

Reviewed By: yungsters

Differential Revision: D35599445

fbshipit-source-id: bbb9061a3cf9df32daacad9a9b44eba94d3ce48c
  • Loading branch information
Luna Wei authored and facebook-github-bot committed Apr 22, 2022
1 parent 56fd85e commit 6958bbb
Show file tree
Hide file tree
Showing 11 changed files with 558 additions and 579 deletions.
1 change: 1 addition & 0 deletions Libraries/Lists/VirtualizedSectionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -338,6 +338,7 @@ class VirtualizedSectionList<

_renderItem =
(listItemCount: number) =>
// eslint-disable-next-line react/no-unstable-nested-components
({item, index}: {item: Item, index: number, ...}) => {
const info = this._subExtractor(index);
if (!info) {
Expand Down
2 changes: 0 additions & 2 deletions Libraries/NativeComponent/NativeComponentRegistry.js
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,6 @@ import * as React from 'react';

let getRuntimeConfig;

let componentNameToExists: Map<string, boolean> = new Map();

/**
* Configures a function that is called to determine whether a given component
* should be registered using reflection of the native component at runtime.
Expand Down
1 change: 1 addition & 0 deletions packages/rn-tester/js/components/RNTesterModuleList.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,6 +153,7 @@ const RNTesterModuleList: React$AbstractComponent<any, void> = React.memo(
automaticallyAdjustContentInsets={false}
keyboardDismissMode="on-drag"
renderSectionHeader={renderSectionHeader}
// eslint-disable-next-line react/no-unstable-nested-components
ListFooterComponent={() => <View style={{height: 80}} />}
/>
)}
Expand Down
127 changes: 64 additions & 63 deletions packages/rn-tester/js/examples/Appearance/AppearanceExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,70 @@ const ThemedText = props => (
</RNTesterThemeContext.Consumer>
);

const AppearanceViaHook = () => {
const colorScheme = useColorScheme();
return (
<RNTesterThemeContext.Provider
value={colorScheme === 'dark' ? themes.dark : themes.light}>
<ThemedContainer>
<ThemedText>useColorScheme(): {colorScheme}</ThemedText>
</ThemedContainer>
</RNTesterThemeContext.Provider>
);
};

const ColorShowcase = props => (
<RNTesterThemeContext.Consumer>
{theme => {
return (
<View
style={{
marginVertical: 20,
backgroundColor: theme.SystemBackgroundColor,
}}>
<Text style={{fontWeight: '700', color: theme.LabelColor}}>
{props.themeName}
</Text>
{Object.keys(theme).map(key => (
<View style={{flexDirection: 'row'}} key={key}>
<View
style={{
width: 50,
height: 50,
paddingHorizontal: 8,
paddingVertical: 2,
backgroundColor: theme[key],
}}
/>
<View>
<Text
style={{
paddingHorizontal: 16,
paddingVertical: 2,
color: theme.LabelColor,
fontWeight: '600',
}}>
{key}
</Text>
<Text
style={{
paddingHorizontal: 16,
paddingVertical: 2,
color: theme.LabelColor,
}}>
{typeof theme[key] === 'string'
? theme[key]
: JSON.stringify(theme[key])}
</Text>
</View>
</View>
))}
</View>
);
}}
</RNTesterThemeContext.Consumer>
);

exports.title = 'Appearance';
exports.category = 'UI';
exports.documentationURL = 'https://reactnative.dev/docs/appearance';
Expand All @@ -85,17 +149,6 @@ exports.examples = [
{
title: 'useColorScheme hook',
render(): React.Node {
const AppearanceViaHook = () => {
const colorScheme = useColorScheme();
return (
<RNTesterThemeContext.Provider
value={colorScheme === 'dark' ? themes.dark : themes.light}>
<ThemedContainer>
<ThemedText>useColorScheme(): {colorScheme}</ThemedText>
</ThemedContainer>
</RNTesterThemeContext.Provider>
);
};
return <AppearanceViaHook />;
},
},
Expand Down Expand Up @@ -155,58 +208,6 @@ exports.examples = [
title: 'RNTester App Colors',
description: 'A light and a dark theme based on standard iOS 13 colors.',
render(): React.Element<any> {
const ColorShowcase = props => (
<RNTesterThemeContext.Consumer>
{theme => {
return (
<View
style={{
marginVertical: 20,
backgroundColor: theme.SystemBackgroundColor,
}}>
<Text style={{fontWeight: '700', color: theme.LabelColor}}>
{props.themeName}
</Text>
{Object.keys(theme).map(key => (
<View style={{flexDirection: 'row'}} key={key}>
<View
style={{
width: 50,
height: 50,
paddingHorizontal: 8,
paddingVertical: 2,
backgroundColor: theme[key],
}}
/>
<View>
<Text
style={{
paddingHorizontal: 16,
paddingVertical: 2,
color: theme.LabelColor,
fontWeight: '600',
}}>
{key}
</Text>
<Text
style={{
paddingHorizontal: 16,
paddingVertical: 2,
color: theme.LabelColor,
}}>
{typeof theme[key] === 'string'
? theme[key]
: JSON.stringify(theme[key])}
</Text>
</View>
</View>
))}
</View>
);
}}
</RNTesterThemeContext.Consumer>
);

return (
<View>
<RNTesterThemeContext.Provider value={themes.light}>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,11 @@ class DimensionsSubscription extends React.Component<
}
}

const DimensionsViaHook = () => {
const dims = useWindowDimensions();
return <Text>{JSON.stringify(dims, null, 2)}</Text>;
};

exports.title = 'Dimensions';
exports.category = 'UI';
exports.documentationURL = 'https://reactnative.dev/docs/dimensions';
Expand All @@ -50,10 +55,6 @@ exports.examples = [
{
title: 'useWindowDimensions hook',
render(): React.Node {
const DimensionsViaHook = () => {
const dims = useWindowDimensions();
return <Text>{JSON.stringify(dims, null, 2)}</Text>;
};
return <DimensionsViaHook />;
},
},
Expand Down
Loading

0 comments on commit 6958bbb

Please sign in to comment.