UNPKG

tengits-debug-tool

Version:

debug-tool for react-native

34 lines (27 loc) 1.11 kB
import React from 'react' import {StyleSheet, Text, TouchableOpacity, View} from 'react-native' import {isEmpty} from './DebugUtils' import {DebugColors} from './DebugConst' export function Line({style, ...props}) {//水平分割线 return <View style={[{backgroundColor: DebugColors.line, height: 0.5}, style]} {...props}/> } export function DebugItem({onPress, style, ...props}) { let {showLine, title, text} = props; let lineStyle = showLine ? {borderBottomWidth: 0.3, borderBottomColor: DebugColors.line} : {}; return <TouchableOpacity style={[{flexDirection: 'row', alignItems: 'center'}, lineStyle]} onPress={onPress}> {!isEmpty(title) && <Text style={[styles.itemStyle, {flex: 0}]}>{title}</Text>} <View style={{flexDirection: 'row', alignItems: 'center'}}> <Text style={styles.itemStyle}>{text}</Text> </View> </TouchableOpacity> } const styles = StyleSheet.create({ itemStyle: { flex: 1, fontSize: 14, color: DebugColors.text, paddingVertical: 16, paddingLeft: 15, paddingRight: 10 } });