draft-extend icon indicating copy to clipboard operation
draft-extend copied to clipboard

Deprecation warnings about key binding props after upgrading to draft-js 0.11.1

Open gmcnaughton opened this issue 6 years ago • 3 comments

After upgrading to draft-js 0.11.1, the following deprecation warnings appear in the console:

Supplying an `onDownArrow` prop to `DraftEditor` has been deprecated. If your handler needs access to the keyboard event, supply a custom `keyBindingFn` prop that falls back to the default one (eg. https://is.gd/RG31RJ). 
    in DraftEditor (created by EditorWrapper)
    in EditorWrapper (created by KeyCommandController(EditorWrapper))
    in KeyCommandController(EditorWrapper) (created by Anonymous)
    ...

Supplying an `onEscape` prop to `DraftEditor` has been deprecated. If your handler needs access to the keyboard event, supply a custom `keyBindingFn` prop that falls back to the default one (eg. https://is.gd/RG31RJ). 

Supplying an `onTab` prop to `DraftEditor` has been deprecated. If your handler needs access to the keyboard event, supply a custom `keyBindingFn` prop that falls back to the default one (eg. https://is.gd/RG31RJ). 

Supplying an `onUpArrow` prop to `DraftEditor` has been deprecated. If your handler needs access to the keyboard event, supply a custom `keyBindingFn` prop that falls back to the default one (eg. https://is.gd/RG31RJ). 

It looks like the default key bindings have changed and the convenience on* handlers have been deprecated.

gmcnaughton avatar Oct 14 '19 18:10 gmcnaughton

Seems like there is quite a few deprecations going on... ( https://codesandbox.io/s/draft-extend-mention-8w6ez )

WARNING: DraftEntity.create will be deprecated soon!
Please use "contentState.createEntity" instead. 
    in MentionExample (at src/​index.js:7) 
Supplying an `onDownArrow` prop to `DraftEditor` has been deprecated. If your handler needs access to the keyboard event, supply a custom `keyBindingFn` prop that falls back to the default one (eg. https://is.gd/RG31RJ). 
    in DraftEditor (created by EditorWrapper)
    in EditorWrapper (created by KeyCommandController(undefined))
    in KeyCommandController(undefined) (created by Plugin)
    in Plugin (at App.js:358)
    in MentionExample (at src/​index.js:7) 
Supplying an `onEscape` prop to `DraftEditor` has been deprecated. If your handler needs access to the keyboard event, supply a custom `keyBindingFn` prop that falls back to the default one (eg. https://is.gd/RG31RJ). 
    in DraftEditor (created by EditorWrapper)
    in EditorWrapper (created by KeyCommandController(undefined))
    in KeyCommandController(undefined) (created by Plugin)
    in Plugin (at App.js:358)
    in MentionExample (at src/​index.js:7) 
Supplying an `onTab` prop to `DraftEditor` has been deprecated. If your handler needs access to the keyboard event, supply a custom `keyBindingFn` prop that falls back to the default one (eg. https://is.gd/RG31RJ). 
    in DraftEditor (created by EditorWrapper)
    in EditorWrapper (created by KeyCommandController(undefined))
    in KeyCommandController(undefined) (created by Plugin)
    in Plugin (at App.js:358)
    in MentionExample (at src/​index.js:7) 
Supplying an `onUpArrow` prop to `DraftEditor` has been deprecated. If your handler needs access to the keyboard event, supply a custom `keyBindingFn` prop that falls back to the default one (eg. https://is.gd/RG31RJ). 
    in DraftEditor (created by EditorWrapper)
    in EditorWrapper (created by KeyCommandController(undefined))
    in KeyCommandController(undefined) (created by Plugin)
    in Plugin (at App.js:358)
    in MentionExample (at src/​index.js:7) 
Warning: componentWillMount has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.

* Move code with side effects to componentDidMount, and set initial state in the constructor.
* Rename componentWillMount to UNSAFE_componentWillMount to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.

Please update the following components: KeyCommandController(undefined) 
Warning: componentWillReceiveProps has been renamed, and is not recommended for use. See https://fb.me/react-unsafe-component-lifecycles for details.

* Move data fetching code or side effects to componentDidUpdate.
* If you're updating state whenever props change, refactor your code to use memoization techniques or move it to static getDerivedStateFromProps. Learn more at: https://fb.me/react-derived-state
* Rename componentWillReceiveProps to UNSAFE_componentWillReceiveProps to suppress this warning in non-strict mode. In React 17.x, only the UNSAFE_ name will work. To rename all deprecated lifecycles to their new names, you can run `npx react-codemod rename-unsafe-lifecycles` in your project source folder.

Please update the following components: EditorWrapper 
WARNING: DraftEntity.create will be deprecated soon!
Please use "contentState.createEntity" instead. 

amcdnl avatar Jan 09 '20 13:01 amcdnl

Are there plans to fix these warnings?

bwilliams18 avatar Jun 01 '20 22:06 bwilliams18

Facing the same issue!

jagnani73 avatar Sep 10 '22 07:09 jagnani73