mirror of
https://github.com/morten-olsen/react-native-debug-console.git
synced 2026-02-08 00:36:26 +01:00
V2 (#1)
This commit is contained in:
10
packages/demo/.gitignore
vendored
Normal file
10
packages/demo/.gitignore
vendored
Normal file
@@ -0,0 +1,10 @@
|
||||
node_modules/**/*
|
||||
.expo/*
|
||||
npm-debug.*
|
||||
*.jks
|
||||
*.p12
|
||||
*.key
|
||||
*.mobileprovision
|
||||
*.orig.*
|
||||
web-build/
|
||||
web-report/
|
||||
1
packages/demo/.watchmanconfig
Normal file
1
packages/demo/.watchmanconfig
Normal file
@@ -0,0 +1 @@
|
||||
{}
|
||||
144
packages/demo/App.js
Normal file
144
packages/demo/App.js
Normal file
@@ -0,0 +1,144 @@
|
||||
import React from 'react';
|
||||
import {
|
||||
StyleSheet,
|
||||
View,
|
||||
Button,
|
||||
KeyboardAvoidingView,
|
||||
SafeAreaView,
|
||||
AsyncStorage,
|
||||
} from 'react-native';
|
||||
import {
|
||||
DevTool,
|
||||
DevToolModal,
|
||||
log,
|
||||
network,
|
||||
show,
|
||||
} from 'react-native-debug-console/src';
|
||||
|
||||
network.attach();
|
||||
log.attach(true);
|
||||
|
||||
console.log('fooo');
|
||||
let xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', 'https://google.com');
|
||||
xhr.send();
|
||||
xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', 'https://google.com/sdfsfsdfsfdf');
|
||||
xhr.send();
|
||||
|
||||
|
||||
console.log({
|
||||
hello: {
|
||||
world: 1,
|
||||
earth: 2,
|
||||
},
|
||||
});
|
||||
|
||||
AsyncStorage.setItem('a', 'b');
|
||||
AsyncStorage.setItem('b', 'c');
|
||||
AsyncStorage.setItem('c', 'd');
|
||||
|
||||
const t = new Promise((resolve, reject) => {
|
||||
setTimeout(() => {
|
||||
throw new Error('everything is broken');
|
||||
}, 1000);
|
||||
});
|
||||
|
||||
|
||||
|
||||
export default class App extends React.Component {
|
||||
render() {
|
||||
return (
|
||||
<SafeAreaView style={styles.container}>
|
||||
<KeyboardAvoidingView style={styles.wrapper} behavior="padding">
|
||||
<View>
|
||||
<Button
|
||||
style={styles.button}
|
||||
title="console.log('hello')"
|
||||
onPress={() => {
|
||||
console.log('hello');
|
||||
}}
|
||||
/>
|
||||
<View style={{ height: 10 }} />
|
||||
<Button
|
||||
title="GET XHR (html)"
|
||||
style={styles.button}
|
||||
onPress={() => {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', 'https://google.com');
|
||||
xhr.send();
|
||||
}}
|
||||
/>
|
||||
<View style={{ height: 10 }} />
|
||||
<View style={{ height: 10 }} />
|
||||
<Button
|
||||
title="GET XHR (json)"
|
||||
style={styles.button}
|
||||
onPress={() => {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open('GET', 'https://api.github.com');
|
||||
xhr.send();
|
||||
}}
|
||||
/>
|
||||
<View style={{ height: 10 }} />
|
||||
<Button
|
||||
title="POST XHR"
|
||||
style={styles.button}
|
||||
onPress={() => {
|
||||
const xhr = new XMLHttpRequest();
|
||||
xhr.open('POST', 'https://google.com');
|
||||
xhr.setRequestHeader('content-type', 'application/json');
|
||||
xhr.send(JSON.stringify({
|
||||
hello: 'world',
|
||||
}));
|
||||
}}
|
||||
/>
|
||||
<View style={{ height: 10 }} />
|
||||
<Button
|
||||
title="Unhandled error"
|
||||
style={styles.button}
|
||||
onPress={() => {
|
||||
const err = new Error('some error');
|
||||
throw err;
|
||||
}}
|
||||
/>
|
||||
<View style={{ height: 30 }} />
|
||||
<Button
|
||||
title="Show modal"
|
||||
style={styles.button}
|
||||
onPress={() => {
|
||||
show();
|
||||
}}
|
||||
/>
|
||||
<View style={{ height: 10 }} />
|
||||
</View>
|
||||
<DevTool
|
||||
style={{
|
||||
flex: 1,
|
||||
}}
|
||||
storageProvider={AsyncStorage}
|
||||
context={global}
|
||||
/>
|
||||
<DevToolModal
|
||||
storageProvider={AsyncStorage}
|
||||
context={global}
|
||||
/>
|
||||
</KeyboardAvoidingView>
|
||||
</SafeAreaView>
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
const styles = StyleSheet.create({
|
||||
container: {
|
||||
flex: 1,
|
||||
backgroundColor: '#efefef',
|
||||
},
|
||||
wrapper: {
|
||||
marginTop: 50,
|
||||
flex: 1,
|
||||
},
|
||||
button: {
|
||||
margin: 100,
|
||||
},
|
||||
});
|
||||
40
packages/demo/CHANGELOG.md
Normal file
40
packages/demo/CHANGELOG.md
Normal file
@@ -0,0 +1,40 @@
|
||||
# Change Log
|
||||
|
||||
All notable changes to this project will be documented in this file.
|
||||
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
||||
|
||||
# [2.0.0-alpha.7](https://github.com/morten-olsen/react-native-debug-console/compare/v2.0.0-alpha.6...v2.0.0-alpha.7) (2019-07-05)
|
||||
|
||||
**Note:** Version bump only for package react-native-debug-console-demo
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [2.0.0-alpha.6](https://github.com/morten-olsen/react-native-debug-console/compare/v2.0.0-alpha.5...v2.0.0-alpha.6) (2019-07-05)
|
||||
|
||||
**Note:** Version bump only for package react-native-debug-console-demo
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [2.0.0-alpha.5](https://github.com/morten-olsen/react-native-debug-console/compare/v2.0.0-alpha.4...v2.0.0-alpha.5) (2019-07-05)
|
||||
|
||||
**Note:** Version bump only for package react-native-debug-console-demo
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [2.0.0-alpha.4](https://github.com/morten-olsen/react-native-debug-console/compare/v2.0.0-alpha.3...v2.0.0-alpha.4) (2019-07-05)
|
||||
|
||||
**Note:** Version bump only for package react-native-debug-console-demo
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
# [2.0.0-alpha.3](https://github.com/morten-olsen/react-native-debug-console/compare/v2.0.0-alpha.2...v2.0.0-alpha.3) (2019-07-05)
|
||||
|
||||
**Note:** Version bump only for package react-native-debug-console-demo
|
||||
10
packages/demo/Entry.js
Normal file
10
packages/demo/Entry.js
Normal file
@@ -0,0 +1,10 @@
|
||||
import { registerRootComponent } from 'expo';
|
||||
import { activateKeepAwake } from 'expo-keep-awake';
|
||||
|
||||
import App from './App';
|
||||
|
||||
if (__DEV__) {
|
||||
activateKeepAwake();
|
||||
}
|
||||
|
||||
registerRootComponent(App);
|
||||
34
packages/demo/app.json
Normal file
34
packages/demo/app.json
Normal file
@@ -0,0 +1,34 @@
|
||||
{
|
||||
"expo": {
|
||||
"name": "react-native-debug-console",
|
||||
"slug": "demo",
|
||||
"privacy": "public",
|
||||
"sdkVersion": "33.0.0",
|
||||
"platforms": [
|
||||
"ios",
|
||||
"android",
|
||||
"web"
|
||||
],
|
||||
"version": "1.0.0",
|
||||
"orientation": "portrait",
|
||||
"icon": "./assets/icon.png",
|
||||
"splash": {
|
||||
"image": "./assets/splash.png",
|
||||
"resizeMode": "contain",
|
||||
"backgroundColor": "#ffffff"
|
||||
},
|
||||
"updates": {
|
||||
"fallbackToCacheTimeout": 0
|
||||
},
|
||||
"assetBundlePatterns": [
|
||||
"**/*"
|
||||
],
|
||||
"ios": {
|
||||
"supportsTablet": true
|
||||
},
|
||||
"packagerOpts": {
|
||||
"config": "./metro.js",
|
||||
"projectRoots": ""
|
||||
}
|
||||
}
|
||||
}
|
||||
BIN
packages/demo/assets/icon.png
Normal file
BIN
packages/demo/assets/icon.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.1 KiB |
BIN
packages/demo/assets/splash.png
Normal file
BIN
packages/demo/assets/splash.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 7.0 KiB |
3
packages/demo/babel.config.js
Normal file
3
packages/demo/babel.config.js
Normal file
@@ -0,0 +1,3 @@
|
||||
const config = require('../../babel.config');
|
||||
|
||||
module.exports = config;
|
||||
12
packages/demo/metro.js
Normal file
12
packages/demo/metro.js
Normal file
@@ -0,0 +1,12 @@
|
||||
const { createMetroConfiguration } = require('expo-yarn-workspaces');
|
||||
const path = require('path');
|
||||
|
||||
//module.exports = createMetroConfiguration(__dirname);
|
||||
|
||||
module.exports = {
|
||||
watchFolders: [
|
||||
__dirname,
|
||||
path.join(__dirname, '..', 'lib'),
|
||||
path.join(__dirname, '..', '..', 'node_modules'),
|
||||
]
|
||||
};
|
||||
30
packages/demo/package.json
Normal file
30
packages/demo/package.json
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
"name": "react-native-debug-console-demo",
|
||||
"version": "2.0.0-alpha.7",
|
||||
"main": "./Entry.js",
|
||||
"scripts": {
|
||||
"start": "expo start",
|
||||
"android": "expo start --android",
|
||||
"ios": "expo start --ios",
|
||||
"web": "expo start --web",
|
||||
"eject": "expo eject",
|
||||
"postinstall": "expo-yarn-workspaces postinstall"
|
||||
},
|
||||
"dependencies": {
|
||||
"expo": "^33.0.0",
|
||||
"react": "16.8.3",
|
||||
"react-dom": "^16.8.6",
|
||||
"react-native": "https://github.com/expo/react-native/archive/sdk-33.0.0.tar.gz",
|
||||
"react-native-debug-console": "^2.0.0-alpha.7",
|
||||
"react-native-web": "0.11.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/runtime": "^7.5.0",
|
||||
"babel-plugin-module-resolver": "^3.2.0",
|
||||
"babel-preset-expo": "^5.1.1",
|
||||
"expo-cli": "^2.21.2",
|
||||
"expo-yarn-workspaces": "^1.2.0",
|
||||
"react-art": "^16.8.6"
|
||||
},
|
||||
"private": true
|
||||
}
|
||||
Reference in New Issue
Block a user