Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

iOS Modal.prompt input hit area too small & keyboardavoidView #1489

Closed
cncolder opened this issue Jun 27, 2017 · 28 comments
Closed

iOS Modal.prompt input hit area too small & keyboardavoidView #1489

cncolder opened this issue Jun 27, 2017 · 28 comments
Assignees
Labels

Comments

@cncolder
Copy link
Contributor

cncolder commented Jun 27, 2017

Version

1.4.0

Environment

iPhone5s Safari

Reproduction link

https://mobile.ant.design/components/modal-cn/

Steps to reproduce

点击 prompt 里的 input

What is expected?

一次命中

What is actually happening?

要很仔细的找准位置。

@cncolder
Copy link
Contributor Author

之前听说过 Mobile safari focus 问题,实现不了 autofocus。

在只有一个 input 的情况下,能不能让整个 body 都做为 hit area?

@paranoidjk
Copy link
Contributor

在只有一个 input 的情况下,能不能让整个 body 都做为 hit area?

这个我不赞成,点击区域扩得太大了。

这个尝试提供 focus. #1243

@silentcloud
Copy link
Contributor

扩大到 body,太大了

@cncolder
Copy link
Contributor Author

cncolder commented Jun 27, 2017

别激动,随口一说。😁
我只是想了解一下是不是还有人和我一样觉得这个很难点中。

我自己的解决办法是增加 line-height

@paranoidjk
Copy link
Contributor

实测居中是比较难点,要么样式上优化,要么提供 js 的 focus api

@paranoidjk paranoidjk self-assigned this Jun 27, 2017
@paranoidjk
Copy link
Contributor

@silentcloud Modal.Prompt 的 sketch 在哪?发我一份,input 感觉高度太小了

@silentcloud
Copy link
Contributor

@paranoidjk 这个有点时间了,我本地是没有了,找设计师问问看还有没有

@afc163
Copy link
Member

afc163 commented Jun 27, 2017

image

<label>
  <h2>标题</h2>
  <input />
</label>

套个 label。

https://codepen.io/anon/pen/PjOmZd?editors=001

@cncolder
Copy link
Contributor Author

cncolder commented Jun 27, 2017

@afc163 Modal.prompt 没办法传入 children。

甚至都没办法指定 input text/password 以外的类型。

是不是应该再加一个 custom type,允许用户传入自己的 input,甚至允许任意 Element,只要接口符合就行。

interface {
  defaultValue: any
  // focus: () => void // 这个可以不要,调用的时候判断有没有 focus 方法。
  onChange: (value: string) => void
}

@silentcloud
Copy link
Contributor

@cncolder

是不是应该再加一个 custom type,允许用户传入自己的 input,甚至允许任意 Element

那这个 api 方法就不好定了,而且还要 rn web 一致

@paranoidjk
Copy link
Contributor

paranoidjk commented Jul 1, 2017

@cncolder
#1125 , 我有提议在 2.0 将 API 改成声明式的

@linhanyang
Copy link

键盘遮挡按钮问题不知道大家如何解决呢?

@paranoidjk
Copy link
Contributor

@linhanyang

应该不会有键盘遮挡的问题,antd-mobile 做了 处理,实测也无法复现。

请提供可复现的 demo.

@linhanyang
Copy link

linhanyang commented Jul 21, 2017

@paranoidjk
image

在react native平台

@paranoidjk
Copy link
Contributor

@silentcloud 实测的确有键盘遮挡的问题,rn 有办法类似 web scrollIntoView 的方案吗?

@paranoidjk
Copy link
Contributor

@paranoidjk
Copy link
Contributor

@linhanyang
Copy link

嗯,是可以采用这个方法,此方法需要考虑兼容andorid平台

@linhanyang
Copy link

是否考虑在此组件加入这个方法呢?
@paranoidjk

@paranoidjk paranoidjk changed the title iOS Modal.prompt input hit area too small iOS Modal.prompt input hit area too small & keyboardavoidView Jul 21, 2017
plowsirius pushed a commit to koubei-fe/ant-design-mobile that referenced this issue Jul 24, 2017
@linhanyang
Copy link

遮挡问题没有解决哦,刚试了这个版本,还是有遮挡问题。
image
image

@linhanyang
Copy link

@linhanyang
Copy link

@linhanyang
Copy link

@paranoidjk

@paranoidjk
Copy link
Contributor

@linhanyang 抱歉,最近比较忙,这个问题如上所说,你业务代码可以自己解决,优先级比较低。

组件内部实现的不完美的话,欢迎 PR 来帮我们修复。

@linhanyang
Copy link

嗯,我目前仅仅做了下调整,而且不是太好的办法。现在在ios上显示是个问题,不仅仅是业务问题。

@aizigao
Copy link

aizigao commented Sep 1, 2017

同样的问题,项一下

@aizigao
Copy link

aizigao commented Sep 4, 2017

我在rc-dialog下提了个pr react-component/dialog#67 , 参考react-native中语网的写法 , 将keyboardavoidingview放在 Modal下可以解决这个问题

@linhanyang
Copy link

@paranoidjk 好像这个问题还是没解决吧?

lixiaoyang1992 pushed a commit to lixiaoyang1992/ant-design-mobile that referenced this issue Apr 26, 2018
lixiaoyang1992 pushed a commit to lixiaoyang1992/ant-design-mobile that referenced this issue Apr 26, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

6 participants