creativetimofficial / ct-soft-ui-dashboard-pro

Soft UI Dashboard Pro - Bootstrap 5 Admin
34 stars 6 forks source link

[Bug] SoftEditor - passing a function as value instead of string? #61

Open stanyakimov opened 1 year ago

stanyakimov commented 1 year ago

Version

4.0.2

Reproduction link

https://codesandbox.io/

Operating System

Mac Ventura 3.4

Device

Macbook Air M1 2020

Browser & Version

Version 116.0.5845.140 Chrome

Steps to reproduce

  1. Create a React Sample app
  2. Check the sample provided here
  3. When I pass string as value prop I receive a message: Invalid prop value of type string supplied to MDEditor, expected function.

MD Editor default props: // Setting default values for the props of MDEditor MDEditor.defaultProps = { value: () => {}, };

// Typechecking props for the MDEditor MDEditor.propTypes = { value: PropTypes.func, };

I can provide access to a private repo. Let me know your git username and I'll add you to the organization!

What is expected?

SoftEditor to receive a default value

What is actually happening?

An error saying that I should convert string to function


Solution

<SoftEditor value={() => getDescription()} /> I've tried to wrap my return value into func call, The error message disappeared but the editor didn't have any text in the editor!

Additional comments