Support auto completion on discovered bookmarks and filling out params
Summary: This diff adds support for finding appPatterns (not sure how the feature is called) in the device, and auto completing on it. Also improved the styling of bookmark sections. This diff also adds support of showing a dialog in which params an be filled out if needed. The behavior around optional arguments seems buggy, as in, no dialog will show up, but since I didn't want to change the logic around this unilaterally, left it as-is for now. Updated the dialog to Ant so that the renderReactRoot utility could be used safely Reviewed By: cekkaewnumchai Differential Revision: D24889855 fbshipit-source-id: 6af264abec2e9e5b921ef7da6deb1d0021615e9e
This commit is contained in:
committed by
Facebook GitHub Bot
parent
5118727cb7
commit
273b895e30
@@ -36,6 +36,8 @@ export {theme} from './ui/theme';
|
||||
export {Layout} from './ui/Layout';
|
||||
export {NUX, NuxManagerContext, createNuxManager} from './ui/NUX';
|
||||
|
||||
export {renderReactRoot} from './utils/renderReactRoot';
|
||||
|
||||
// It's not ideal that this exists in flipper-plugin sources directly,
|
||||
// but is the least pain for plugin authors.
|
||||
// Probably we should make sure that testing-library doesn't end up in our final Flipper bundle (which packages flipper-plugin)
|
||||
|
||||
28
desktop/flipper-plugin/src/utils/renderReactRoot.tsx
Normal file
28
desktop/flipper-plugin/src/utils/renderReactRoot.tsx
Normal file
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright (c) Facebook, Inc. and its affiliates.
|
||||
*
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
*
|
||||
* @format
|
||||
*/
|
||||
|
||||
import React from 'react';
|
||||
import {render, unmountComponentAtNode} from 'react-dom';
|
||||
|
||||
/**
|
||||
* This utility creates a fresh react render hook, which is great to render elements imperatively, like opening dialogs.
|
||||
* Make sure to call `unmount` to cleanup after the rendering becomes irrelevant
|
||||
*/
|
||||
export function renderReactRoot(
|
||||
handler: (unmount: () => void) => React.ReactElement,
|
||||
): void {
|
||||
const div = document.body.appendChild(document.createElement('div'));
|
||||
render(
|
||||
handler(() => {
|
||||
unmountComponentAtNode(div);
|
||||
div.remove();
|
||||
}),
|
||||
div,
|
||||
);
|
||||
}
|
||||
Reference in New Issue
Block a user