首先在工程当中安装npm install antd-mobile --save
css
安装完后在.babelrc文件中加入react
{ "presets": ["react-native"], // "plugins": [ // [ // "import", // {"style": "css" , "libraryName": "antd-mobile" } // ] // ], "plugins": [ ["import", { "libraryName": "antd-mobile" }] // 与 Web 平台的区别是不须要设置 style ] }
以后在组件至今进行引用使用antd-mobilenpm
这篇文章的重点固然是这里了。就是自定义antd-mobile的组件样式解决方案react-native
import ButtonStyle from 'antd-mobile/lib/button/style/index.native'; export default { ...ButtonStyle, primaryHighlight: { // your custom style here } }
styles
属性,eg: /path/to/your/file/index.jsimport { Button } from 'antd-mobile'; import CustomStyles from './custom-button/index'; ... render() { .... <Button styles={CustomStyles}>Custom Button</Button> }