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

input 组件 TS 语法错误 #11562

Closed
robinv8 opened this issue Apr 2, 2022 · 3 comments
Closed

input 组件 TS 语法错误 #11562

robinv8 opened this issue Apr 2, 2022 · 3 comments
Assignees
Labels
F-react Framework - React T-rn Target - 编译到 React Native V-3 Version - 3.x

Comments

@robinv8
Copy link
Member

robinv8 commented Apr 2, 2022

相关平台

React Native

使用框架: React

复现步骤

设置 plachholder 颜色文档中对应 api 不支持,使用 placeholderTextColor 但ts 语法错误

期望结果

可以设置 plachholder 颜色

实际结果

使用 taro 提供的 api 无法设置颜色,只能使用 rn 官方提供的 placeholderTextColor,但有 TS 语法错误

环境信息

Taro CLI 3.4.2 environment info:
    System:
      OS: macOS 12.3
      Shell: 5.8 - /bin/zsh
    Binaries:
      Node: 14.19.0 - ~/.nvm/versions/node/v14.19.0/bin/node
      Yarn: 1.22.17 - ~/.yarn/bin/yarn
      npm: 6.14.16 - ~/.nvm/versions/node/v14.19.0/bin/npm
    npmPackages:
      @tarojs/cli: 3.4.3 => 3.4.3 
      @tarojs/components: 3.4.3 => 3.4.3 
      @tarojs/mini-runner: 3.4.3 => 3.4.3 
      @tarojs/react: 3.4.3 => 3.4.3 
      @tarojs/runtime: 3.4.3 => 3.4.3 
      @tarojs/taro: 3.4.3 => 3.4.3 
      @tarojs/webpack-runner: 3.4.3 => 3.4.3 
      babel-preset-taro: 3.4.3 => 3.4.3 
      eslint-config-taro: 3.4.3 => 3.4.3 
      react: ^17.0.2 => 17.0.2 
      react-native: ^0.67.4 => 0.67.4 
@taro-bot2 taro-bot2 bot added F-react Framework - React T-rn Target - 编译到 React Native V-3 Version - 3.x labels Apr 2, 2022
@robinv8
Copy link
Member Author

robinv8 commented Apr 2, 2022

taro 文档中相关 api placeholderStyleplaceholderClass ,如果再添加 RN 特有 api placeholderTextColor 不太符合多端统一的原则,是否可以通过检测 placeholderClass 或者 placeholderStyle 是否存在 color 来达到设置 placeholder 颜色的目的

@zhiqingchen
Copy link
Member

因为 rn 的 input placeholder 只能支持到color,所以支持 placeholderStyle 和 placeholderClass 也无法做到统一。

个人建议

  1. 补充placeholderTextColor 的 TS 声明,难以兼容的场景是可以这样处理,@supported rn。
  2. 同时也可以兼容支持 placeholderStyle 中的 color 属性。
  3. placeholderClass 还需要有从样式文件中转化后再取得 color 属性,建议看实现难度,考虑是否支持。

@robinv8
Copy link
Member Author

robinv8 commented Apr 2, 2022

好的,我来处理

zhiqingchen added a commit that referenced this issue Apr 9, 2022
* fix(rn): input 组件 TS 语法错误 #11562

* refactor(rn): 实现 placeholderStyle 设置 placeholderTextColor

Co-authored-by: Ren Yubin <[email protected]>
Co-authored-by: tony chen <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F-react Framework - React T-rn Target - 编译到 React Native V-3 Version - 3.x
Projects
None yet
Development

No branches or pull requests

2 participants