Skip to content

Commit

Permalink
🐛 fix(sortable-tree): 修正 SortableTree 在 server 端的兼容性问题
Browse files Browse the repository at this point in the history
  • Loading branch information
arvinxx committed Jun 18, 2023
1 parent 5e85323 commit 9e55c9f
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion src/SortableTree/utils/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ import { arrayMove } from '@dnd-kit/sortable';
import type { FlattenNode, TreeData, TreeNode } from '../types';
import { flattenTree } from './treeNode';

export const iOS = /iPad|iPhone|iPod/.test(navigator?.platform);
export const iOS =
typeof navigator === 'undefined' ? false : /iPad|iPhone|iPod/.test(navigator?.platform);

function getDragDepth(offset: number, indentationWidth: number) {
return Math.round(offset / indentationWidth);
Expand Down

0 comments on commit 9e55c9f

Please sign in to comment.