Skip to content

Commit 5a41b42

Browse files
authored
Merge pull request #320 from ant-mini-program/fix/native-renderer
fix: 适配 native 渲染模式
2 parents 3384b95 + c7495b0 commit 5a41b42

File tree

7 files changed

+10
-4
lines changed

7 files changed

+10
-4
lines changed

components/input-item/index.axml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
onFocus="onFocus"
2525
onBlur="onBlur"
2626
/>
27-
<view class="am-input-clear {{clear && value.length > 0 && !disabled && _focus ? 'show' : 'hidden'}}" onTap="onClear">
27+
<view class="am-input-clear {{clear && value.length > 0 && !disabled && (_focus || _native) ? 'show' : 'hidden'}}" onTap="onClear">
2828
<icon size="18" type="clear" />
2929
</view>
3030
<slot name="extra" />

components/input-item/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,9 +27,11 @@ Component({
2727
},
2828
data: {
2929
_focus: false,
30+
_native: false,
3031
},
3132
didMount() {
3233
this.setData({
34+
_native: this.renderer === 'native',
3335
_focus: this.props.focus,
3436
});
3537
},

components/search-bar/index.axml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
onConfirm="handleConfirm"
2020
sync-input="{{true}}"
2121
onBlur="handleBlur" />
22-
<view class="am-search-clear {{ _value.length > 0 && focus ? 'am-search-clear-show' : '' }}" onTap="handleClear">
22+
<view class="am-search-clear {{ _value.length > 0 && (focus || _native) ? 'am-search-clear-show' : '' }}" onTap="handleClear">
2323
<icon type="clear" size="14" />
2424
</view>
2525
</view>

components/search-bar/index.less

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@
3535
height: 14px;
3636
width: 14px;
3737
display: inline-block;
38-
background-image: url('data:image/svg+xml;base64,PD94bWwgdmVyc2lvbj0iMS4wIiBlbmNvZGluZz0iVVRGLTgiPz4KPHN2ZyB3aWR0aD0iMjhweCIgaGVpZ2h0PSIyOHB4IiB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LDcwIEM3OC4yMTg2NzQzLDcwIDgzLjQ3MzU2ODIsNzUuMzY2NjcxMiA4My40NzM1NjgyLDgxLjk4NzExODUgQzgzLjQ3MzU2ODIsODQuNTk3NjkxMyA4Mi42NDc1ODIyLDg3LjAwNjU0NTcgODEuMjU5OTQ0Nyw4OC45NzQ1MDEzIEw4OCw5NS44MzcwMTA3IEw4Ni4wNzg0MzA4LDk4IFogTTcxLjczNzA1MjgsNzIuNTA2MTAzNyBDNjYuNjA5NDg0NCw3Mi41MDYxMDM3IDYyLjQ1MjgyNjgsNzYuNzUwNjY3MSA2Mi40NTI4MjY4LDgxLjk4NzEwNzkgQzYyLjQ1MjgyNjgsODcuMjIzNTQ4NyA2Ni42MDkyMzY3LDkxLjQ2ODYxMzYgNzEuNzM3MDUyOCw5MS40Njg2MTM2IEM3Ni44NjMzODI0LDkxLjQ2ODYxMzYgODEuMDE5NzkyMyw4Ny4yMjM1NDg3IDgxLjAxOTc5MjMsODEuOTg3MTA3OSBDODEuMDE5NzkyMyw3Ni43NTA2NjcxIDc2Ljg2MzM4MjQsNzIuNTA2MTAzNyA3MS43MzcwNTI4LDcyLjUwNjEwMzcgTDcxLjczNzA1MjgsNzIuNTA2MTAzNyBaIiBpZD0iU2hhcGUiPjwvcGF0aD4KICAgICAgICAgICAgICAgIDwvZz4KICAgICAgICAgICAgPC9nPgogICAgICAgIDwvZz4KICAgIDwvZz4KPC9zdmc+');
38+
background-image: url(https://mdn.alipayobjects.com/huamei_eyzuti/afts/img/A*tLN6QrLj5zwAAAAAAAAAAAAADlPaAQ/original);
3939
background-size: contain;
4040
margin-right: 6px;
4141
vertical-align: -2px;

components/search-bar/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@ Component({
77
data: {
88
_value: '',
99
focus: false,
10+
_native: false,
1011
},
1112
didMount() {
1213
this.setData({
14+
_native: this.renderer === 'native',
1315
_value: ('value' in this.props) ? this.props.value : '',
1416
focus: this.props.focus,
1517
});

components/tabs/index.axml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
<view class="am-tabs {{className}}">
33
<view class="am-tabs-tab-bar-wrap">
44
<view class="am-tabs-bar">
5-
<view class="am-tabs-bar-content-wrap">
5+
<view class="am-tabs-bar-content-wrap" style="{{_native ? 'overflow:hidden;': ''}}">
66
<view class="am-tabs-scroll-left"></view>
77
<view class="am-tabs-scroll-right"></view>
88
<scroll-view

components/tabs/index.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,12 @@ Component({
2121
autoplay: false,
2222
animation: false,
2323
version: my.SDKVersion,
24+
_native: false,
2425
},
2526
didMount() {
2627
const { tabs, animation } = this.props;
2728
this.setData({
29+
_native: this.renderer === 'native',
2830
tabWidth: tabs.length > 3 ? 0.25 : 1 / tabs.length,
2931
animation,
3032
autoplay: true,

0 commit comments

Comments
 (0)