Add support for deleting a shared preference (#1018)

Summary:
This change makes it possible to remove preferences. I also added a `Delete` context menu option to `DataInspector` because I needed it to implement this feature. passy confirmed that it makes sense to add this because delete is a common action.

Fixes https://github.com/facebook/flipper/issues/451
Pull Request resolved: https://github.com/facebook/flipper/pull/1018

Reviewed By: jknoxville

Differential Revision: D21086308

Pulled By: passy

fbshipit-source-id: 551ff0908d5e6c93f58d6012b42e1ee3531de997
This commit is contained in:
Michal Zielinski
2020-04-17 08:58:14 -07:00
committed by Facebook GitHub Bot
parent 9b8974eeb3
commit 2d1870cf7d
5 changed files with 71 additions and 0 deletions

View File

@@ -36,6 +36,10 @@ type ManagedDataInspectorProps = {
* Callback when a value is edited.
*/
setValue?: (path: Array<string>, val: any) => void;
/**
* Callback when a delete action is invoked.
*/
onDelete?: (path: Array<string>) => void;
/**
* Whether all objects and arrays should be collapsed by default.
*/
@@ -80,6 +84,7 @@ export default class ManagedDataInspector extends PureComponent<
setValue={this.props.setValue}
expanded={this.state.expanded}
onExpanded={this.onExpanded}
onDelete={this.props.onDelete}
expandRoot={this.props.expandRoot}
collapsed={this.props.collapsed}
tooltips={this.props.tooltips}