antd-mobile-samples icon indicating copy to clipboard operation
antd-mobile-samples copied to clipboard

antd-mobile-rn 自定义主题不生效

Open lsfern opened this issue 6 years ago • 1 comments

  • "antd-mobile-rn": "^2.2.0",
  • "react-native": "^0.55.4",
  • 操作系统及其版本:win7

custon-rn-theme.js: const path = require('path'); const fs = require('fs'); // for 1.x // const defaultVars = require('antd-mobile/lib/style/themes/default'); // for 2.x const defaultVars = require('antd-mobile-rn/lib/style/themes/default.native'); const customVars = require('../theme'); // for 1.x // const themePath = path.resolve(require.resolve('antd-mobile'), '../style/themes/default.js'); // for 2.x const themePath = path.resolve(require.resolve('antd-mobile-rn'), '../style/themes/default.native.js'); const themeVars = Object.assign({}, defaultVars, customVars);

if (fs.statSync(themePath).isFile()) { fs.writeFileSync( themePath, 'var brandPrimary = "#F00"; var brandPrimaryTap = "#1284d6";module.exports = ' + JSON.stringify(themeVars) ); }

theme.js 变量名和default的名字相同

lsfern avatar Jun 22 '18 06:06 lsfern

我也是,怎么办?

QHTAO avatar Nov 08 '19 09:11 QHTAO