ant-design / antd-mobile-samples

antd-mobile samples
1.15k stars 1.09k forks source link

3.0 之后定制主题的写法 #91

Open feige-2011 opened 5 years ago

feige-2011 commented 5 years ago

"@ant-design/react-native": "^3.1.5" "react-native": "0.58.4", ios

哪位老师帮忙写一下 3.0 之后定制主题的写法,谢谢啦! 3.0 之前我没用过,现在需要做夜间模式,文档中没有写主题怎么定制

yaogengzhu commented 4 years ago

同问

yaogengzhu commented 4 years ago
const path = require("path");
const { fixBabelImports, addLessLoader } = require("customize-cra");
const theme = require('./package.json').theme

module.exports = function override(config, env) {

    config = fixBabelImports('import', {
        libraryName: 'antd-mobile',
        style: true
    })(config)

    addLessLoader({
        modifyVars: theme
    })(config, env)

    return config;
};

这样配置后可以正常使用