编译RN代码时候出现CSS错误



  • 问题描述

    编译RN代码:taro build -- --type rn --watch,出现

    Error: Failed to parse declaration "transform: translateY(-50%)"
    

    transform: translateY(-50%) 是正常的CSS语法,不知道为什么会编译不通过。

    复现步骤 [复现问题的步骤]

    创建一个Taro项目,添加一个css文件,添加内容如下:

    .property-list-item-bd-show {
    opacity: 0;
    position: relative;
    background-color: #fff;
    transform: translateY(-50%);
    transition: 0.3s;
    opacity: 1;
    transform: translateY(0);
    }
    

    期望行为

    能过编译通过

    报错信息

    Error: Failed to parse declaration "transform: translateY(-50%)"
    

    系统信息

    Taro CLI 1.2.12 environment info:
    System:
    OS: macOS High Sierra 10.13.6
    Shell: 3.2.57 - /bin/bash
    Binaries:
    Node: 10.11.0 - /usr/local/bin/node
    Yarn: 1.13.0 - /usr/local/bin/yarn
    npm: 6.7.0 - /usr/local/bin/npm
    npmPackages:
    @tarojs/async-await: 1.2.12 => 1.2.12
    @tarojs/cli: 1.2.12 => 1.2.12
    @tarojs/components: 1.2.12 => 1.2.12
    @tarojs/plugin-babel: 1.2.12 => 1.2.12
    @tarojs/plugin-csso: 1.2.12 => 1.2.12
    @tarojs/plugin-sass: 1.2.12 => 1.2.12
    @tarojs/plugin-uglifyjs: 1.2.12 => 1.2.12
    @tarojs/redux: 1.2.12 => 1.2.12
    @tarojs/redux-h5: 1.2.12 => 1.2.12
    @tarojs/router: 1.2.12 => 1.2.12
    @tarojs/taro: 1.2.12 => 1.2.12
    @tarojs/taro-h5: 1.2.12 => 1.2.12
    @tarojs/taro-weapp: 1.2.12 => 1.2.12
    @tarojs/webpack-runner: 1.2.12 => 1.2.12
    eslint-config-taro: 1.2.12 => 1.2.12
    eslint-plugin-taro: 1.2.12 => 1.2.12
    nervjs: ^1.3.5 => 1.3.5
    

    解决:

    https://nervjs.github.io/taro/docs/before-dev-remind.html#properties-%E5%B1%9E%E6%80%A7


登录后回复