'import React, { Component } from 'react'; import { StyleSheet, View, Text,TouchableOpacity,Image } from 'react-native';import NavigationDrawerLayout from
'react-native-navigation-drawer-layout';从以下位置导入Tab_View_Example “ ./Tab_View_Example”;导入来自“ ./Validation”的验证;导入 “ ./Check_box”中的Check_box;从中导入Drop_Down_Searchable “ ./Drop_Down_Searchable”;从导入Import Date_tabview “ ./Date_tabview”;从“反应导航”导入{NavigationActions}; 导出默认类Navigation_Drawer扩展了React.Component { constructor(){super(); this.state = {菜单:'',输入:''};} render(){返回({this.setState({菜单:e.title }); if(e.name ==='opt0'){alert(“标题:” + e.title +“- “ +”名称:“ + e.name); console.log('Menu:',e);} else if(e.name =='opt1'){console.log('Menu:',e);}其他 if(e.name =='opt2'){console.log('Menu:', e);} else if(e.name =='opt3'){//类名是 Validation.console.log('Menu:',e);}}}> 艾哈迈达巴德 ); } const样式= StyleSheet.create({});
/// NavigationDrawerLayout import * as from'react';进口 文字,ScrollView,视图,StyleSheet,DrawerLayoutAndroid,
尺寸,图片背景,图片,TouchableNativeFeedback,平台, StatusBar,} from'react-native'; import Icon from 'react-native-vector-icons / MaterialIcons';从导入Icon2 'react-native-vector-icons / FontAwesome';从中导入*作为可动画的 “可本地化的动画”; const AnimatedIcon = Animatable.createAnimatableComponent(Icon2); // var {width} = Dimensions.get('window');从导入AvatarSocial 'react-native-avatar-social';进口自崩溃 “反应本地崩溃”;从导入验证 “ ../../Components/Validation";const RippleColor =(... args) => Platform.Version> = 21吗? TouchableNativeFeedback.Ripple(... args):null; const动画= {rotateTop:{0:{rotate:'0deg',},1:{rotate: -180deg',},},rotateBottom:{0:{rotate:'0deg',},1:{rotate:'180deg',},},};导出默认类NavigationDrawerLayout扩展 React.Component {构造函数(props){super(props); this.state = {帐户:this.props.account,firstAccount:[],宽度: Dimensions.get('window')。width,selected:this.props.selected,window: this.props.window,}; this.openDrawer = this.openDrawer.bind(this);} onLayout(e){const {width,height} = Dimensions.get('window'); console.log(width,height); this.setState({ 宽度}); } openDrawer(){this.drawer.openDrawer();} closeDrawer() {this.drawer.closeDrawer();} componentWillMount() {Animatable.initializeRegistryWithDefinitions({rotateTop: Animations.rotateTop,rotateBottom:Animations.rotateBottom,});} componentDidMount(){this.openDrawer(); const {window} = this.state; const {type} = this.props;} viewBackground(el){返回 {backgroundColor:this.state.selected == el.name? el.backgroundFocus: l.background,};} textColor(el){return {color:this.state.selected == el.name? el.colorTextFocus:el.colorText,};} _ selected = e => {this.setState({selected:e.name}); this.props.onPress(e);如果 (e.close == true)this.closeDrawer()}; colorIcon(el){返回 this.state.selected == el.name? el.colorIconFocus: el.colorIcon;} badgeFunction = e => {返回this.props.badgeFunction吗? this.props.badgeFunction(e):e; }; hexToRgb(hex){var结果= /^#?([a-f\d]{2})([a-f\d]{2})([a-f\d]{2})$/i.exec(hex);返回结果? {r:parseInt(result [1],16),g:parseInt(result [2],16),b: parseInt(result [3],16),}:null;} render(){var {儿童,颜色,backgroundColor,imageBackground, 帐户,百分比,菜单,类型,statusBar,statusBarTransparency,} = this.props; var抽屉宽度=(this.state.width *百分比)/ 100; var firstAccount = this.state.firstAccount; var rgb = this.hexToRgb(statusBar?statusBar:'#000000'); var barTransparency = statusBarTransparency? statusBarTransparency:0.5; var StatusBarColor ='rgba('+ rgb.r +','+ rgb.g +','+ rgb.b +','+ barTransparency +')'; var抽屉位置= this.props.drawerPosition =='正确'? DrawerLayoutAndroid.positions.Right: DrawerLayoutAndroid.positions.Left; var list =({menu.map((e,i)=> {if(e.type == 'divider')return();否则if(e.type =='title')return( {e.title});否则返回(e.type =='menu') ( this._selected(e)} delayPressIn = {0} delayPressOut = {0} useForeground = {true} background = {RippleColor('#ccc')}}> {e.title} {e.badgeText &&({this.badgeFunction( e.badgeText)} )});})});变种 navigationView =({type!='simple'&&( )} {this.state.window =='account'吗? accountList:列表} );返回((this.drawer = _drawer)} drawerPosition = {drawerPosition} renderNavigationView = {()=> navigationView}> {children});}} const 样式= StyleSheet.create({});' //'我想去另一堂课 导航菜单中的活动,例如菜单:menu:opt1'。