mirror of
https://github.com/morten-olsen/react-native-debug-console.git
synced 2026-02-08 00:36:26 +01:00
init
This commit is contained in:
50
lib/src/components/DevTool/Requests/index.js
Normal file
50
lib/src/components/DevTool/Requests/index.js
Normal file
@@ -0,0 +1,50 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
StyleSheet,
|
||||
View,
|
||||
Text,
|
||||
TouchableOpacity,
|
||||
} from 'react-native';
|
||||
import State from '../../data/State';
|
||||
import Network from '../../data/Network';
|
||||
import Details from './Details';
|
||||
import List from './List';
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
},
|
||||
list: {
|
||||
flex: 1,
|
||||
borderColor: '#ccc',
|
||||
borderBottomWidth: 1,
|
||||
},
|
||||
details: {
|
||||
flex: 1,
|
||||
},
|
||||
});
|
||||
|
||||
const Console = () => (
|
||||
<State>
|
||||
{({
|
||||
active,
|
||||
}, setState) => (
|
||||
<Network>
|
||||
{({ requests }) => {
|
||||
const selected = active >= 0 ? requests[active] : undefined;
|
||||
return (
|
||||
<View style={styles.container}>
|
||||
<List
|
||||
requests={requests}
|
||||
onSelect={(i) => setState({ active: i })}
|
||||
/>
|
||||
{selected && <Details {...selected} />}
|
||||
</View>
|
||||
);
|
||||
}}
|
||||
</Network>
|
||||
)}
|
||||
</State>
|
||||
);
|
||||
|
||||
export default Console;
|
||||
Reference in New Issue
Block a user