On this page

useComponentHideState

useComponentHideState can only be used inside widget components that have been registered with the player.

The player has built-in logic for the following behavior: click the player to hide all Widgets; click again to show all Widgets; or hide all Widgets after a period of inactivity.

This hook is used to determine whether a Widget on the current screen should be displayed. true means it should be shown, and false means it should be hidden.

Type Definition

export type useComponentHideState = () => [boolean];

UsageExample

import React, { useEffect } from 'react';
import { View } from '@ray-js/components';
import {
  ComponentConfigProps,useComponentHideState
} from '@ray-js/ipc-player-integration';

function Widget1(props: ComponentConfigProps) {
  const [state] = useComponentHideState()
  console.log(state, 'state')
  
  return null;
}