UNPKG

npmchenwei111

Version:

test1111

73 lines (62 loc) 1.47 kB
/** * Created by chenwei on 2017/8/22. * 认证面板 */ import React, { Component } from 'react' import { StyleSheet, View } from 'react-native' import AccreditationButton from './AccreditationButton' import AuthData from '../action/AuthData' const PropTypes = require('prop-types') class AuthenticationPanel extends Component { //设置必须属性的检测 static propTypes = { nav: PropTypes.object.isRequired, infos: PropTypes.array.isRequired, } constructor (props) { super(props) console.disableYellowBox = true } /** * 处理认证点击事件 * @param authData * @private */ _handleOnClick (action) { AuthData.handleAction(this.props.nav, action) } render () { return ( <View style={styles.container}> { this._renderAllItems() } </View> ) } _renderAllItems () { if (!this.props.infos) return null return this.props.infos.map((item, i) => { return <AccreditationButton info={{ logo: item.infoLogo, title: item.infoTitle, }} statusData={{ line: (i < (this.props.infos.length - 1)), enable: item.canCheck, checked: item.checked, }} onPress={() => { this._handleOnClick(item.infoUrl) }} /> }) } } const styles = StyleSheet.create({ container: { alignItems: 'center' } }) export default AuthenticationPanel