Repository: ant-design/ant-design-mobile (ts)

Issue:
touchstart 页面其他位置时，应该立即隐藏 popover
- [x] I have searched the [issues](https://github.com/ant-design/ant-design-mobile/issues) of this repository and believe that this is not a duplicate.

### What problem does this feature solve?
不立即隐藏的情况下，拖放屏幕滚动时 Popover 一直固定在同一个位置上，和 trigger 分离。如图示：

![popover](https://user-images.githubusercontent.com/143572/71142610-d25a0900-2252-11ea-9c94-03bf6fe41b66.gif)

### What does the proposed API look like?
希望 touchstart 页面其他位置时，立即隐藏 Popover 组件。


<!-- generated by ant-design-issue-helper. DO NOT REMOVE -->

Pull request description:
fix: Popover should close when screen move
fix #3497

Patch:
diff --git a/src/components/popover/popover.tsx b/src/components/popover/popover.tsx
index 5f192224e..968818665 100644
--- a/src/components/popover/popover.tsx
+++ b/src/components/popover/popover.tsx
@@ -69,7 +69,7 @@ export const Popover = forwardRef<PopoverRef, PopoverProps>((p, ref) => {
   const { mode = 'light' } = props
   const placement = normalizePlacement(props.placement)
 
-  const [visible, setVisible] = usePropsValue({
+  const [visible, setVisible] = usePropsValue<boolean>({
     value: props.visible,
     defaultValue: props.defaultVisible,
     onChange: props.onVisibleChange,
@@ -201,7 +201,8 @@ export const Popover = forwardRef<PopoverRef, PopoverProps>((p, ref) => {
       if (!props.trigger) return
       setVisible(false)
     },
-    () => targetRef.current?.element
+    [() => targetRef.current?.element, floatingRef],
+    ['click', 'touchmove']
   )
 
   const shouldRender = useShouldRender(visible, false, props.destroyOnHide)


Test patch:
diff --git a/src/components/popover/tests/popover.test.tsx b/src/components/popover/tests/popover.test.tsx
new file mode 100644
index 000000000..a8e4821db
--- /dev/null
+++ b/src/components/popover/tests/popover.test.tsx
@@ -0,0 +1,27 @@
+import * as React from 'react'
+import { render, cleanup, fireEvent } from 'testing'
+import Popover from '..'
+import Button from '../../button'
+
+describe('Popover', () => {
+  test('Touch outside to move should close Popover', () => {
+    const { container } = render(
+      <Popover content='Bamboo' trigger='click' defaultVisible>
+        <Button />
+      </Popover>
+    )
+
+    expect(document.querySelector('.adm-popover-hidden')).toBeFalsy()
+    expect(
+      document.querySelector('.adm-popover-inner-content')?.textContent
+    ).toEqual('Bamboo')
+
+    // Not close
+    fireEvent.touchMove(document.querySelector('.adm-popover-inner-content')!)
+    expect(document.querySelector('.adm-popover-hidden')).toBeFalsy()
+
+    // Close
+    fireEvent.touchMove(document.body)
+    expect(document.querySelector('.adm-popover-hidden')).toBeTruthy()
+  })
+})