How to use ‘isVisible’ for toolbar icons? I tried to add it to the toolbar registration, but it did not take effect,like this,so where should I implement this method?
Yes, I tried, but it didn’t take effect.
@xiaofan I do not believe that isVisible
is supported for the global toolbar, only if the command is enabled/disabled. The interface is also defined as:
export type ToolbarContribution = ReactTabBarToolbarItem & ToolbarContributionProperties;
export const ToolbarContribution = Symbol('ToolbarContribution');
export const Toolbar = Symbol('Toolbar');
export const ToolbarFactory = Symbol('ToolbarFactory');
export type Toolbar = TabBarToolbar;
export type ToolbarItem = ToolbarContribution | TabBarToolbarItem;
export interface DeflatedContributedToolbarItem { id: string; group: 'contributed' };
export type ToolbarItemDeflated = DeflatedContributedToolbarItem | TabBarToolbarItem;
export const LateInjector = Symbol('LateInjector');
export const lateInjector = <T>(
context: interfaces.Container,
serviceIdentifier: interfaces.ServiceIdentifier<T>,
): T => context.get<T>(serviceIdentifier);
export interface ToolbarItemPosition {
alignment: ToolbarAlignment;
where isVisible
is omitted:
/**
* Representation of an item in the tab
*/
export interface TabBarToolbarItem extends RegisteredToolbarItem,
ExecutableToolbarItem,
RenderedToolbarItem,
Omit<ConditionalToolbarItem, 'isVisible'>,
Pick<InlineToolbarItemMetadata, 'priority'>,
Partial<MenuToolbarItemMetadata> { }
I understand what you mean. Thank you for your reply.