Skip to content

Commit

Permalink
Merge pull request #320 from ant-mini-program/fix/native-renderer
Browse files Browse the repository at this point in the history
fix: 适配 native 渲染模式
  • Loading branch information
Phieo committed Jun 26, 2024
2 parents 3384b95 + c7495b0 commit 5a41b42
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion components/input-item/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
onFocus="onFocus"
onBlur="onBlur"
/>
<view class="am-input-clear {{clear && value.length > 0 && !disabled && _focus ? 'show' : 'hidden'}}" onTap="onClear">
<view class="am-input-clear {{clear && value.length > 0 && !disabled && (_focus || _native) ? 'show' : 'hidden'}}" onTap="onClear">
<icon size="18" type="clear" />
</view>
<slot name="extra" />
Expand Down
2 changes: 2 additions & 0 deletions components/input-item/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,11 @@ Component({
},
data: {
_focus: false,
_native: false,
},
didMount() {
this.setData({
_native: this.renderer === 'native',
_focus: this.props.focus,
});
},
Expand Down
2 changes: 1 addition & 1 deletion components/search-bar/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
onConfirm="handleConfirm"
sync-input="{{true}}"
onBlur="handleBlur" />
<view class="am-search-clear {{ _value.length > 0 && focus ? 'am-search-clear-show' : '' }}" onTap="handleClear">
<view class="am-search-clear {{ _value.length > 0 && (focus || _native) ? 'am-search-clear-show' : '' }}" onTap="handleClear">
<icon type="clear" size="14" />
</view>
</view>
Expand Down
2 changes: 1 addition & 1 deletion components/search-bar/index.less
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
height: 14px;
width: 14px;
display: inline-block;
background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjhweCIgaGVpZ2h0PSIyOHB4IiB2aWV3Qm94PSIwIDAgMjggMjgiIHZlcnNpb249IjEuM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IsNzUuMzY2NjcxMiA4My40NzM1NjgyLDgxLjk4NzExODUgQzgzLjQ3MzU2ODIsODQuNTk3NjkxMyA4Mi42NDc1ODIyLDg3LjAwNjU0NTcgODEuMjU5OTQ0Nyw4OC45NzQ1MDEzIEw4OCw5NS44MzcwMTA3IEw4Ni4wNzg0MzA4LDk4IFogTTcxLjczNzA1MjgsNzIuNTA2MTAzNyBDNjYuNjA5NDg0NCw3Mi41MDYxMDM3IDYyLjQ1MjgyNjgsNzYuNzUwNjY3MSA2Mi40NTI4MjY4LDgxLjk4NzEwNzkgQzYyLjQ1MjgyNjgsODcuMjIzNTQ4NyA2Ni42MDkyMzY3LDkxLjQ2ODYxMzYgNzEuNzM3MDUyOCw5MS40Njg2MTM2IEM3Ni44NjMzODI0LDkxLjQ2ODYxMzYgODEuMDE5NzkyMyw4Ny4yMjM1NDg3IDgxLjAxOTc5MjMsODEuOTg3MTA3OSBDODEuMDE5NzkyMyw3Ni43NTA2NjcxIDc2Ljg2MzM4MjQsNzIuNTA2MTAzNyA3MS43MzcwNTI4LDcyLjUwNjEwMzcgTDcxLjczNzA1MjgsNzIuNTA2MTAzNyBaIiBpZD0iU2hhcGUiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+');
background-image: url(https://mdn.alipayobjects.com/huamei_eyzuti/afts/img/A*tLN6QrLj5zwAAAAAAAAAAAAADlPaAQ/original);
background-size: contain;
margin-right: 6px;
vertical-align: -2px;
Expand Down
2 changes: 2 additions & 0 deletions components/search-bar/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ Component({
data: {
_value: '',
focus: false,
_native: false,
},
didMount() {
this.setData({
_native: this.renderer === 'native',
_value: ('value' in this.props) ? this.props.value : '',
focus: this.props.focus,
});
Expand Down
2 changes: 1 addition & 1 deletion components/tabs/index.axml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<view class="am-tabs {{className}}">
<view class="am-tabs-tab-bar-wrap">
<view class="am-tabs-bar">
<view class="am-tabs-bar-content-wrap">
<view class="am-tabs-bar-content-wrap" style="{{_native ? 'overflow:hidden;': ''}}">
<view class="am-tabs-scroll-left"></view>
<view class="am-tabs-scroll-right"></view>
<scroll-view
Expand Down
2 changes: 2 additions & 0 deletions components/tabs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@ Component({
autoplay: false,
animation: false,
version: my.SDKVersion,
_native: false,
},
didMount() {
const { tabs, animation } = this.props;
this.setData({
_native: this.renderer === 'native',
tabWidth: tabs.length > 3 ? 0.25 : 1 / tabs.length,
animation,
autoplay: true,
Expand Down

0 comments on commit 5a41b42

Please sign in to comment.