Skip to content

Commit

Permalink
Translation Radio
Browse files Browse the repository at this point in the history
  • Loading branch information
ddcat1115 committed Apr 28, 2017
1 parent 54b789a commit a0f7d2f
Show file tree
Hide file tree
Showing 5 changed files with 45 additions and 44 deletions.
12 changes: 6 additions & 6 deletions components/radio/__tests__/__snapshots__/demo.test.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ exports[`renders ./components/radio/demo/basic.tsx correctly 1`] = `
allowFontScaling={true}
ellipsizeMode="tail"
>
支持
Support
</Text>
</View>
<View
Expand Down Expand Up @@ -143,7 +143,7 @@ exports[`renders ./components/radio/demo/basic.tsx correctly 1`] = `
}
}
>
表单单选项,普通列表中单选项
Form radio, radio in general list.
</Text>
<View
accessibilityComponentType={undefined}
Expand Down Expand Up @@ -229,7 +229,7 @@ exports[`renders ./components/radio/demo/basic.tsx correctly 1`] = `
]
}
>
使用 Ant Desgin Component
Use Ant Desgin Component
</Text>
</View>
<View
Expand Down Expand Up @@ -355,7 +355,7 @@ exports[`renders ./components/radio/demo/basic.tsx correctly 1`] = `
]
}
>
使用 Ant Desgin Component
Use Ant Desgin Component
</Text>
</View>
<View
Expand Down Expand Up @@ -483,7 +483,7 @@ exports[`renders ./components/radio/demo/basic.tsx correctly 1`] = `
]
}
>
个性化调整disabled
Set disabled
</Text>
</View>
<View
Expand Down Expand Up @@ -611,7 +611,7 @@ exports[`renders ./components/radio/demo/basic.tsx correctly 1`] = `
]
}
>
个性化调整disabled
Set disabled
</Text>
</View>
<View
Expand Down
32 changes: 16 additions & 16 deletions components/radio/__tests__/__snapshots__/demo.test.web.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ exports[`renders ./components/radio/demo/basic.md correctly 1`] = `
<div
class="am-list-header"
>
RadioItem 演示
RadioItem Demo
</div>
<div
class="am-list-body"
Expand All @@ -23,7 +23,7 @@ exports[`renders ./components/radio/demo/basic.md correctly 1`] = `
<div
class="am-list-content"
>
博士
Doctor
</div>
<div
class="am-list-extra"
Expand Down Expand Up @@ -56,7 +56,7 @@ exports[`renders ./components/radio/demo/basic.md correctly 1`] = `
<div
class="am-list-content"
>
本科
Bachelor
</div>
<div
class="am-list-extra"
Expand Down Expand Up @@ -100,11 +100,11 @@ exports[`renders ./components/radio/demo/basic.md correctly 1`] = `
<div
class="am-list-content"
>
篮球
Basketball
<div
class="am-list-brief"
>
辅助文字内容
Details
</div>
</div>
<div
Expand Down Expand Up @@ -138,11 +138,11 @@ exports[`renders ./components/radio/demo/basic.md correctly 1`] = `
<div
class="am-list-content"
>
足球
Football
<div
class="am-list-brief"
>
辅助文字内容
Details
</div>
</div>
<div
Expand Down Expand Up @@ -174,7 +174,7 @@ exports[`renders ./components/radio/demo/basic.md correctly 1`] = `
<div
class="am-list-header"
>
禁用状态
Disabled
</div>
<div
class="am-list-body"
Expand All @@ -189,7 +189,7 @@ exports[`renders ./components/radio/demo/basic.md correctly 1`] = `
<div
class="am-list-content"
>
博士
Doctor
</div>
<div
class="am-list-extra"
Expand Down Expand Up @@ -223,7 +223,7 @@ exports[`renders ./components/radio/demo/basic.md correctly 1`] = `
<div
class="am-list-content"
>
本科
Bachelor
</div>
<div
class="am-list-extra"
Expand Down Expand Up @@ -268,11 +268,11 @@ exports[`renders ./components/radio/demo/basic.md correctly 1`] = `
<div
class="am-list-content"
>
篮球
Basketball
<div
class="am-list-brief"
>
辅助文字内容
Details
</div>
</div>
<div
Expand Down Expand Up @@ -307,11 +307,11 @@ exports[`renders ./components/radio/demo/basic.md correctly 1`] = `
<div
class="am-list-content"
>
足球
Football
<div
class="am-list-brief"
>
辅助文字内容
Details
</div>
</div>
<div
Expand Down Expand Up @@ -346,7 +346,7 @@ exports[`renders ./components/radio/demo/basic.md correctly 1`] = `
class="am-flexbox-item"
style="padding:0.3rem 0;color:#888;flex:none;"
>
Radio 演示 (自定义样式)
Radio Demo(Customized style)
</div>
<div
class="am-flexbox-item"
Expand All @@ -365,7 +365,7 @@ exports[`renders ./components/radio/demo/basic.md correctly 1`] = `
class="am-radio-inner"
/>
</span>
同意协议
Agree
</label>
</div>
</div>
Expand Down
16 changes: 8 additions & 8 deletions components/radio/demo/basic.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,16 +33,16 @@ class Test extends React.Component {
render() {
const { value, value2, value3, value4 } = this.state;
const data = [
{ value: 0, label: '博士' },
{ value: 1, label: '本科' },
{ value: 0, label: 'Doctor' },
{ value: 1, label: 'Bachelor' },
];
const data2 = [
{ value: 0, label: '篮球', extra: '辅助文字内容' },
{ value: 1, label: '足球', extra: '辅助文字内容' },
{ value: 0, label: 'Basketball', extra: 'Details' },
{ value: 1, label: 'Football', extra: 'Details' },
];

return (<div>
<List renderHeader={() => 'RadioItem 演示'}>
<List renderHeader={() => 'RadioItem Demo'}>
{data.map(i => (
<RadioItem key={i.value} checked={value === i.value} onChange={() => this.onChange(i.value)}>
{i.label}
Expand All @@ -58,7 +58,7 @@ class Test extends React.Component {
))}
</List>

<List renderHeader={() => '禁用状态'}>
<List renderHeader={() => 'Disabled'}>
{data.map(i => (
<RadioItem key={i.value} checked={value3 === i.value} onChange={() => this.onChange3(i.value)} disabled>
{i.label}
Expand All @@ -74,9 +74,9 @@ class Test extends React.Component {
))}
</List>
<Flex style={{ padding: '0.3rem' }}>
<Flex.Item style={{ padding: '0.3rem 0', color: '#888', flex: 'none' }}>Radio 演示 (自定义样式)</Flex.Item>
<Flex.Item style={{ padding: '0.3rem 0', color: '#888', flex: 'none' }}>Radio Demo(Customized style)</Flex.Item>
<Flex.Item>
<Radio className="my-radio" onChange={e => console.log('checkbox', e)}>同意协议</Radio>
<Radio className="my-radio" onChange={e => console.log('checkbox', e)}>Agree</Radio>
</Flex.Item>
</Flex>
</div>);
Expand Down
12 changes: 6 additions & 6 deletions components/radio/demo/basic.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export default class BasicRadioExample extends React.Component<any, any> {
}}
style={{ borderWidth: 1, borderColor: '#999', margin: 10 }}
>
支持
Support
</Radio>
<WhiteSpace />
<Radio
Expand All @@ -39,7 +39,7 @@ export default class BasicRadioExample extends React.Component<any, any> {
</View>

<List style={{ marginTop: 12 }}>
<Text style={{ marginTop: 12 }}>表单单选项,普通列表中单选项</Text>
<Text style={{ marginTop: 12 }}>Form radio, radio in general list.</Text>
<RadioItem
checked={this.state.part2Value === 1}
onChange={(event) => {
Expand All @@ -48,7 +48,7 @@ export default class BasicRadioExample extends React.Component<any, any> {
}
}}
>
使用 Ant Desgin Component
Use Ant Desgin Component
</RadioItem>
<RadioItem
checked={this.state.part2Value === 2}
Expand All @@ -58,10 +58,10 @@ export default class BasicRadioExample extends React.Component<any, any> {
}
}}
>
使用 Ant Desgin Component
Use Ant Desgin Component
</RadioItem>
<RadioItem disabled>个性化调整disabled</RadioItem>
<RadioItem disabled checked>个性化调整disabled</RadioItem>
<RadioItem disabled>Set disabled</RadioItem>
<RadioItem disabled checked>Set disabled</RadioItem>
</List>
</View>
);
Expand Down
17 changes: 9 additions & 8 deletions components/radio/index.en-US.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ type: Data Entry
title: Radio
---

单选框
Radio.

## API

Expand All @@ -14,13 +14,14 @@ Support WEB, React-Native.

Properties | Descrition | Type | Default
-----------|------------|------|--------
| name | name | String | |
| defaultChecked | 初始是否选中 | Boolean | |
| checked | 指定当前是否选中 | Boolean | |
| disabled | 禁用 | Boolean | false |
| onChange | change 事件触发的回调函数 | (e: Object): void | |
| name | name | String | - |
| defaultChecked | the initial checked state | Boolean | - |
| checked | to set the current checked state | Boolean | - |
| disabled | whether disabled | Boolean | false |
| onChange | a callback function, can be executed when the checked state changes | (e: Object): void | - |

### Radio.RadioItem

基于`List.Item``Radio`进行封装,`List.Item``extra`属性固定传入`Radio`,其他属性和`List.Item`一致。
其他 API 和 Radio 相同。
The encapsulation about `Radio` based on `List.Item`, the property `extra` of `List.Item` will be passed to `Radio`, while other properties remain the same.

Other APIs are identical with `Radio`.

0 comments on commit a0f7d2f

Please sign in to comment.