douglasjunior / react-native-keyboard-manager

⚛ Library to prevent issues of keyboard sliding up and cover inputs on React-Native iOS projects.
https://www.npmjs.com/package/react-native-keyboard-manager
MIT License
952 stars 60 forks source link

prevent KeyboardManager for spamming to console #33

Closed rohozhnikoff closed 6 years ago

rohozhnikoff commented 6 years ago

KeyboardManager.setEnableDebugging(false); doesn't affect logging disabling actually we get console.info every time, when we call any method of KeyboardManager it's produce a lot of messy messages every reload

i remove them by this patch:

const keyboardManagerPrefix = 'KeyboardManager.';
const originalLogToConsole = require('react-native/Libraries/Utilities/RCTLog.js').logToConsole;

require('react-native/Libraries/Utilities/RCTLog.js').logToConsole = (logLevel, ...rest) => {
   if (
      logLevel === 'info' &&
      typeof rest[0] === 'string' &&
      rest[0].slice(0, keyboardManagerPrefix.length) === keyboardManagerPrefix
   ) {
      return;
   }
   originalLogToConsole(logLevel, ...rest);
};

but it's better to save some state on native side, and dont produce any messages, if debug==false

douglasjunior commented 6 years ago

Released 4.0.13-9