Skip to content

Commit 905216b

Browse files
committed
chore(Rating): Update README.md
1 parent 80fac54 commit 905216b

File tree

4 files changed

+17
-10
lines changed

4 files changed

+17
-10
lines changed

example/examples/src/routes/Rating/index.tsx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,10 @@ export default class Index extends Component<IndexProps, IndexState> {
3535
<Rating
3636
defaultRating={2}
3737
resultRating={10}
38-
icon={[<Icon name="star-off" />, <Icon name="star-on" />]}
39-
// icon={["star-off", "star-on"]}
38+
icon={{
39+
unactived: <Icon name="star-off" />,
40+
actived: <Icon name="star-on" />,
41+
}}
4042
onPress={console.log}
4143
/>
4244
<View style={styles.divider} />

packages/core/src/Rating/README.md

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,8 +57,11 @@ export interface RatingProps {
5757
size?: number;
5858
/** icon 颜色 */
5959
color?: string;
60-
/** [未选中, 已选中] */
61-
icon?: icoType;
60+
/** actived 激活 unactived 未激活 */
61+
icon?: {
62+
actived?: TabsItemIconTypes,
63+
unactived?: TabsItemIconTypes
64+
};
6265
/**
6366
* void
6467
* @param score type: number 选中几个

packages/core/src/Rating/index.tsx

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React from 'react';
2-
import { View, StyleSheet, Text, TouchableOpacity } from 'react-native';
2+
import { View, StyleSheet, TouchableOpacity } from 'react-native';
33

44
import Icon, { IconsName } from '../Icon';
55
import { TabsItemIconTypes } from '../Tabs/TabsItem';
@@ -14,8 +14,11 @@ export interface RatingProps {
1414
size?: number;
1515
/** icon 颜色 */
1616
color?: string;
17-
/** [未选中, 已选中] */
18-
icon?: icoType;
17+
/** actived 激活 unactived 未激活 */
18+
icon?: {
19+
actived?: TabsItemIconTypes;
20+
unactived?: TabsItemIconTypes;
21+
};
1922
/**
2023
* void
2124
* @param score type: number 得到几分
@@ -35,8 +38,8 @@ export interface RatingState {
3538
export default class Rating extends React.Component<RatingProps, RatingState> {
3639
constructor(props: RatingProps) {
3740
super(props);
38-
let start = (props.icon && props.icon[0]) || 'star-off';
39-
let end = (props.icon && props.icon[1]) || 'star-on';
41+
let start = (props.icon && props.icon.unactived) || 'star-off';
42+
let end = (props.icon && props.icon.actived) || 'star-on';
4043
this.state = {
4144
defaultRating: props.defaultRating || 0,
4245
resultRating: props.resultRating || 5,

packages/core/src/SegmentedControl/README.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,4 +85,3 @@ function Demo() {
8585
|------|------|-----|------|
8686
| `actived` | 激活 | String | `#fff` |
8787
| `unactived` | 未激活 | String | `color` |
88-
```ts

0 commit comments

Comments
 (0)