From 5f8c82412f0a54ca76e705a6a94347742c573417 Mon Sep 17 00:00:00 2001 From: sunnylqm Date: Thu, 22 Sep 2016 07:39:43 -0700 Subject: [PATCH] fix a broken link and provide a trick to diable log Summary: P.S, now we have four docs about navigator(s). But from my POV, the content are more or less repeated, and the logic is a little messy. I suggest someone to reforge these docs, in a more vivid and evolutionary way. Thank you! Closes https://github.com/facebook/react-native/pull/9975 Differential Revision: D3907167 Pulled By: JoelMarcey fbshipit-source-id: 9db05f8a3d70f28c6104e7cc6a2813e7eaa9f6fa --- docs/Performance.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/docs/Performance.md b/docs/Performance.md index f22f24052..8566637bd 100644 --- a/docs/Performance.md +++ b/docs/Performance.md @@ -73,7 +73,7 @@ out of the box than `Navigator`. The reason for this is that the animations for the transitions are done entirely on the main thread, and so they are not interrupted by frame drops on the JavaScript thread. ([Read about why you should probably use Navigator -anyways.](docs/navigator-comparison.html)) +anyways.](docs/using-navigators.html) Similarly, you can happily scroll up and down through a ScrollView when the JavaScript thread is locked up because the ScrollView lives on the @@ -86,6 +86,19 @@ but their receipt is not necessary for the scroll to occur). When running a bundled app, these statements can cause a big bottleneck in the JavaScript thread. This includes calls from debugging libraries such as [redux-logger](https://github.com/evgenyrodionov/redux-logger), so make sure to remove them before bundling. +> There is a [babel plugin](https://babeljs.io/docs/plugins/transform-remove-console/) that can remove all `console.*` calls. You need to install it first using `npm install babel-plugin-transform-remove-console --save`, and then edit (or create) `.babelrc` under your project directory like the following: +```json +{ + "env": { + "production": { + "plugins": ["transform-remove-console"] + } + } +} +``` +Then it will automatically remove all `console.*` calls in a release (production) version of your project. However, the `console.*` calls will still be executed in the debug version of your project. + + #### Development mode (dev=true) JavaScript thread performance suffers greatly when running in dev mode.