Skip to content

Commit 09863bd

Browse files
committed
feat: AtSearchBar 增加 enableNative 参数
ref: NervJS/taro#7226 ref: NervJS/taro#14196
1 parent 00a2e4d commit 09863bd

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

packages/taro-ui-docs/markdown/search-bar.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ export default class Index extends Taro.Component {
192192
| showActionButton ||| 是否一直显示右侧按钮 | Boolean | - | false |
193193
| actionName ||| 右侧按钮文案 | String | - | '搜索' |
194194
| inputType ||| 输入框输入类型 | String | 'text', 'number', 'idcard', 'digit' | 'text' |
195+
| enableNative | | | 是否使用原生键盘,仅支持支付宝小程序 | Boolean | true |
195196

196197
## 事件
197198

packages/taro-ui/src/components/search-bar/index.tsx

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ export default class AtSearchBar extends React.Component<
7676
actionName = '搜索',
7777
inputType, // 处理issue#464
7878
className,
79-
customStyle
79+
customStyle,
80+
enableNative
8081
} = this.props
8182
const { isFocus } = this.state
8283
const fontSize = 14
@@ -135,6 +136,7 @@ export default class AtSearchBar extends React.Component<
135136
focus={isFocus}
136137
disabled={disabled}
137138
maxlength={maxLength}
139+
enableNative={enableNative}
138140
onInput={this.handleChange}
139141
onFocus={this.handleFocus}
140142
onBlur={this.handleBlur}
@@ -171,7 +173,8 @@ AtSearchBar.defaultProps = {
171173
actionName: '搜索',
172174
inputType: 'text',
173175
// eslint-disable-next-line @typescript-eslint/no-empty-function
174-
onChange: (): void => {}
176+
onChange: (): void => {},
177+
enableNative: true
175178
}
176179

177180
AtSearchBar.propTypes = {
@@ -189,5 +192,6 @@ AtSearchBar.propTypes = {
189192
onBlur: PropTypes.func,
190193
onConfirm: PropTypes.func,
191194
onActionClick: PropTypes.func,
192-
onClear: PropTypes.func
195+
onClear: PropTypes.func,
196+
enableNative: PropTypes.bool
193197
}

packages/taro-ui/types/search-bar.d.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,11 @@ export interface AtSearchBarProps extends AtComponent {
5858
* @default 'text'
5959
*/
6060
inputType?: 'text' | 'number' | 'idcard' | 'digit'
61+
/** 使用原生键盘
62+
* @default true
63+
* @supported alipay
64+
*/
65+
enableNative?: boolean
6166
/**
6267
* 输入框值改变时触发的事件
6368
* @description 必填,开发者需要通过 onChange 事件来更新 value 值变化

0 commit comments

Comments
 (0)