tengits-debug-tool
Version:
debug-tool for react-native
57 lines (49 loc) • 1.63 kB
JavaScript
import React, {Component} from 'react';
import {ScrollView, StyleSheet, Text} from 'react-native';
import {DebugColors} from '../utils/DebugConst';
import {dateFormat, isAndroid, isEmpty, showMsg} from '../utils/DebugUtils';
import DebugManager from '../DebugManager';
export default class SubViewConfig extends Component {
constructor(props) {
super(props);
this.state = {
infos: [],
};
}
componentWillMount(): void {
let {infos} = this.state;
let {Configs} = DebugManager;
if (isEmpty(Configs)) {
return;
}
for (let method in Configs) {
console.log("method", method);
let info = {};
info.name = method;
info.value = JSON.stringify(Configs[method]);
infos.push(info);
this.setState({infos});
}
}
render() {
let {infos} = this.state;
return <ScrollView style={{backgroundColor: DebugColors.white}}>{
!isEmpty(infos) && infos.map(({name, value}, index) => {
return <Text key={index} style={styles.title} onPress={() => showMsg(value)}>{name}:
<Text style={{color: DebugColors.blue, fontSize: 15}}>{value}</Text>
</Text>;
})}
<Text style={{height: 3}}/>
</ScrollView>;
}
}
const styles = StyleSheet.create({
title: {
fontSize: 16,
marginTop: 1,
color: DebugColors.text,
paddingVertical: 5,
paddingHorizontal: 15,
backgroundColor: DebugColors.disable,
},
});