import * as React from "react"; import { FocusableGroupNative } from "@applicaster/zapp-react-native-ui-components/Components/NativeFocusables"; import { BaseFocusable } from "@applicaster/zapp-react-native-ui-components/Components/BaseFocusable"; // TODO: Enable when will be feature flags // import { createLogger } from "@applicaster/zapp-react-native-utils/logger"; // TODO: Enable when will be feature flags // const { log_verbose } = createLogger({ // subsystem: "General", // category: "FocusableGroup", // }); type FocusableGroupNativeEvent = { nativeEvent: { focusHeading: FocusManager.Direction; groupId: string; isActive: boolean; isFocusDisabled: boolean; isFocusingByUser: boolean; itemId: string; target: number; }; }; type Props = { id: string; children: React.ReactNode; isFocusDisabled: boolean; isWithMemory: boolean; focusGroupRef: React.Component; shouldUsePreferredFocus: boolean; groupId: string; preferredFocus: boolean; style: Record; screenData: { screenId: string; parentScreenId: string }; }; export class FocusableGroup extends BaseFocusable { public readonly isGroup: boolean = true; render() { const { children, id, isFocusDisabled, isWithMemory, style = {}, groupId, ...otherProps } = this.props; const onGroupFocus = ({ nativeEvent }: FocusableGroupNativeEvent) => { // TODO: Enable when will be feature flags // log_verbose("FOCUSABLE_GROUP: onGroupFocus", { nativeEvent }); this.onFocus(this.ref, nativeEvent.focusHeading); }; const onGroupBlur = ({ nativeEvent }: FocusableGroupNativeEvent) => { // TODO: Enable when will be feature flags // log_verbose("FOCUSABLE_GROUP: onGroupBlur", { nativeEvent }); this.onBlur(this.ref, nativeEvent.focusHeading); }; return ( {children} ); } }