Skip to content

Commit 8651459

Browse files
Amber-Nan杨楠
andauthored
feat(NoticeBar): 通告栏增加文字样式修改功能 及 页面demo展示 (#304)
* fix:发布 iOS 应用商店:一. 创建AppID * fix:发布 iOS 应用商店优化排版 * fix:ios应用商店文档更新及排版优化 * fix:修改环境安装文档语法错误及部分内容优化 * fix:更新ios应用发布流程 * fix:ios应用商店发布更新 * fix:更新ios及安卓应用商店发布 * fix:安卓上架更新 * fix:增加button自定义文本实例 * fix:增加checkBox复选框size调整及文档描述效果展示 * doc:更新文档导入图片 * doc(website): Update Readme.md * fix:修复SpeedDial Android 点击事件失效及拖拽失效问题 #286 * fix:解决SelectCascader 在安卓端不能选择问题 #289 * fix:修复Modal 弹出动画底层延迟收起问题 * feat:NoticeBar 通告栏增加文字样式修改及页面demo展示 * doc(website): Update NoticeBar Readme.md * fix:解决 MenuDropdown 安卓下拉菜单被遮挡问题 Co-authored-by: 杨楠 <[email protected]>
1 parent a85d6c9 commit 8651459

File tree

5 files changed

+44
-8
lines changed

5 files changed

+44
-8
lines changed

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

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, {Component} from 'react';
2-
import {Text, StyleSheet} from 'react-native';
3-
import {MenuDropdown} from '@uiw/react-native';
2+
import {Text, View, StyleSheet, TouchableOpacity} from 'react-native';
3+
import {MenuDropdown, Toast} from '@uiw/react-native';
44
import Layout, {Container} from '../../Layout';
55
import {ComProps} from '../../routes';
66

@@ -29,6 +29,12 @@ export default class MenuDropdownView extends Component<MenuDropdownProps> {
2929
<MenuDropdown.Item>
3030
<Text>列表</Text>
3131
</MenuDropdown.Item>
32+
<MenuDropdown.Item>
33+
<TouchableOpacity
34+
onPress={() => Toast.info('你点击了选择一', 2, 'info')}>
35+
<Text>选择一</Text>
36+
</TouchableOpacity>
37+
</MenuDropdown.Item>
3238
</MenuDropdown>
3339
</Card>
3440
</Body>

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

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import React, {Component} from 'react';
22
import {Image, Text, View} from 'react-native';
3-
import {NoticeBar, Spacing} from '@uiw/react-native';
3+
import {NoticeBar, Spacing, Icon} from '@uiw/react-native';
44

55
export default class NoticeBarExample extends Component {
66
render() {
@@ -10,9 +10,11 @@ export default class NoticeBarExample extends Component {
1010
source={{
1111
uri: 'https://zos.alipayobjects.com/rmsportal/bRnouywfdRsCcLU.png',
1212
}}
13-
style={{width: 12, height: 12}}
13+
style={{width: 12, height: 12, tintColor: 'balck'}}
1414
/>
1515
);
16+
17+
const newCustomIcon = <Icon name={'star-off'} size={20} stroke={'blue'} />;
1618
return (
1719
<View style={{marginTop: 10}}>
1820
<NoticeBar
@@ -49,6 +51,24 @@ export default class NoticeBarExample extends Component {
4951
<NoticeBar mode="link" action={<Text>去看看</Text>}>
5052
Link demo for `actionText`.
5153
</NoticeBar>
54+
<Spacing />
55+
<NoticeBar mode="link" textStyle={{color: 'blue'}}>
56+
Change `actionText` color
57+
</NoticeBar>
58+
<Spacing />
59+
<NoticeBar
60+
mode="link"
61+
action={<Text style={{color: 'blue'}}>去看看</Text>}>
62+
Change `Prompt` color
63+
</NoticeBar>
64+
<Spacing />
65+
<NoticeBar
66+
mode="link"
67+
icon={newCustomIcon}
68+
textStyle={{color: 'blue', fontSize: 20}}
69+
style={{backgroundColor: 'lightblue', height: 50}}>
70+
Change demo for `action`.
71+
</NoticeBar>
5272
</View>
5373
);
5474
}

packages/core/src/MenuDropdown/index.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ export default class MenuDropdown extends React.Component<MenuDropdownProps> {
6868

6969
const { btnIcon, listHeightValue, listHeight } = this.state;
7070
return (
71-
<View style={styles.menuBox}>
71+
<View style={[styles.menuBox, { height: this.state.listHeight + 50 }]}>
7272
<Button {...btnProps} onPress={this.handleonPress} size={size}>
7373
<Text>{title}</Text>
7474
<Icon name={btnIcon} size={17} />

packages/core/src/NoticeBar/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,12 @@ const NoticeBarExample = () => {
5656
<NoticeBar mode="link" action={<Text>去看看</Text>}>
5757
Link demo for `actionText`.
5858
</NoticeBar>
59+
<Spacing />
60+
<NoticeBar
61+
textStyle={{color: 'blue', fontSize: 20}}
62+
style={{backgroundColor: 'lightblue', height: 50}}>
63+
Change demo for `action`.
64+
</NoticeBar>
5965
</View>
6066
)
6167
}
@@ -72,3 +78,5 @@ export default NoticeBarExample;
7278
| onPress | 点击关闭或者操作区域的回调函数 | (): void | |
7379
| marqueeProps | marquee 参数 | Object | `{loop: false, leading: 500, trailing: 800, fps: 40, style: {}}` |
7480
| action | 用于替换操作 icon 的文案 | ReactElement | |
81+
| style | 用于设置通告栏样式 | ViewStyle | |
82+
| textStyle | 用于设置通告栏文字样式 | TextStyle | |

packages/core/src/NoticeBar/index.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import React, { useState } from 'react';
2-
import { StyleProp, Text, TouchableWithoutFeedback, View, ViewStyle, StyleSheet } from 'react-native';
2+
import { StyleProp, Text, TouchableWithoutFeedback, View, ViewStyle, TextStyle, StyleSheet } from 'react-native';
33
import Icon from '../Icon';
44
import Marquee, { MarqueeProps } from './Marquee';
55

@@ -9,6 +9,7 @@ export type NoticeBarProps = {
99
onPress?: any;
1010
icon?: any;
1111
action?: any;
12+
textStyle?: StyleProp<TextStyle>;
1213
style?: StyleProp<ViewStyle>;
1314
marqueeProps?: MarqueeProps;
1415
};
@@ -25,7 +26,8 @@ export default (props: NoticeBarProps) => {
2526
setShow(false);
2627
}
2728
};
28-
let { children, mode, icon, style, action, marqueeProps } = props;
29+
let { children, mode, icon, style, action, marqueeProps, textStyle } = props;
30+
2931
let operationDom: any = null;
3032
icon = typeof icon === 'undefined' ? <Icon name="notification" color="#f4333c" size={15} /> : icon;
3133
if (mode === 'closable') {
@@ -41,7 +43,7 @@ export default (props: NoticeBarProps) => {
4143
<View style={[styles.notice, style]}>
4244
{icon && <View style={styles.left15}>{icon}</View>}
4345
<View style={[styles.container, icon ? styles.left6 : styles.left15]}>
44-
<Marquee style={styles.content} text={children} {...marqueeProps} />
46+
<Marquee style={[styles.content, textStyle]} text={children} {...marqueeProps} />
4547
</View>
4648
{operationDom}
4749
</View>

0 commit comments

Comments
 (0)