import Entypo from 'react-native-vector-icons/Entypo'; import SimpleLineIcons from 'react-native-vector-icons/SimpleLineIcons'; import React, { PureComponent } from 'react'; import { AppRegistry, StyleSheet, Text, View, Image, TouchableOpacity, Platform, Switch, DeviceEventEmitter } from 'react-native';
export default class Title extends PureComponent { constructor() { super();
this.state = { leftVisible: 'hidden', rigitVisible: 'hidden', };}render = () => { console.log(this) let leftView = this.props.leftVisibility == 'hidden' ?: { this.props.leftCallBack? this.props.leftCallBack():null }} > let rightView = this.props.rightVisibility == 'hidden' ?: { this.props.rightCallBack?this.props.rightCallBack():null }} > return ({leftView} );}{this.props.name ? this.props.name : 'Delphy'} {rightView}
}
const styles = StyleSheet.create({ footerContainer: {
flexDirection: 'row', justifyContent: 'center', alignItems: 'center', backgroundColor: '#45506e', height: 50},
});
使用:
back = () => { this.props.navigation.dispatch(NavigationActions.back()); }
share = () => { toastShort('share')}
render() { return ( <View> <Title leftVisibility={'visible'} rightVisibility={'visible'} name={'详情'} leftCallBack={ this.back.bind(this) } rightCallBack={ this.share.bind(this) } /> <View> ) }