rename fill attribute

Summary:
We were using `fill={true}` as an attribute to make flexbox containers fill the entire available space.

However, `fill` is an HTML attribute (see: https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/fill) This caused warnings printed to the console.

This diff renames the attribute to `grow` with is also more in line with the Flexbox terminology.

Reviewed By: priteshrnandgaonkar

Differential Revision: D10488389

fbshipit-source-id: ed8553c6203cdf6df94d26c731164ecec4c9fbd2
This commit is contained in:
Daniel Büchele
2018-10-22 09:52:19 -07:00
committed by Facebook Github Bot
parent 2a179b9d3c
commit 086ab0188b
23 changed files with 41 additions and 43 deletions

View File

@@ -49,7 +49,7 @@ export class App extends React.Component<Props> {
} }
render() { render() {
return ( return (
<FlexColumn fill={true}> <FlexColumn grow={true}>
<TitleBar /> <TitleBar />
{this.props.bugDialogVisible && ( {this.props.bugDialogVisible && (
<BugReporterDialog <BugReporterDialog
@@ -59,7 +59,7 @@ export class App extends React.Component<Props> {
}} }}
/> />
)} )}
<FlexRow fill={true}> <FlexRow grow={true}>
{this.props.leftSidebarVisible && <MainSidebar />} {this.props.leftSidebarVisible && <MainSidebar />}
{this.props.selectedDevice ? ( {this.props.selectedDevice ? (
<PluginContainer logger={this.props.logger} /> <PluginContainer logger={this.props.logger} />

View File

@@ -3,7 +3,6 @@
exports[`Empty app state matches snapshot 1`] = ` exports[`Empty app state matches snapshot 1`] = `
<div <div
className="css-1si6n3e" className="css-1si6n3e"
fill={true}
> >
<div <div
className="toolbar css-1u64wvw" className="toolbar css-1u64wvw"
@@ -113,7 +112,6 @@ exports[`Empty app state matches snapshot 1`] = `
</div> </div>
<div <div
className="css-9qtipk" className="css-9qtipk"
fill={true}
> >
<div <div
className="css-1atbcdi" className="css-1atbcdi"

View File

@@ -183,7 +183,7 @@ export default class BugReporterDialog extends Component<Props, State> {
if (success) { if (success) {
content = ( content = (
<FlexCenter fill={true}> <FlexCenter grow={true}>
<FlexColumn> <FlexColumn>
<Text> <Text>
<Text>Bug </Text> <Text>Bug </Text>
@@ -204,7 +204,7 @@ export default class BugReporterDialog extends Component<Props, State> {
); );
} else { } else {
content = ( content = (
<Container fill={true}> <Container grow={true}>
<TitleInput <TitleInput
placeholder="Title..." placeholder="Title..."
value={title} value={title}

View File

@@ -343,7 +343,7 @@ class PluginManager extends PureComponent<Props, State> {
); );
return ( return (
<Container> <Container>
<FlexColumn fill={true}> <FlexColumn grow={true}>
{this.state.restartRequired && ( {this.state.restartRequired && (
<RestartRequired onClick={this.relaunch}> <RestartRequired onClick={this.relaunch}>
<Glyph name="arrows-circle" size={12} color={colors.white} /> <Glyph name="arrows-circle" size={12} color={colors.white} />
@@ -396,7 +396,7 @@ const SearchablePluginManager = Searchable(PluginManager);
export default class extends PureComponent<{}> { export default class extends PureComponent<{}> {
render() { render() {
return ( return (
<FlexColumn fill={true}> <FlexColumn grow={true}>
<SearchablePluginManager /> <SearchablePluginManager />
</FlexColumn> </FlexColumn>
); );

View File

@@ -185,7 +185,7 @@ export function createTablePlugin<T: RowData>(props: Props<T>) {
const {rows} = this.state; const {rows} = this.state;
return ( return (
<FlexColumn fill={true}> <FlexColumn grow={true}>
<SearchableTable <SearchableTable
key={props.id} key={props.id}
rowLineHeight={28} rowLineHeight={28}

View File

@@ -340,7 +340,7 @@ export default class CPUFrequencyTable extends FlipperDevicePlugin<CPUState> {
render() { render() {
return ( return (
<FlexRow> <FlexRow>
<FlexColumn fill={true}> <FlexColumn grow={true}>
<Toolbar position="top"> <Toolbar position="top">
{this.state.monitoring ? ( {this.state.monitoring ? (
<Button onClick={this.onStopMonitor} icon="pause"> <Button onClick={this.onStopMonitor} icon="pause">

View File

@@ -1120,7 +1120,7 @@ export default class Layout extends FlipperPlugin<InspectorState> {
} = this.state; } = this.state;
return ( return (
<FlexColumn fill={true}> <FlexColumn grow={true}>
<Toolbar> <Toolbar>
<SearchIconContainer <SearchIconContainer
onClick={this.onFindClick} onClick={this.onFindClick}
@@ -1197,7 +1197,7 @@ export default class Layout extends FlipperPlugin<InspectorState> {
</SearchIconContainer> </SearchIconContainer>
)} )}
</Toolbar> </Toolbar>
<FlexRow fill={true}> <FlexRow grow={true}>
{initialised ? ( {initialised ? (
<ElementsInspector <ElementsInspector
onElementSelected={this.onElementSelected} onElementSelected={this.onElementSelected}
@@ -1210,7 +1210,7 @@ export default class Layout extends FlipperPlugin<InspectorState> {
elements={elements} elements={elements}
/> />
) : ( ) : (
<Center fill={true}> <Center grow={true}>
<LoadingIndicator /> <LoadingIndicator />
</Center> </Center>
)} )}

View File

@@ -147,14 +147,14 @@ export default class LeakCanary extends FlipperPlugin<State> {
return ( return (
<Sidebar position="right" width={600} minWidth={300} maxWidth={900}> <Sidebar position="right" width={600} minWidth={300} maxWidth={900}>
<Panel heading={'Instance'} floating={false} fill={false}> <Panel heading={'Instance'} floating={false} grow={false}>
<ManagedDataInspector <ManagedDataInspector
data={instanceFields} data={instanceFields}
expandRoot={true} expandRoot={true}
extractValue={this._extractValue} extractValue={this._extractValue}
/> />
</Panel> </Panel>
<Panel heading={'Static'} floating={false} fill={false}> <Panel heading={'Static'} floating={false} grow={false}>
<ManagedDataInspector <ManagedDataInspector
data={staticFields} data={staticFields}
expandRoot={true} expandRoot={true}
@@ -171,8 +171,8 @@ export default class LeakCanary extends FlipperPlugin<State> {
return ( return (
<Window> <Window>
<FlexColumn fill={true}> <FlexColumn grow={true}>
<FlexColumn fill={true} scrollable={true}> <FlexColumn grow={true} scrollable={true}>
{this.state.leaks.map((leak: Leak, idx: number) => { {this.state.leaks.map((leak: Leak, idx: number) => {
const elements = showFullClassPaths const elements = showFullClassPaths
? leak.elements ? leak.elements

View File

@@ -188,7 +188,7 @@ export default class LogWatcher extends PureComponent<Props, State> {
render() { render() {
return ( return (
<FlexColumn fill={true} tabIndex={-1} onKeyDown={this.onKeyDown}> <FlexColumn grow={true} tabIndex={-1} onKeyDown={this.onKeyDown}>
<WatcherPanel <WatcherPanel
heading="Expression Watcher" heading="Expression Watcher"
floating={false} floating={false}

View File

@@ -197,7 +197,7 @@ export default class extends FlipperPlugin<State, *, PersistedState> {
const {requests, responses} = this.props.persistedState; const {requests, responses} = this.props.persistedState;
return ( return (
<FlexColumn fill={true}> <FlexColumn grow={true}>
<NetworkTable <NetworkTable
requests={requests || {}} requests={requests || {}}
responses={responses || {}} responses={responses || {}}

View File

@@ -103,7 +103,7 @@ export default class SandboxView extends FlipperPlugin<SandboxState> {
return ( return (
<FlexColumn> <FlexColumn>
<SandboxView.TextInputLayout> <SandboxView.TextInputLayout>
<ButtonGroup flexGrow={1}> <ButtonGroup flexgrow={true}>
<SandboxView.TextInput <SandboxView.TextInput
type="text" type="text"
placeholder="Sandbox URL (e.g. unixname.sb.facebook.com)" placeholder="Sandbox URL (e.g. unixname.sb.facebook.com)"

View File

@@ -200,7 +200,7 @@ export default class extends FlipperPlugin<SharedPreferencesState> {
} }
return ( return (
<RootColumn fill={true}> <RootColumn grow={true}>
<Heading> <Heading>
<span style={{marginRight: '16px'}}>Preference File</span> <span style={{marginRight: '16px'}}>Preference File</span>
<Select <Select
@@ -214,7 +214,7 @@ export default class extends FlipperPlugin<SharedPreferencesState> {
onChange={this.onSharedPreferencesSelected} onChange={this.onSharedPreferencesSelected}
/> />
</Heading> </Heading>
<FlexRow fill={true} scrollable={true}> <FlexRow grow={true} scrollable={true}>
<InspectorColumn> <InspectorColumn>
<Heading>Inspector</Heading> <Heading>Inspector</Heading>
<ManagedDataInspector <ManagedDataInspector

View File

@@ -66,7 +66,7 @@ export default class ErrorBoundary extends Component<
} }
return ( return (
<ErrorBoundaryContainer fill={true}> <ErrorBoundaryContainer grow={true}>
<Heading>{heading}</Heading> <Heading>{heading}</Heading>
{this.props.showStack !== false && ( {this.props.showStack !== false && (
<ErrorBoundaryStack error={error} /> <ErrorBoundaryStack error={error} />

View File

@@ -48,7 +48,7 @@ type InteractiveProps = {|
movable?: boolean, movable?: boolean,
hidden?: boolean, hidden?: boolean,
moving?: boolean, moving?: boolean,
fill?: boolean, grow?: boolean,
siblings?: $Shape<{[key: string]: $Shape<Rect>}>, siblings?: $Shape<{[key: string]: $Shape<Rect>}>,
updateCursor?: (cursor: ?string) => void, updateCursor?: (cursor: ?string) => void,
zIndex?: number, zIndex?: number,
@@ -650,7 +650,7 @@ export default class Interactive extends React.Component<
}; };
render() { render() {
const {fill, height, left, movable, top, width, zIndex} = this.props; const {grow, height, left, movable, top, width, zIndex} = this.props;
const style: Object = { const style: Object = {
cursor: this.state.cursor, cursor: this.state.cursor,
@@ -658,7 +658,7 @@ export default class Interactive extends React.Component<
}; };
if (movable === true || top != null || left != null) { if (movable === true || top != null || left != null) {
if (fill === true) { if (grow === true) {
style.left = left || 0; style.left = left || 0;
style.top = top || 0; style.top = top || 0;
} else { } else {
@@ -666,7 +666,7 @@ export default class Interactive extends React.Component<
} }
} }
if (fill === true) { if (grow === true) {
style.right = 0; style.right = 0;
style.bottom = 0; style.bottom = 0;
style.width = '100%'; style.width = '100%';

View File

@@ -40,7 +40,7 @@ export default class Panel extends React.Component<
* height: 100%; * height: 100%;
* width: 100%; * width: 100%;
*/ */
fill?: boolean, grow?: boolean,
/** /**
* Heading for this panel. If this is anything other than a string then no * Heading for this panel. If this is anything other than a string then no
* padding is applied to the heading. * padding is applied to the heading.
@@ -74,10 +74,10 @@ export default class Panel extends React.Component<
> { > {
static defaultProps: {| static defaultProps: {|
floating: boolean, floating: boolean,
fill: boolean, grow: boolean,
collapsable: boolean, collapsable: boolean,
|} = { |} = {
fill: false, grow: false,
floating: true, floating: true,
collapsable: true, collapsable: true,
}; };
@@ -124,7 +124,7 @@ export default class Panel extends React.Component<
padded, padded,
children, children,
className, className,
fill, grow,
floating, floating,
heading, heading,
collapsable, collapsable,
@@ -135,7 +135,7 @@ export default class Panel extends React.Component<
<Panel.PanelContainer <Panel.PanelContainer
className={className} className={className}
floating={floating} floating={floating}
fill={fill} grow={grow}
collapsed={collapsed}> collapsed={collapsed}>
<Panel.PanelHeader <Panel.PanelHeader
floating={floating} floating={floating}
@@ -156,7 +156,7 @@ export default class Panel extends React.Component<
{children == null || (collapsable && collapsed) ? null : ( {children == null || (collapsable && collapsed) ? null : (
<Panel.PanelBody <Panel.PanelBody
fill={fill} grow={grow}
padded={padded == null ? true : padded} padded={padded == null ? true : padded}
floating={floating}> floating={floating}>
{children} {children}

View File

@@ -251,7 +251,7 @@ export default function Tabs(props: {|
} }
return ( return (
<FlexColumn fill={true}> <FlexColumn grow={true}>
<TabList> <TabList>
{before} {before}
{tabList} {tabList}

View File

@@ -8,10 +8,10 @@
import styled from '../styled/index.js'; import styled from '../styled/index.js';
const View = styled('div')(props => ({ const View = styled('div')(props => ({
height: props.fill ? '100%' : 'auto', height: props.grow ? '100%' : 'auto',
overflow: props.scrollable ? 'auto' : 'visible', overflow: props.scrollable ? 'auto' : 'visible',
position: 'relative', position: 'relative',
width: props.fill ? '100%' : 'auto', width: props.grow ? '100%' : 'auto',
})); }));
export default View; export default View;

View File

@@ -126,7 +126,7 @@ export default class VirtualList extends Component<
return ( return (
<View <View
fill={true} grow={true}
onScroll={this.handleScroll} onScroll={this.handleScroll}
innerRef={this.setRef} innerRef={this.setRef}
scrollable={true}> scrollable={true}>

View File

@@ -197,7 +197,7 @@ export class Console extends Component<Props, State> {
render() { render() {
return ( return (
<Console.Window> <Console.Window>
<View fill>{this.renderPreviousCommands()}</View> <View grow={true}>{this.renderPreviousCommands()}</View>
<form onSubmit={this.onSubmit}> <form onSubmit={this.onSubmit}>
<Console.Input <Console.Input
onChange={this.onInputChange} onChange={this.onInputChange}

View File

@@ -84,7 +84,7 @@ export default class ElementsInspector extends Component<{
} = this.props; } = this.props;
return ( return (
<FlexRow fill={true}> <FlexRow grow={true}>
<Elements <Elements
onElementExpanded={onElementExpanded} onElementExpanded={onElementExpanded}
onElementSelected={onElementSelected} onElementSelected={onElementSelected}

View File

@@ -59,7 +59,7 @@ class InspectorSidebarSection extends Component<InspectorSidebarSectionProps> {
render() { render() {
const {id} = this.props; const {id} = this.props;
return ( return (
<Panel heading={id} floating={false} fill={false}> <Panel heading={id} floating={false} grow={false}>
<ManagedDataInspector <ManagedDataInspector
data={this.props.data} data={this.props.data}
setValue={this.props.onValueChanged ? this.setValue : undefined} setValue={this.props.onValueChanged ? this.setValue : undefined}
@@ -137,7 +137,7 @@ export class InspectorSidebar extends Component<Props, State> {
if (GK.get('sonar_show_console_plugin') && this.state.isConsoleEnabled) { if (GK.get('sonar_show_console_plugin') && this.state.isConsoleEnabled) {
sections.push( sections.push(
<Panel heading="JS Console" floating={false} fill={false}> <Panel heading="JS Console" floating={false} grow={false}>
<Console client={this.props.client} getContext={() => element.id} /> <Console client={this.props.client} getContext={() => element.id} />
</Panel>, </Panel>,
); );

View File

@@ -87,7 +87,7 @@ export default class Intro extends PureComponent<Props> {
render() { render() {
const {icon, children, title, onDismiss, screenshot} = this.props; const {icon, children, title, onDismiss, screenshot} = this.props;
return ( return (
<FlexRow fill={true}> <FlexRow grow={true}>
<Containter> <Containter>
<TitleRow> <TitleRow>
{icon != null && ( {icon != null && (

View File

@@ -164,7 +164,7 @@ class TableHeadColumn extends PureComponent<{
if (isResizable) { if (isResizable) {
children = ( children = (
<TableHeaderColumnInteractive <TableHeaderColumnInteractive
fill={true} grow={true}
resizable={RIGHT_RESIZABLE} resizable={RIGHT_RESIZABLE}
onResize={this.onResize}> onResize={this.onResize}>
{children} {children}