Skip to content

Commit

Permalink
Merge branch 'main' into hybrid
Browse files Browse the repository at this point in the history
  • Loading branch information
qican777 authored Jan 29, 2024
2 parents e789db0 + c094615 commit cc468e2
Show file tree
Hide file tree
Showing 7 changed files with 344 additions and 4 deletions.
31 changes: 31 additions & 0 deletions packages/taro-components-react/src/components/icon/index.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
import './style/index.scss'

import classNames from 'classnames'
import React from 'react'

import { omit } from '../../utils'


interface IProps {
type: string
color: string
size?: number | string
className?: string
}

const Icon = (props: IProps) => {
let { type, className = '', size = '23', color } = props
if (type) type = type.replace(/_/g, '-')
const cls = classNames(
{
[`weui-icon-${type}`]: true
},
className
)
const style = { 'font-size': size + 'px', color: color }

return (
<i {...omit(props, ['type', 'className'])} className={cls} style={style} />
)
}
export default Icon
304 changes: 304 additions & 0 deletions packages/taro-components-react/src/components/icon/style/index.scss

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion packages/taro-components-react/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ export { Editor } from '@tarojs/components/lib/react'
export { FollowSwan } from '@tarojs/components/lib/react'
export { Form } from '@tarojs/components/lib/react'
export { FunctionalPageNavigator } from '@tarojs/components/lib/react'
export { Icon } from '@tarojs/components/lib/react'
export { default as Icon } from './components/icon'
export { default as Image } from './components/image'
export { InlinePaymentPanel } from '@tarojs/components/lib/react'
export { Input } from '@tarojs/components/lib/react'
Expand Down
5 changes: 5 additions & 0 deletions packages/taro-components/types/Picker.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ import { StyleProp, TextStyle, ViewStyle } from 'react-native'
import { StandardProps, CommonEventFunction, FormItemProps } from './common'
/** 选择器通用参数 */
interface PickerStandardProps extends StandardProps, FormItemProps {
/**
* 选择器的标题,微信小程序中仅安卓可用
* @supported weapp
*/
headerText?: string
/**
* 选择器类型,默认是普通选择器
* @default "selector"
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-h5/rollup.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const baseConfig: RollupOptions = {
}),
commonjs() as InputPluginOption,
postcss({
extract: true,
// extract: true, Note: 开启需要在 @tarojs/plugin-platform-h5 中的 API 引入样式
inject: { insertAt: 'top' },
minimize: true,
}) as InputPluginOption,
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-platform-h5/src/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ export default class H5 extends TaroPlatformWeb {
break
default:
if (this.useHtmlComponents) {
args[0].loaderMeta.extraImportForWeb += `import { PullDownRefresh } from '@tarojs/components'\n`
args[0].loaderMeta.extraImportForWeb += `import '@tarojs/components-react/dist/index.css'\nimport { PullDownRefresh } from '@tarojs/components'\n`
args[0].loaderMeta.execBeforeCreateWebApp += `config.PullDownRefresh = PullDownRefresh\n`
}
}
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-platform-harmony-hybrid/src/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ export default class H5 extends TaroPlatformWeb {
break
default:
if (this.useHtmlComponents) {
args[0].loaderMeta.extraImportForWeb += `import { PullDownRefresh } from '@tarojs/components'\n`
args[0].loaderMeta.extraImportForWeb += `import '@tarojs/components-react/dist/index.css'\nimport { PullDownRefresh } from '@tarojs/components'\n`
args[0].loaderMeta.execBeforeCreateWebApp += `config.PullDownRefresh = PullDownRefresh\n`
}
}
Expand Down

0 comments on commit cc468e2

Please sign in to comment.