lumada-design / hv-uikit-react

UI library for the Next Design System.
https://lumada-design.github.io/uikit/master
Apache License 2.0
39 stars 21 forks source link

Evaluate if we should move to Material UI 4.x version #254

Closed diogofscmariano closed 4 years ago

diogofscmariano commented 5 years ago

Description:

Material released their 4.x version and since we will be reviewing all our components we should evaluate if we should move from 3.x to 4.x version.

Important notes:

Estimation: 2 days

Expected outcome:

eliofreitas commented 5 years ago

Positive points

Features

Performance

Future React compatibility

Misc

Negative points/impacts

Child needs to be able to hold a ref

This is the most delicate point because we might not be able to control the childrens that were added by users

Some of the components need access to the DOM node. This was previously possible by using ReactDOM.findDOMNode. This function is deprecated in favor of ref and ref forwarding. However, only the following component types can be given a ref:

if we have this problem we will see a warning like this: Function components cannot be given refs. Attempts to access this ref will fail. Did you mean to use React.forwardRef()? Invalid prop component supplied to ComponentName. Expected an element type that can hold a ref. the solution is:

const MyButton = props => <div role="button" {...props} />; 
const MyButton = React.forwardRef((props, ref) => <div role="button" {...props} ref={ref} />); 

<Button component={MyButton} />;
diogofscmariano commented 5 years ago

It was identified that we are having issues with material ui 4 running in storybook, due to multiple instances of the the style package. In this spike we identified that we should do the move, but we need to understand how to fix this. A following spike will be opened.

eliofreitas commented 4 years ago

To be able to move from material 3 to material 4 what we need to do apart from following the migration guide is converting all material related dependencies into a peer dependencies to be installed by whomever is using the ui-kit packages