focus from context menu
Summary: Add option to focus a view from the context menu. Reviewed By: passy Differential Revision: D15294182 fbshipit-source-id: f03db136e8365833beee3b4883d2114e98a280bd
This commit is contained in:
committed by
Facebook Github Bot
parent
ffea42e57f
commit
d6ccf74c37
@@ -78,6 +78,18 @@ export default class Inspector extends Component<Props> {
|
|||||||
?.id;
|
?.id;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
getAXContextMenuExtensions = () =>
|
||||||
|
this.props.ax
|
||||||
|
? [
|
||||||
|
{
|
||||||
|
label: 'Focus',
|
||||||
|
click: (id: ElementID) => {
|
||||||
|
this.props.client.call('onRequestAXFocus', {id});
|
||||||
|
},
|
||||||
|
},
|
||||||
|
]
|
||||||
|
: [];
|
||||||
|
|
||||||
componentDidMount() {
|
componentDidMount() {
|
||||||
this.props.client.call(this.call().GET_ROOT).then((root: Element) => {
|
this.props.client.call(this.call().GET_ROOT).then((root: Element) => {
|
||||||
this.props.setPersistedState({
|
this.props.setPersistedState({
|
||||||
@@ -257,6 +269,7 @@ export default class Inspector extends Component<Props> {
|
|||||||
root={this.root()}
|
root={this.root()}
|
||||||
elements={this.elements()}
|
elements={this.elements()}
|
||||||
focused={this.focused()}
|
focused={this.focused()}
|
||||||
|
contextMenuExtensions={this.getAXContextMenuExtensions()}
|
||||||
/>
|
/>
|
||||||
) : null;
|
) : null;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user