ant-design/antd-mobile-samples

rn-custom-ui项目中主题更改不起作用

Open

#62 opened on Jun 7, 2018

View on GitHub
 (4 comments) (0 reactions) (0 assignees)HTML (1,109 forks)batch import
React Nativehelp wanted

Repository metrics

Stars
 (1,134 stars)
PR merge metrics
 (No merged PRs in 30d)

Description

克隆的是antd-mobile-samples直接运行的,运行后不起作用 image

- antd-mobile 版本:
	"dependencies": {
		"antd-mobile-rn": "next",
		"react": "^15.6.1",
		"react-native": "0.41.2"
	},

还有如下代码:

const path = require('path');
const fs = require('fs');

const defaultVars = require('antd-mobile-rn/lib/style/themes/default.native');
const customVars = require('../theme');
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 = "#108ee9"; var brandPrimaryTap = "#1284d6";module.exports = ' + JSON.stringify(themeVars)
  );
}

请问是不是还需要在其他地方进行配置?这种修改代码样式的原理是什么呢

Contributor guide