web-dev-qa-db-ja.com

React Native?(Expoを使用)で "BugReporting extraData"を非表示にすることは可能ですか?

ExpoでReactネイティブアプリを開くたびに、アプリに関するメタデータを含むこの大量のメッセージがコンソールに表示されますが、実際にはデバッグにはあまり役立ちません。特に、毎回同じ情報が表示され、アプリがリロードされるたびに表示されます(ホットリロードまたはライブリロードでも):

Running application "main"
with appParams: {
    "rootTag": 171,
    "initialProps": {
        "exp": {
            "manifest": {
                "splash": {
                    "backgroundColor": "#1c2d3c"
                },
                "packagerOpts": {
                    "lanType": "ip",
                    "urlRandomness": "e4-nfi",
                    "hostType": "tunnel",
                    "dev": true,
                    "minify": false
                },
                "debuggerHost": "localhost:19001",
                "bundleUrl": "http://localhost:19001/node_modules/expo/AppEntry.bundle?platform=ios&dev=true&minify=false&hot=false&assetPlugin=pathToProjectFiles",
                "facebookAppId": "FBAppIdGoesHere",
                "Android": {
                    "splash": {
                        "xxhdpi": "./src/assets/img/splash-Android.png",
                        "backgroundColor": "#1c2d3c",
                        "xxxhdpiUrl": "http://localhost:19001/assets/./src/assets/img/splash-Android.png",
                        "xhdpi": "./src/assets/img/splash-Android.png",
                        "hdpi": "./src/assets/img/splash-Android.png",
                        "xxxhdpi": "./src/assets/img/splash-Android.png",
                        "resizeMode": "cover",
                        "ldpi": "./src/assets/img/splash-Android.png",
                        "xxhdpiUrl": "http://localhost:19001/assets/./src/assets/img/splash-Android.png",
                        "ldpiUrl": "http://localhost:19001/assets/./src/assets/img/splash-Android.png",
                        "xhdpiUrl": "http://localhost:19001/assets/./src/assets/img/splash-Android.png",
                        "hdpiUrl": "http://localhost:19001/assets/./src/assets/img/splash-Android.png",
                        "mdpi": "./src/assets/img/splash-Android.png",
                        "mdpiUrl": "http://localhost:19001/assets/./src/assets/img/splash-Android.png"
                    },
                    "config": {
                        "googleSignIn": {
                            "apiKey": "APIKeyGoesHere",
                            "certificateHash": "HashGoesHere"
                        }
                    },
                    "iconUrl": "http://localhost:19001/assets/./src/assets/img/icon-Android.png",
                    "package": "com.organizationName.apps",
                    "permissions": ["CAMERA", "INTERNET", "LOCATION", "READ_EXTERNAL_STORAGE", "READ_INTERNAL_STORAGE", "WRITE_EXTERNAL_STORAGE", "com.anddoes.launcher.permission.UPDATE_COUNT", "com.Android.launcher.permission.INSTALL_SHORTCUT", "com.google.Android.c2dm.permission.RECEIVE", "com.google.Android.gms.permission.ACTIVITY_RECOGNITION", "com.google.Android.providers.gsf.permission.READ_GSERVICES", "com.htc.launcher.permission.READ_SETTINGS", "com.htc.launcher.permission.UPDATE_SHORTCUT", "com.majeur.launcher.permission.UPDATE_BADGE", "com.sec.Android.provider.badge.permission.READ", "com.sec.Android.provider.badge.permission.WRITE", "com.sonyericsson.home.permission.BROADCAST_BADGE"],
                    "icon": "./src/assets/img/icon-Android.png",
                    "versionCode": 10
                },
                "slug": "app-name-goes-here",
                "facebookDisplayName": "NameOfApp",
                "icon": "./src/assets/img/icon-Android.png",
                "primaryColor": "#cccccc",
                "isVerified": true,
                "version": "1.1.5",
                "xde": true,
                "name": "NameOfApp",
                "facebookScheme": "SomeFBSchemeCodeGoesHere",
                "iconUrl": "http://localhost:19001/assets/./src/assets/img/icon-Android.png",
                "id": "@jhwheeler/name-of-app",
                "hostUri": "localhost:19000",
                "orientation": "portrait",
                "sdkVersion": "27.0.0",
                "env": {},
                "hooks": {
                    "postPublish": [{
                        "config": {
                            "organization": "organizationNameHere",
                            "project": "projectNameHere",
                            "authToken": "authTokenGoesHere"
                        },
                        "file": "sentry-expo/upload-sourcemaps"
                    }]
                },
                "loadedFromCache": false,
                "ios": {
                    "splash": {
                        "resizeMode": "cover",
                        "imageUrl": "http://localhost:19001/assets/./src/assets/img/splash-ios.png",
                        "backgroundColor": "#1c2d3c",
                        "image": "./src/assets/img/splash-ios.png"
                    },
                    "supportsTablet": false,
                    "iconUrl": "http://localhost:19001/assets/./src/assets/img/icon-ios.png",
                    "infoPlist": {
                        "NSLocationAlwaysUsageDescription": "Nice message goes here",
                        "NSLocationWhenInUseUsageDescription": "Nice message goes here"
                    },
                    "bundleIdentifier": "com.orgName.apps",
                    "buildNumber": "1",
                    "icon": "./src/assets/img/icon-ios.png"
                },
                "logUrl": "http://localhost:19000/logs",
                "privacy": "unlisted",
                "mainModuleName": "node_modules/expo/AppEntry",
                "developer": {
                    "projectRoot": "/path/to/project",
                    "tool": "xde"
                },
                "description": "descriptionOfApp"
            },
            "appOwnership": "expo",
            "initialUri": "exp://localhost:19000",
            "Shell": 0
        }
    }
}.__DEV__ === true, development - level warning are ON, performance optimizations are OFF

Expoコンソールを見ると、先頭にBugReporting extraData:が付いており、上記をJSオブジェクトでラップしています。これがExpoに固有のものなのか、Reactネイティブメッセージ)なのかはわかりませんが、どちらの方法でも:

このメッセージを取り除く方法はありますか?非常に大きいため、実際のエラーを見つけるのがはるかに面倒になります。

15
Alacritas

Expoに精通していませんが、最近、VanillaRNプロジェクトでこのログメッセージに遭遇しました。インデックスファイルに以下を追加することで削除できました。

   console.ignoredYellowBox = ['react-native BugReporting extraData:'];
0
Shaun Saker