1ea6d708fS猫头猫/// 魔改自 https://github.com/itenl/react-native-vdebug 2ea6d708fS猫头猫import PropTypes from 'prop-types'; 3ea6d708fS猫头猫import React, {PureComponent} from 'react'; 4ea6d708fS猫头猫import { 5ea6d708fS猫头猫 Animated, 6ea6d708fS猫头猫 Dimensions, 7ea6d708fS猫头猫 Keyboard, 8ea6d708fS猫头猫 KeyboardAvoidingView, 9*5589cdf3S猫头猫 NativeModules, 10*5589cdf3S猫头猫 PanResponder, 11*5589cdf3S猫头猫 Platform, 12*5589cdf3S猫头猫 ScrollView, 13*5589cdf3S猫头猫 StyleSheet, 14*5589cdf3S猫头猫 Text, 15*5589cdf3S猫头猫 TextInput, 16*5589cdf3S猫头猫 TouchableOpacity, 17*5589cdf3S猫头猫 View, 18ea6d708fS猫头猫} from 'react-native'; 19ea6d708fS猫头猫import event from './src/event'; 20ea6d708fS猫头猫// import Network, { traceNetwork } from './src/network'; 21ea6d708fS猫头猫import Log, {traceLog} from './src/log'; 22ea6d708fS猫头猫import HocComp from './src/hoc'; 23ea6d708fS猫头猫import Storage from './src/storage'; 24ea6d708fS猫头猫import {replaceReg} from './src/tool'; 25ea6d708fS猫头猫 26ea6d708fS猫头猫const {width, height} = Dimensions.get('window'); 27ea6d708fS猫头猫 28ea6d708fS猫头猫let commandContext = global; 29ea6d708fS猫头猫 30ea6d708fS猫头猫export const setExternalContext = externalContext => { 31ea6d708fS猫头猫 if (externalContext) commandContext = externalContext; 32ea6d708fS猫头猫}; 33ea6d708fS猫头猫 34ea6d708fS猫头猫// Log/network trace when Element is not initialized. 35ea6d708fS猫头猫export const initTrace = () => { 36ea6d708fS猫头猫 traceLog(); 37ea6d708fS猫头猫 // traceNetwork(); 38ea6d708fS猫头猫}; 39ea6d708fS猫头猫 40ea6d708fS猫头猫class VDebug extends PureComponent { 41ea6d708fS猫头猫 static propTypes = { 42ea6d708fS猫头猫 // Expansion panel (Optional) 43ea6d708fS猫头猫 panels: PropTypes.array, 44ea6d708fS猫头猫 }; 45ea6d708fS猫头猫 46ea6d708fS猫头猫 static defaultProps = { 47ea6d708fS猫头猫 panels: null, 48ea6d708fS猫头猫 }; 49ea6d708fS猫头猫 50ea6d708fS猫头猫 constructor(props) { 51ea6d708fS猫头猫 super(props); 52ea6d708fS猫头猫 initTrace(); 53ea6d708fS猫头猫 this.containerHeight = (height / 3) * 2; 54ea6d708fS猫头猫 this.refsObj = {}; 55ea6d708fS猫头猫 this.state = { 56ea6d708fS猫头猫 commandValue: '', 57ea6d708fS猫头猫 showPanel: false, 58ea6d708fS猫头猫 currentPageIndex: 0, 59ea6d708fS猫头猫 pan: new Animated.ValueXY(), 60ea6d708fS猫头猫 scale: new Animated.Value(1), 61ea6d708fS猫头猫 panelHeight: new Animated.Value(0), 62ea6d708fS猫头猫 panels: this.addPanels(), 63ea6d708fS猫头猫 history: [], 64ea6d708fS猫头猫 historyFilter: [], 65ea6d708fS猫头猫 showHistory: false, 66ea6d708fS猫头猫 }; 67ea6d708fS猫头猫 this.panResponder = PanResponder.create({ 68ea6d708fS猫头猫 onStartShouldSetPanResponder: () => true, 69ea6d708fS猫头猫 onPanResponderGrant: () => { 70ea6d708fS猫头猫 this.state.pan.setOffset({ 71ea6d708fS猫头猫 x: this.state.pan.x._value, 72ea6d708fS猫头猫 y: this.state.pan.y._value, 73ea6d708fS猫头猫 }); 74ea6d708fS猫头猫 this.state.pan.setValue({x: 0, y: 0}); 75ea6d708fS猫头猫 Animated.spring(this.state.scale, { 76ea6d708fS猫头猫 useNativeDriver: true, 77ea6d708fS猫头猫 toValue: 1.3, 78ea6d708fS猫头猫 friction: 7, 79ea6d708fS猫头猫 }).start(); 80ea6d708fS猫头猫 }, 81ea6d708fS猫头猫 onPanResponderMove: Animated.event([ 82ea6d708fS猫头猫 null, 83ea6d708fS猫头猫 {dx: this.state.pan.x, dy: this.state.pan.y}, 84ea6d708fS猫头猫 ]), 85ea6d708fS猫头猫 onPanResponderRelease: ({nativeEvent}, gestureState) => { 86ea6d708fS猫头猫 if ( 87ea6d708fS猫头猫 Math.abs(gestureState.dx) < 5 && 88ea6d708fS猫头猫 Math.abs(gestureState.dy) < 5 89ea6d708fS猫头猫 ) 90ea6d708fS猫头猫 this.togglePanel(); 91ea6d708fS猫头猫 setTimeout(() => { 92ea6d708fS猫头猫 Animated.spring(this.state.scale, { 93ea6d708fS猫头猫 useNativeDriver: true, 94ea6d708fS猫头猫 toValue: 1, 95ea6d708fS猫头猫 friction: 7, 96ea6d708fS猫头猫 }).start(() => { 97ea6d708fS猫头猫 this.setState({ 98ea6d708fS猫头猫 top: nativeEvent.pageY, 99ea6d708fS猫头猫 }); 100ea6d708fS猫头猫 }); 101ea6d708fS猫头猫 this.state.pan.flattenOffset(); 102ea6d708fS猫头猫 }, 0); 103ea6d708fS猫头猫 }, 104ea6d708fS猫头猫 }); 105ea6d708fS猫头猫 } 106ea6d708fS猫头猫 107ea6d708fS猫头猫 componentDidMount() { 108ea6d708fS猫头猫 this.state.pan.setValue({x: 0, y: 0}); 109ea6d708fS猫头猫 Storage.support() && 110ea6d708fS猫头猫 Storage.get('react-native-vdebug@history').then(res => { 111ea6d708fS猫头猫 if (res) { 112ea6d708fS猫头猫 this.setState({ 113ea6d708fS猫头猫 history: res, 114ea6d708fS猫头猫 }); 115ea6d708fS猫头猫 } 116ea6d708fS猫头猫 }); 117ea6d708fS猫头猫 } 118ea6d708fS猫头猫 119ea6d708fS猫头猫 getRef(index) { 120ea6d708fS猫头猫 return ref => { 121ea6d708fS猫头猫 if (!this.refsObj[index]) this.refsObj[index] = ref; 122ea6d708fS猫头猫 }; 123ea6d708fS猫头猫 } 124ea6d708fS猫头猫 125ea6d708fS猫头猫 addPanels() { 126ea6d708fS猫头猫 let defaultPanels = [ 127ea6d708fS猫头猫 { 128ea6d708fS猫头猫 title: 'Log', 129ea6d708fS猫头猫 component: HocComp(Log, this.getRef(0)), 130ea6d708fS猫头猫 }, 131ea6d708fS猫头猫 // { 132ea6d708fS猫头猫 // title: 'Network', 133ea6d708fS猫头猫 // component: HocComp(Network, this.getRef(1)) 134ea6d708fS猫头猫 // }, 135ea6d708fS猫头猫 ]; 136ea6d708fS猫头猫 if (this.props.panels && this.props.panels.length) { 137ea6d708fS猫头猫 this.props.panels.forEach((item, index) => { 138ea6d708fS猫头猫 // support up to five extended panels 139ea6d708fS猫头猫 if (index >= 3) return; 140ea6d708fS猫头猫 if (item.title && item.component) { 141ea6d708fS猫头猫 item.component = HocComp( 142ea6d708fS猫头猫 item.component, 143ea6d708fS猫头猫 this.getRef(defaultPanels.length), 144ea6d708fS猫头猫 ); 145ea6d708fS猫头猫 defaultPanels.push(item); 146ea6d708fS猫头猫 } 147ea6d708fS猫头猫 }); 148ea6d708fS猫头猫 } 149ea6d708fS猫头猫 return defaultPanels; 150ea6d708fS猫头猫 } 151ea6d708fS猫头猫 152ea6d708fS猫头猫 togglePanel() { 153ea6d708fS猫头猫 this.state.panelHeight.setValue( 154ea6d708fS猫头猫 this.state.panelHeight._value ? 0 : this.containerHeight, 155ea6d708fS猫头猫 ); 156ea6d708fS猫头猫 } 157ea6d708fS猫头猫 158ea6d708fS猫头猫 clearLogs() { 159ea6d708fS猫头猫 const tabName = this.state.panels[this.state.currentPageIndex].title; 160ea6d708fS猫头猫 event.trigger('clear', tabName); 161ea6d708fS猫头猫 } 162ea6d708fS猫头猫 163ea6d708fS猫头猫 showDev() { 164ea6d708fS猫头猫 NativeModules?.DevMenu?.show(); 165ea6d708fS猫头猫 } 166ea6d708fS猫头猫 167ea6d708fS猫头猫 reloadDev() { 168ea6d708fS猫头猫 NativeModules?.DevMenu?.reload(); 169ea6d708fS猫头猫 } 170ea6d708fS猫头猫 171ea6d708fS猫头猫 evalInContext(js, context) { 172ea6d708fS猫头猫 return function (str) { 173ea6d708fS猫头猫 let result = ''; 174ea6d708fS猫头猫 try { 175ea6d708fS猫头猫 // eslint-disable-next-line no-eval 176ea6d708fS猫头猫 result = eval(str); 177ea6d708fS猫头猫 } catch (err) { 178ea6d708fS猫头猫 result = 'Invalid input'; 179ea6d708fS猫头猫 } 180ea6d708fS猫头猫 return event.trigger('addLog', result); 181ea6d708fS猫头猫 }.call(context, `with(this) { ${js} } `); 182ea6d708fS猫头猫 } 183ea6d708fS猫头猫 184ea6d708fS猫头猫 execCommand() { 185ea6d708fS猫头猫 if (!this.state.commandValue) return; 186ea6d708fS猫头猫 this.evalInContext(this.state.commandValue, commandContext); 187ea6d708fS猫头猫 this.syncHistory(); 188ea6d708fS猫头猫 Keyboard.dismiss(); 189ea6d708fS猫头猫 } 190ea6d708fS猫头猫 191ea6d708fS猫头猫 clearCommand() { 192ea6d708fS猫头猫 this.textInput.clear(); 193ea6d708fS猫头猫 this.setState({ 194ea6d708fS猫头猫 historyFilter: [], 195ea6d708fS猫头猫 }); 196ea6d708fS猫头猫 } 197ea6d708fS猫头猫 198ea6d708fS猫头猫 scrollToPage(index, animated = true) { 199ea6d708fS猫头猫 this.scrollToCard(index, animated); 200ea6d708fS猫头猫 } 201ea6d708fS猫头猫 202ea6d708fS猫头猫 scrollToCard(cardIndex, animated = true) { 203ea6d708fS猫头猫 if (cardIndex < 0) cardIndex = 0; 204ea6d708fS猫头猫 else if (cardIndex >= this.cardCount) cardIndex = this.cardCount - 1; 205ea6d708fS猫头猫 if (this.scrollView) { 206ea6d708fS猫头猫 this.scrollView.scrollTo({ 207ea6d708fS猫头猫 x: width * cardIndex, 208ea6d708fS猫头猫 y: 0, 209ea6d708fS猫头猫 animated: animated, 210ea6d708fS猫头猫 }); 211ea6d708fS猫头猫 } 212ea6d708fS猫头猫 } 213ea6d708fS猫头猫 214ea6d708fS猫头猫 scrollToTop() { 215ea6d708fS猫头猫 const item = this.refsObj[this.state.currentPageIndex]; 216ea6d708fS猫头猫 const instance = item?.getScrollRef && item?.getScrollRef(); 217ea6d708fS猫头猫 if (instance) { 218ea6d708fS猫头猫 // FlatList 219ea6d708fS猫头猫 instance.scrollToOffset && 220ea6d708fS猫头猫 instance.scrollToOffset({ 221ea6d708fS猫头猫 animated: true, 222ea6d708fS猫头猫 viewPosition: 0, 223ea6d708fS猫头猫 index: 0, 224ea6d708fS猫头猫 }); 225ea6d708fS猫头猫 // ScrollView 226ea6d708fS猫头猫 instance.scrollTo && 227ea6d708fS猫头猫 instance.scrollTo({x: 0, y: 0, animated: true}); 228ea6d708fS猫头猫 } 229ea6d708fS猫头猫 } 230ea6d708fS猫头猫 231ea6d708fS猫头猫 renderPanelHeader() { 232ea6d708fS猫头猫 return ( 233ea6d708fS猫头猫 <View style={styles.panelHeader}> 234ea6d708fS猫头猫 {this.state.panels.map((item, index) => ( 235ea6d708fS猫头猫 <TouchableOpacity 236ea6d708fS猫头猫 key={index.toString()} 237ea6d708fS猫头猫 onPress={() => { 238ea6d708fS猫头猫 if (index != this.state.currentPageIndex) { 239ea6d708fS猫头猫 this.scrollToPage(index); 240ea6d708fS猫头猫 this.setState({currentPageIndex: index}); 241ea6d708fS猫头猫 } else { 242ea6d708fS猫头猫 this.scrollToTop(); 243ea6d708fS猫头猫 } 244ea6d708fS猫头猫 }} 245ea6d708fS猫头猫 style={[ 246ea6d708fS猫头猫 styles.panelHeaderItem, 247ea6d708fS猫头猫 index === this.state.currentPageIndex && 248ea6d708fS猫头猫 styles.activeTab, 249ea6d708fS猫头猫 ]}> 250ea6d708fS猫头猫 <Text style={styles.panelHeaderItemText}> 251ea6d708fS猫头猫 {item.title} 252ea6d708fS猫头猫 </Text> 253ea6d708fS猫头猫 </TouchableOpacity> 254ea6d708fS猫头猫 ))} 255ea6d708fS猫头猫 </View> 256ea6d708fS猫头猫 ); 257ea6d708fS猫头猫 } 258ea6d708fS猫头猫 259ea6d708fS猫头猫 syncHistory() { 260ea6d708fS猫头猫 if (!Storage.support()) return; 261ea6d708fS猫头猫 const res = this.state.history.filter(f => { 262ea6d708fS猫头猫 return f == this.state.commandValue; 263ea6d708fS猫头猫 }); 264ea6d708fS猫头猫 if (res && res.length) return; 265ea6d708fS猫头猫 this.state.history.splice(0, 0, this.state.commandValue); 266ea6d708fS猫头猫 this.state.historyFilter.splice(0, 0, this.state.commandValue); 267ea6d708fS猫头猫 this.setState( 268ea6d708fS猫头猫 { 269ea6d708fS猫头猫 history: this.state.history, 270ea6d708fS猫头猫 historyFilter: this.state.historyFilter, 271ea6d708fS猫头猫 }, 272ea6d708fS猫头猫 () => { 273ea6d708fS猫头猫 Storage.save('react-native-vdebug@history', this.state.history); 274ea6d708fS猫头猫 this.forceUpdate(); 275ea6d708fS猫头猫 }, 276ea6d708fS猫头猫 ); 277ea6d708fS猫头猫 } 278ea6d708fS猫头猫 279ea6d708fS猫头猫 onChange(text) { 280ea6d708fS猫头猫 const state = {commandValue: text}; 281ea6d708fS猫头猫 if (text) { 282ea6d708fS猫头猫 const res = this.state.history.filter(f => 283ea6d708fS猫头猫 f.toLowerCase().match(replaceReg(text)), 284ea6d708fS猫头猫 ); 285ea6d708fS猫头猫 if (res && res.length) state.historyFilter = res; 286ea6d708fS猫头猫 } else { 287ea6d708fS猫头猫 state.historyFilter = []; 288ea6d708fS猫头猫 } 289ea6d708fS猫头猫 this.setState(state); 290ea6d708fS猫头猫 } 291ea6d708fS猫头猫 292ea6d708fS猫头猫 renderCommandBar() { 293ea6d708fS猫头猫 return ( 294ea6d708fS猫头猫 <KeyboardAvoidingView 295ea6d708fS猫头猫 keyboardVerticalOffset={Platform.OS == 'android' ? 0 : 300} 296ea6d708fS猫头猫 contentContainerStyle={{flex: 1}} 297ea6d708fS猫头猫 behavior={'position'} 298ea6d708fS猫头猫 style={{ 299ea6d708fS猫头猫 height: this.state.historyFilter.length ? 120 : 40, 300ea6d708fS猫头猫 borderWidth: StyleSheet.hairlineWidth, 301ea6d708fS猫头猫 borderColor: '#d9d9d9', 302ea6d708fS猫头猫 }}> 303ea6d708fS猫头猫 <View 304ea6d708fS猫头猫 style={[ 305ea6d708fS猫头猫 styles.historyContainer, 306ea6d708fS猫头猫 {height: this.state.historyFilter.length ? 80 : 0}, 307ea6d708fS猫头猫 ]}> 308ea6d708fS猫头猫 <ScrollView> 309ea6d708fS猫头猫 {this.state.historyFilter.map(text => { 310ea6d708fS猫头猫 return ( 311ea6d708fS猫头猫 <TouchableOpacity 312ea6d708fS猫头猫 style={{ 313ea6d708fS猫头猫 borderBottomWidth: 1, 314ea6d708fS猫头猫 borderBottomColor: '#eeeeeea1', 315ea6d708fS猫头猫 }} 316ea6d708fS猫头猫 onPress={() => { 317ea6d708fS猫头猫 if (text && text.toString) { 318ea6d708fS猫头猫 this.setState({ 319ea6d708fS猫头猫 commandValue: text.toString(), 320ea6d708fS猫头猫 }); 321ea6d708fS猫头猫 } 322ea6d708fS猫头猫 }}> 323ea6d708fS猫头猫 <Text style={{lineHeight: 25}}>{text}</Text> 324ea6d708fS猫头猫 </TouchableOpacity> 325ea6d708fS猫头猫 ); 326ea6d708fS猫头猫 })} 327ea6d708fS猫头猫 </ScrollView> 328ea6d708fS猫头猫 </View> 329ea6d708fS猫头猫 <View style={styles.commandBar}> 330ea6d708fS猫头猫 <TextInput 331ea6d708fS猫头猫 ref={ref => { 332ea6d708fS猫头猫 this.textInput = ref; 333ea6d708fS猫头猫 }} 334ea6d708fS猫头猫 style={styles.commandBarInput} 335ea6d708fS猫头猫 placeholderTextColor={'#000000a1'} 336ea6d708fS猫头猫 placeholder="Command..." 337ea6d708fS猫头猫 onChangeText={this.onChange.bind(this)} 338ea6d708fS猫头猫 value={this.state.commandValue} 339ea6d708fS猫头猫 onFocus={() => { 340ea6d708fS猫头猫 this.setState({showHistory: true}); 341ea6d708fS猫头猫 }} 342ea6d708fS猫头猫 onSubmitEditing={this.execCommand.bind(this)} 343ea6d708fS猫头猫 /> 344ea6d708fS猫头猫 <TouchableOpacity 345ea6d708fS猫头猫 style={styles.commandBarBtn} 346ea6d708fS猫头猫 onPress={this.clearCommand.bind(this)}> 347ea6d708fS猫头猫 <Text>X</Text> 348ea6d708fS猫头猫 </TouchableOpacity> 349ea6d708fS猫头猫 <TouchableOpacity 350ea6d708fS猫头猫 style={styles.commandBarBtn} 351ea6d708fS猫头猫 onPress={this.execCommand.bind(this)}> 352ea6d708fS猫头猫 <Text>OK</Text> 353ea6d708fS猫头猫 </TouchableOpacity> 354ea6d708fS猫头猫 </View> 355ea6d708fS猫头猫 </KeyboardAvoidingView> 356ea6d708fS猫头猫 ); 357ea6d708fS猫头猫 } 358ea6d708fS猫头猫 359ea6d708fS猫头猫 renderPanelFooter() { 360ea6d708fS猫头猫 return ( 361ea6d708fS猫头猫 <View style={styles.panelBottom}> 362ea6d708fS猫头猫 <TouchableOpacity 363ea6d708fS猫头猫 onPress={this.clearLogs.bind(this)} 364ea6d708fS猫头猫 style={styles.panelBottomBtn}> 365ea6d708fS猫头猫 <Text style={styles.panelBottomBtnText}>Clear</Text> 366ea6d708fS猫头猫 </TouchableOpacity> 367ea6d708fS猫头猫 {__DEV__ && Platform.OS == 'ios' && ( 368ea6d708fS猫头猫 <TouchableOpacity 369ea6d708fS猫头猫 onPress={this.showDev.bind(this)} 370ea6d708fS猫头猫 onLongPress={this.reloadDev.bind(this)} 371ea6d708fS猫头猫 style={styles.panelBottomBtn}> 372ea6d708fS猫头猫 <Text style={styles.panelBottomBtnText}>Dev</Text> 373ea6d708fS猫头猫 </TouchableOpacity> 374ea6d708fS猫头猫 )} 375ea6d708fS猫头猫 <TouchableOpacity 376ea6d708fS猫头猫 onPress={this.togglePanel.bind(this)} 377ea6d708fS猫头猫 style={styles.panelBottomBtn}> 378ea6d708fS猫头猫 <Text style={styles.panelBottomBtnText}>Hide</Text> 379ea6d708fS猫头猫 </TouchableOpacity> 380ea6d708fS猫头猫 </View> 381ea6d708fS猫头猫 ); 382ea6d708fS猫头猫 } 383ea6d708fS猫头猫 384ea6d708fS猫头猫 onScrollAnimationEnd({nativeEvent}) { 385ea6d708fS猫头猫 const currentPageIndex = Math.floor( 386ea6d708fS猫头猫 nativeEvent.contentOffset.x / Math.floor(width), 387ea6d708fS猫头猫 ); 388ea6d708fS猫头猫 currentPageIndex != this.state.currentPageIndex && 389ea6d708fS猫头猫 this.setState({ 390ea6d708fS猫头猫 currentPageIndex: currentPageIndex, 391ea6d708fS猫头猫 }); 392ea6d708fS猫头猫 } 393ea6d708fS猫头猫 394ea6d708fS猫头猫 renderPanel() { 395ea6d708fS猫头猫 return ( 396ea6d708fS猫头猫 <Animated.View 397ea6d708fS猫头猫 style={[styles.panel, {height: this.state.panelHeight}]}> 398ea6d708fS猫头猫 {this.renderPanelHeader()} 399ea6d708fS猫头猫 <ScrollView 400ea6d708fS猫头猫 onMomentumScrollEnd={this.onScrollAnimationEnd.bind(this)} 401ea6d708fS猫头猫 ref={ref => { 402ea6d708fS猫头猫 this.scrollView = ref; 403ea6d708fS猫头猫 }} 404ea6d708fS猫头猫 pagingEnabled={true} 405ea6d708fS猫头猫 showsHorizontalScrollIndicator={false} 406ea6d708fS猫头猫 horizontal={true} 407ea6d708fS猫头猫 style={styles.panelContent}> 408ea6d708fS猫头猫 {this.state.panels.map((item, index) => { 409ea6d708fS猫头猫 return ( 410ea6d708fS猫头猫 <View key={index} style={{width: width}}> 411ea6d708fS猫头猫 <item.component {...(item.props ?? {})} /> 412ea6d708fS猫头猫 </View> 413ea6d708fS猫头猫 ); 414ea6d708fS猫头猫 })} 415ea6d708fS猫头猫 </ScrollView> 416ea6d708fS猫头猫 {this.renderCommandBar()} 417ea6d708fS猫头猫 {this.renderPanelFooter()} 418ea6d708fS猫头猫 </Animated.View> 419ea6d708fS猫头猫 ); 420ea6d708fS猫头猫 } 421ea6d708fS猫头猫 422ea6d708fS猫头猫 renderDebugBtn() { 423ea6d708fS猫头猫 const {pan, scale} = this.state; 424ea6d708fS猫头猫 const [translateX, translateY] = [pan.x, pan.y]; 425ea6d708fS猫头猫 const btnStyle = {transform: [{translateX}, {translateY}, {scale}]}; 426ea6d708fS猫头猫 427ea6d708fS猫头猫 return ( 428ea6d708fS猫头猫 <Animated.View 429ea6d708fS猫头猫 {...this.panResponder.panHandlers} 430ea6d708fS猫头猫 style={[styles.homeBtn, btnStyle]}> 431ea6d708fS猫头猫 <Text style={styles.homeBtnText}>调试</Text> 432ea6d708fS猫头猫 </Animated.View> 433ea6d708fS猫头猫 ); 434ea6d708fS猫头猫 } 435ea6d708fS猫头猫 436ea6d708fS猫头猫 render() { 437ea6d708fS猫头猫 return ( 438ea6d708fS猫头猫 <View style={{flex: 1}}> 439ea6d708fS猫头猫 {this.renderPanel()} 440ea6d708fS猫头猫 {this.renderDebugBtn()} 441ea6d708fS猫头猫 </View> 442ea6d708fS猫头猫 ); 443ea6d708fS猫头猫 } 444ea6d708fS猫头猫} 445ea6d708fS猫头猫 446ea6d708fS猫头猫const styles = StyleSheet.create({ 447ea6d708fS猫头猫 activeTab: { 448ea6d708fS猫头猫 backgroundColor: '#fff', 449ea6d708fS猫头猫 }, 450ea6d708fS猫头猫 panel: { 451ea6d708fS猫头猫 position: 'absolute', 452ea6d708fS猫头猫 zIndex: 99998, 453ea6d708fS猫头猫 elevation: 99998, 454ea6d708fS猫头猫 backgroundColor: '#fff', 455ea6d708fS猫头猫 width, 456ea6d708fS猫头猫 bottom: 0, 457ea6d708fS猫头猫 right: 0, 458ea6d708fS猫头猫 }, 459ea6d708fS猫头猫 panelHeader: { 460ea6d708fS猫头猫 width, 461ea6d708fS猫头猫 backgroundColor: '#eee', 462ea6d708fS猫头猫 flexDirection: 'row', 463ea6d708fS猫头猫 borderWidth: StyleSheet.hairlineWidth, 464ea6d708fS猫头猫 borderColor: '#d9d9d9', 465ea6d708fS猫头猫 }, 466ea6d708fS猫头猫 panelHeaderItem: { 467ea6d708fS猫头猫 flex: 1, 468ea6d708fS猫头猫 height: 40, 469ea6d708fS猫头猫 color: '#000', 470ea6d708fS猫头猫 borderRightWidth: StyleSheet.hairlineWidth, 471ea6d708fS猫头猫 borderColor: '#d9d9d9', 472ea6d708fS猫头猫 justifyContent: 'center', 473ea6d708fS猫头猫 }, 474ea6d708fS猫头猫 panelHeaderItemText: { 475ea6d708fS猫头猫 textAlign: 'center', 476ea6d708fS猫头猫 }, 477ea6d708fS猫头猫 panelContent: { 478ea6d708fS猫头猫 width, 479ea6d708fS猫头猫 flex: 0.9, 480ea6d708fS猫头猫 }, 481ea6d708fS猫头猫 panelBottom: { 482ea6d708fS猫头猫 width, 483ea6d708fS猫头猫 borderWidth: StyleSheet.hairlineWidth, 484ea6d708fS猫头猫 borderColor: '#d9d9d9', 485ea6d708fS猫头猫 flexDirection: 'row', 486ea6d708fS猫头猫 alignItems: 'center', 487ea6d708fS猫头猫 backgroundColor: '#eee', 488ea6d708fS猫头猫 height: 40, 489ea6d708fS猫头猫 }, 490ea6d708fS猫头猫 panelBottomBtn: { 491ea6d708fS猫头猫 flex: 1, 492ea6d708fS猫头猫 height: 40, 493ea6d708fS猫头猫 borderRightWidth: StyleSheet.hairlineWidth, 494ea6d708fS猫头猫 borderColor: '#d9d9d9', 495ea6d708fS猫头猫 justifyContent: 'center', 496ea6d708fS猫头猫 }, 497ea6d708fS猫头猫 panelBottomBtnText: { 498ea6d708fS猫头猫 color: '#000', 499ea6d708fS猫头猫 fontSize: 14, 500ea6d708fS猫头猫 textAlign: 'center', 501ea6d708fS猫头猫 }, 502ea6d708fS猫头猫 panelEmpty: { 503ea6d708fS猫头猫 flex: 1, 504ea6d708fS猫头猫 alignItems: 'center', 505ea6d708fS猫头猫 justifyContent: 'center', 506ea6d708fS猫头猫 }, 507ea6d708fS猫头猫 homeBtn: { 508ea6d708fS猫头猫 width: 60, 509ea6d708fS猫头猫 paddingVertical: 5, 510ea6d708fS猫头猫 backgroundColor: '#04be02', 511ea6d708fS猫头猫 borderRadius: 4, 512ea6d708fS猫头猫 alignItems: 'center', 513ea6d708fS猫头猫 justifyContent: 'center', 514ea6d708fS猫头猫 position: 'absolute', 515ea6d708fS猫头猫 zIndex: 99999, 516ea6d708fS猫头猫 bottom: height / 2, 517ea6d708fS猫头猫 right: 0, 518ea6d708fS猫头猫 shadowColor: 'rgb(18,34,74)', 519ea6d708fS猫头猫 shadowOffset: {width: 0, height: 1}, 520ea6d708fS猫头猫 shadowOpacity: 0.08, 521ea6d708fS猫头猫 elevation: 99999, 522ea6d708fS猫头猫 }, 523ea6d708fS猫头猫 homeBtnText: { 524ea6d708fS猫头猫 color: '#fff', 525ea6d708fS猫头猫 }, 526ea6d708fS猫头猫 commandBar: { 527ea6d708fS猫头猫 borderWidth: StyleSheet.hairlineWidth, 528ea6d708fS猫头猫 borderColor: '#d9d9d9', 529ea6d708fS猫头猫 flexDirection: 'row', 530ea6d708fS猫头猫 height: 40, 531ea6d708fS猫头猫 }, 532ea6d708fS猫头猫 commandBarInput: { 533ea6d708fS猫头猫 flex: 1, 534ea6d708fS猫头猫 paddingLeft: 10, 535ea6d708fS猫头猫 backgroundColor: '#ffffff', 536ea6d708fS猫头猫 color: '#000000', 537ea6d708fS猫头猫 }, 538ea6d708fS猫头猫 commandBarBtn: { 539ea6d708fS猫头猫 width: 40, 540ea6d708fS猫头猫 alignItems: 'center', 541ea6d708fS猫头猫 justifyContent: 'center', 542ea6d708fS猫头猫 backgroundColor: '#eee', 543ea6d708fS猫头猫 }, 544ea6d708fS猫头猫 historyContainer: { 545ea6d708fS猫头猫 borderTopWidth: 1, 546ea6d708fS猫头猫 borderTopColor: '#d9d9d9', 547ea6d708fS猫头猫 backgroundColor: '#ffffff', 548ea6d708fS猫头猫 paddingHorizontal: 10, 549ea6d708fS猫头猫 }, 550ea6d708fS猫头猫}); 551ea6d708fS猫头猫 552ea6d708fS猫头猫export default VDebug; 553