-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.js
More file actions
57 lines (53 loc) · 1.47 KB
/
index.js
File metadata and controls
57 lines (53 loc) · 1.47 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/**
* Created by dowin on 2017/5/31.
*/
import React, { Component } from 'react';
import { View, requireNativeComponent } from 'react-native';
import PropTypes from 'prop-types';
var resolveAssetSource = require('react-native/Libraries/Image/resolveAssetSource');
export default class RCTMenu extends Component {
_onchange=(event) =>{
if(this.props.onChange && event.nativeEvent){
this.props.onChange(event.nativeEvent);
}
}
_processProperties(icons) {
let arr = [];
for(let i = 0;i<icons.length;i++){
if(icons[i]){
arr.push(resolveAssetSource(icons[i]));
}
}
return arr;
}
render() {
let props = {
...this.props,
icon:resolveAssetSource(this.props.icon),
icons:this._processProperties(this.props.icons)
};
return (
<ApiMenu
{...props}
onChange={this._onchange}
/>
);
}
}
RCTMenu.propTypes = {
...View.propTypes,
titles:PropTypes.array,
icons:PropTypes.array,
XXYTitle:PropTypes.array,
//type 'XXYAction'底部选择框 'YBPopup':尖角提示框
type:PropTypes.string,
icon:PropTypes.any,
title:PropTypes.string,
onChange:PropTypes.func,
menuWidth:PropTypes.number,
};
// PopupMenuBtn.defaultProps = {
// blurType: 'dark',
// blurAmount: 10,
// };
const ApiMenu = requireNativeComponent('Menu', RCTMenu);