@@ -6,6 +6,7 @@ react-native项目中通用的浮层组件
66* ** 通用RRCAlert组件**
77* ** 通用RRCLoading组件**
88* ** 通用RRCToast组件**
9+ * ** 通用RRCActionSheet组件**
910
1011# install
1112
@@ -48,6 +49,58 @@ react-native项目中通用的浮层组件
4849
4950* 当 buttons.length > 2 时,弹窗中的按钮按纵向排列
5051
52+ ## RRCActionSheet
53+ * 引用
54+
55+ import { RRCActionSheet } from 'react-native-overlayer';
56+ ...
57+ RRCActionSheet.setActionSheetOptions({
58+ backgroundColor: defaultBackgroundColor, // 遮罩颜色
59+ fontSize: 19, // 文字字号
60+ itemHeight: 57, // 单个item的高度
61+ buttonTitleColor: 'rgba(0, 0, 14, 0.8)', // 备选按钮字体颜色
62+ cancelButtonTitleColor: 'rgba(0, 0, 14, 0.8)', // 取消按钮字体颜色
63+ buttonItemBackgroundColor: '#eee', // 备选按钮背景颜色
64+ cancelButtonBackgroundColor: '#feffff', // 取消按钮背景颜色
65+ })
66+ ...
67+
68+ const buttons = [1,'2','3',4,5,6]; // 字符串或数字型数组
69+ const buttons_2 = [ // 对象型数组 key 为 text和style
70+ {text: 1, style:{color: 'red', fontSize: 16}},
71+ {text: 2, style:{color: 'red'}},
72+ {text: 2, style:{color: 'red'}},
73+ {text: 3, style:{color: 'red'}}
74+ ]
75+ const buttons_3 = [ // 数字、字符串、对象 组合型数组
76+ {text: 1, style:{color: 'red'}},
77+ 2,
78+ {text: 3, style:{color: 'red'}},
79+ {text: 4, style:{color: 'red'}},
80+ '5'
81+ ]
82+
83+ const callback = (index)=>{
84+ console.log(`you click button with index ${index}`);
85+ }
86+ const cancelButton = {text: '确定', style:{color: 'red'}} // 默认【取消】 样式可以通过option统一设置
87+
88+ RRCActionSheet.action(buttons, callback, cancelButton);
89+
90+
91+ * ** ` setAlertOptions ` options**
92+
93+ |key|type|default value | desc |
94+ |:--:|:--:|:--:|:--:|
95+ | backgroundColor |string|rgba(0,0,0,0.3)|弹框蒙层背景色 |
96+ | fontSize | number| 19 | 文字字号
97+ | itemHeight | number| 57 | 单个item的高度
98+ | buttonTitleColor | string | rgba(0, 0, 14, 0.8) | 备选按钮字体颜色
99+ | cancelButtonTitleColor | string| #eee | 备选按钮背景颜色
100+ | buttonItemBackgroundColor | string| 19 | 文字字号
101+ | cancelButtonBackgroundColor | string | #feffff | 取消按钮背景颜色
102+
103+
51104
52105## RRCLoading
53106* 引用
@@ -83,7 +136,7 @@ react-native项目中通用的浮层组件
83136 // 如果你需要支持GIF动图
84137 compile 'com.facebook.fresco:animated-gif:1.3.0'
85138 }
86-
139+
87140## RRCToast
88141* 引用
89142
@@ -157,4 +210,15 @@ react-native项目中通用的浮层组件
157210- 各个组件统一使用` set***Options ` 的方式设置属性、样式
158211
159212### 0.1.1
160- - ` RRCToast ` 出现时可以进行toast之外的交互,如点击事件、侧滑返回等
213+ - ` RRCToast ` 出现时可以进行toast之外的交互,如点击事件、侧滑返回等
214+
215+ ### 0.2.0
216+ - 新增` RRCActionSheet ` ,用法与RRCAlert类似
217+
218+ # 效果图
219+ ![ alert] ( ./assets/alertnormal.png )
220+ ![ alert] ( ./assets/alert3.png )
221+ ![ loading] ( ./assets/loading.png )
222+ ![ actionsheet] ( ./assets/actionsheet2.png )
223+ ![ toast] ( ./assets/toast.png )
224+ ![ toast] ( ./assets/toast2.png )
0 commit comments