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

borderTopStyle/borderRightStyle/borderBottomStyle/borderLeftStyle在RN中的支持 #1849

Closed
tourze opened this issue Jan 7, 2019 · 6 comments
Assignees
Labels
enhancement New feature or request T-rn Target - 编译到 React Native V-1 Version - 1.x

Comments

@tourze
Copy link
Contributor

tourze commented Jan 7, 2019

问题描述
在RN中使用 border-bottom: 1px solid #fff; 会报错,因为RN的StyleSheet不支持这种写法。
另外阅读文档,发现RN的border只支持borderStyle,不支持具体方向分别设置。
在看taro-ui源码时得知scss是可以使用 @if 这种表达式的。所以是否能在scss中注入类似 process.env.TARO_ENV 的变量?这样就可以让开发者在scss中做简单的控制。

系统信息
Taro CLI 1.2.4 environment info:
System:
OS: macOS 10.14.2
Shell: 5.3 - /bin/zsh
Binaries:
Node: 10.11.0 - /usr/local/bin/node
Yarn: 1.3.2 - /usr/local/bin/yarn
npm: 6.4.1 - /usr/local/bin/npm
npmGlobalPackages:
typescript: 2.4.2

@taro-bot
Copy link

taro-bot bot commented Jan 7, 2019

欢迎提交 Issue~

如果你提交的是 bug 报告,请务必遵循 Issue 模板的规范,尽量用简洁的语言描述你的问题,最好能提供一个稳定简单的复现。🙏🙏🙏

如果你的信息提供过于模糊或不足,或者已经其他 issue 已经存在相关内容,你的 issue 有可能会被关闭。

Good luck and happy coding~

@taro-bot
Copy link

taro-bot bot commented Jan 8, 2019

CC @Pines-Cheng

@Pines-Cheng
Copy link
Contributor

Pines-Cheng commented Jan 8, 2019

设置具体方向的border,可以这样写:

  border-width: 0 0 2px 0;
  border-bottom-color: #dddddd;
  border-style: solid;

@tourze
Copy link
Contributor Author

tourze commented Jan 8, 2019

设置具体方向的border,可以这样写:

  border-width: 0 0 2px 0;
  border-bottom-color: #dddddd;
  border-style: solid;

有办法在scss中判断当前环境的吗?例如同一个选择器,在RN中我用 border-style: solid; 在其他环境用 border-right-style: solid;

@Pines-Cheng
Copy link
Contributor

这个能满足你需求吗:

/*postcss-pxtransform rn eject enable*/ /*postcss-pxtransform rn eject disable*/ 中间的代码, 在编译成 RN 端的样式的时候,会被删除。建议将 RN 不支持的但 H5 端又必不可少的样式放到这里面。如:样式重制相关的代码。

/*postcss-pxtransform rn eject enable*/

.test {
  color: black;
}

/*postcss-pxtransform rn eject disable*/

@tourze
Copy link
Contributor Author

tourze commented Jan 8, 2019

这个能满足你需求吗:

/*postcss-pxtransform rn eject enable*/ /*postcss-pxtransform rn eject disable*/ 中间的代码, 在编译成 RN 端的样式的时候,会被删除。建议将 RN 不支持的但 H5 端又必不可少的样式放到这里面。如:样式重制相关的代码。

/*postcss-pxtransform rn eject enable*/

.test {
  color: black;
}

/*postcss-pxtransform rn eject disable*/

我觉得可行。如果方便的话,其他端最好也有这种注释,如支付宝和头条

@Pines-Cheng Pines-Cheng added the enhancement New feature or request label Mar 20, 2019
@Chen-jj Chen-jj added T-rn Target - 编译到 React Native and removed React Native labels Jul 6, 2020
@biorz biorz added the V-1 Version - 1.x label Aug 24, 2022
@Chen-jj Chen-jj closed this as completed Apr 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request T-rn Target - 编译到 React Native V-1 Version - 1.x
Projects
None yet
Development

No branches or pull requests

4 participants