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环境下,input组件设置初始值时,第一次点击输入框聚焦,指针出现在初始内容最前面 #13809

Closed
sjhleo opened this issue May 9, 2023 · 3 comments · Fixed by #13816
Assignees
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x

Comments

@sjhleo
Copy link
Contributor

sjhleo commented May 9, 2023

相关平台

微信小程序
IOS真机

小程序基础库: 2.30.2
使用框架: React

复现步骤

复现代码

import React from 'react';
import Taro from '@tarojs/taro';
import { View, Input, Text } from '@tarojs/components';


export default class InputPage extends React.Component {

  public constructor(props) {
    super(props);
  }

  public render(): JSX.Element {
    return (
      <View className='page'>
        <Input type='text' placeholder='test' value='12345678'/>
      </View>
    );
  }
}

期望结果

点击输入框聚焦,光标出现在内容的后面

实际结果

第一次点击聚焦光标永远在最前面,后面失焦后再点击光标才出现在初始内容的后面。设置其他类型比如number、digit也存在该问题

环境信息

👽 Taro v3.6.6


  Taro CLI 3.6.6 environment info:
    System:
      OS: Windows 10 10.0.19044
    Binaries:
      Node: 14.18.1 - C:\Program Files\nodejs\node.EXE
      Yarn: 1.22.11 - ~\AppData\Roaming\npm\yarn.CMD
      npm: 6.14.1 - C:\Program Files\nodejs\npm.CMD
    npmPackages:
      react: ^18.0.0 => 18.2.0
@taro-bot2 taro-bot2 bot added F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x labels May 9, 2023
@sjhleo sjhleo changed the title IOS环境下,input组件设置初始值时,点击输入框,第一次指针永远在最前面 IOS环境下,input组件设置初始值时,点击输入框聚焦,指针永远在最前面 May 9, 2023
@sjhleo sjhleo changed the title IOS环境下,input组件设置初始值时,点击输入框聚焦,指针永远在最前面 IOS环境下,input组件设置初始值时,第一次点击输入框聚焦,指针出现在初始内容最前面 May 9, 2023
@xuanzebin
Copy link
Member

经排查,是由于 wxml 模版的 cursor 初始值设置异常导致的,暂时没有很好的办法临时解决这个问题,会跟着下个 taro 版本一起修复上线。

@LYM0121
Copy link

LYM0121 commented May 24, 2023

经尝试,可采用,先设置focus+重新set初始值解决此问题
setTimeout(() => { setInputFocus(true); setKeyword(keyword); }, 400);

@dawenxi897094320
Copy link

taro3.6.2还是有这个bug 怎么还没解决啊,求解决方案啊。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-weapp Target - 编译到微信小程序 V-3 Version - 3.x
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

4 participants