Add createTablePlugin-based counterpart to tutorial app

Summary: Per title. It's very basic, which is exactly the point.

Reviewed By: jknoxville

Differential Revision: D15182335

fbshipit-source-id: f70f8cd0510a605879dccb9f909f84971a4eedc3
This commit is contained in:
Pascal Hartig
2019-05-02 09:05:45 -07:00
committed by Facebook Github Bot
parent 18af62ebfd
commit 7dae5771d9
2 changed files with 76 additions and 0 deletions

View File

@@ -0,0 +1,65 @@
/**
* Copyright 2018-present Facebook.
* 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
*/
import {Text, Panel, ManagedDataInspector, createTablePlugin} from 'flipper';
type Id = number;
type Row = {
id: Id,
title: string,
url: string,
};
function buildRow(row: Row) {
return {
columns: {
title: {
value: <Text>{row.title}</Text>,
filterValue: row.title,
},
url: {
value: <Text>{row.url}</Text>,
filterValue: row.url,
},
},
key: row.id,
copyText: JSON.stringify(row),
filterValue: `${row.title} ${row.url}`,
};
}
function renderSidebar(row: Row) {
return (
<Panel floating={false} heading={'Extras'}>
<ManagedDataInspector data={row} expandRoot={true} />
</Panel>
);
}
const columns = {
title: {
value: 'Title',
},
url: {
value: 'URL',
},
};
const columnSizes = {
title: '15%',
url: 'flex',
};
export default createTablePlugin({
method: 'newRow',
columns,
columnSizes,
renderSidebar,
buildRow,
});

View File

@@ -0,0 +1,11 @@
{
"name": "sea-mammals",
"version": "1.0.0",
"main": "index.js",
"license": "MIT",
"icon": "apps",
"title": "Sea Mammals",
"bugs": {
"email": "realpassy@fb.com"
}
}