Open lsfern opened 6 years ago
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的名字相同
我也是,怎么办?
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的名字相同