Skip to content

Commit 4fcdf65

Browse files
committed
support message attribute
1 parent bb7a233 commit 4fcdf65

File tree

3 files changed

+14
-4
lines changed

3 files changed

+14
-4
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,12 @@ class ExampleB extends React.Component {
137137
<td>PropTypes.string or PropTypes.element</td>
138138
<td></td>
139139
</tr>
140+
<tr>
141+
<td>message</td>
142+
<td></td>
143+
<td>PropTypes.string or PropTypes.element</td>
144+
<td></td>
145+
</tr>
140146
<tr>
141147
<td>options</td>
142148
<td></td>

lib/ActionSheetCustom.js

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,8 @@ import {
88
import styles, { btnStyle, sheetStyle, hairlineWidth } from './styles'
99

1010

11-
const TITLE_H = 40
11+
const TITLE_H = 40
12+
const MESSAGE_H = 40
1213
const CANCEL_MARGIN = 6
1314
const BUTTON_H = 50 + hairlineWidth
1415
const WARN_COLOR = '#ff3b30'
@@ -70,6 +71,7 @@ class ActionSheet extends Component {
7071
let count = props.options.length
7172
let height = BUTTON_H * count + CANCEL_MARGIN
7273
if (props.title) height += TITLE_H
74+
if (props.message) height += MESSAGE_H
7375
if (height > MAX_HEIGHT) {
7476
this.scrollEnabled = true;
7577
return MAX_HEIGHT
@@ -201,6 +203,7 @@ ActionSheet.propTypes = {
201203
PropTypes.string,
202204
PropTypes.element
203205
]),
206+
message: PropTypes.string,
204207
options: PropTypes.arrayOf((propVal, key, componentName, location, propFullName) => {
205208
if (typeof propVal[key] !== 'string' && !React.isValidElement(propVal[key])) {
206209
return new Error(

lib/styles.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ export default StyleSheet.create({
1616

1717
export const sheetStyle = StyleSheet.create({
1818
wrapper: {
19-
flex: 1,
19+
flex: 1,
2020
flexDirection: 'row'
2121
},
2222
bd: {
@@ -31,10 +31,11 @@ export const sheetStyle = StyleSheet.create({
3131
backgroundColor: '#fff'
3232
},
3333
message: {
34-
height: 20,
34+
height: 40,
35+
paddingBottom: 10,
3536
alignItems: 'center',
3637
justifyContent: 'center',
37-
backgroundColor: '#fff'
38+
backgroundColor: '#fff'
3839
},
3940
titleText: {
4041
color: '#8f8f8f',

0 commit comments

Comments
 (0)