Skip to content

Commit

Permalink
💫 Update: ContextMenuView
Browse files Browse the repository at this point in the history
  • Loading branch information
dominicstop committed Feb 6, 2024
1 parent 6e43c23 commit 70ea747
Showing 1 changed file with 11 additions and 13 deletions.
24 changes: 11 additions & 13 deletions src/components/ContextMenuView/ContextMenuView.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ export class ContextMenuView extends
super(props);

this.state = {
menuVisible : false,
menuVisible: false,
mountPreview: false,
};

Expand Down Expand Up @@ -119,7 +119,7 @@ export class ContextMenuView extends
shouldPreventLongPressGestureFromPropagating ?? true
),
debugShouldEnableLogging: (
debugShouldEnableLogging ?? true
debugShouldEnableLogging ?? LIB_ENV.shouldEnableLogging
),

// B. Pass down props...
Expand Down Expand Up @@ -226,17 +226,17 @@ export class ContextMenuView extends
this.props.onMenuWillShow?.(event);
event.stopPropagation();

this.setState({menuVisible: true});
this.setState({
menuVisible: true,
mountPreview: true,
});
};

private _handleOnMenuWillHide: OnMenuWillHideEvent = (event) => {
this.props.onMenuWillHide?.(event);
event.stopPropagation();

this.setState({
menuVisible : false,
mountPreview: false,
});
this.setState({menuVisible : false});
};

private _handleOnMenuWillCancel: OnMenuWillCancelEvent = (event) => {
Expand All @@ -255,6 +255,8 @@ export class ContextMenuView extends

event.stopPropagation();
event.persist();

this.setState({mountPreview : false});
};

private _handleOnMenuDidCancel: OnMenuDidCancelEvent = (event) => {
Expand Down Expand Up @@ -406,9 +408,7 @@ export class ContextMenuView extends
{shouldMountPreviewContainer && (
<RNIDetachedView
nativeID={NATIVE_ID_KEYS.contextMenuPreview}
shouldCleanupOnComponentWillUnmount={
props.shouldCleanupOnComponentWillUnmountForMenuPreview
}
shouldCleanupOnComponentWillUnmount={false}
>
{shouldMountPreviewContent && (
props.renderProps.renderPreview?.()
Expand All @@ -418,9 +418,7 @@ export class ContextMenuView extends
{shouldMountAuxPreviewContainer && (
<RNIDetachedView
nativeID={NATIVE_ID_KEYS.contextMenuAuxiliaryPreview}
shouldCleanupOnComponentWillUnmount={
props.shouldCleanupOnComponentWillUnmountForAuxPreview
}
shouldCleanupOnComponentWillUnmount={false}
>
{shouldMountAuxPreviewContent && (
props.renderProps.renderAuxillaryPreview?.()
Expand Down

0 comments on commit 70ea747

Please sign in to comment.