Skip to content

Conversation

@joshwooding
Copy link
Collaborator

@joshwooding joshwooding added the type: new feature Expand the scope of the product to solve a new problem. label Apr 4, 2019
@mui-pr-bot
Copy link

mui-pr-bot commented Apr 4, 2019

@material-ui/core: parsed: -0.14% 😍, gzip: -0.10% 😍

Details of bundle changes.

Comparing: 496b0ff...148ea35

bundle parsed diff gzip diff prev parsed current parsed prev gzip current gzip
@material-ui/core -0.14% -0.10% 349,674 349,168 90,015 89,925
@material-ui/core/Paper 0.00% -0.03% 68,366 68,366 20,042 20,035
@material-ui/core/Paper.esm 0.00% +0.01% 🔺 60,732 60,732 18,787 18,788
@material-ui/core/Popper 0.00% -0.01% 34,825 34,825 11,883 11,882
@material-ui/core/styles/createMuiTheme 0.00% 0.00% 17,877 17,877 5,961 5,961
@material-ui/core/useMediaQuery 0.00% -0.19% 2,469 2,469 1,042 1,040
@material-ui/lab 0.00% 0.00% 147,879 147,879 43,786 43,786
@material-ui/styles 0.00% +0.01% 🔺 53,105 53,105 15,424 15,425
@material-ui/system 0.00% +0.02% 🔺 17,136 17,136 4,525 4,526
Button 0.00% -0.00% 88,467 88,467 26,284 26,283
Modal 0.00% -0.00% 82,583 82,583 24,780 24,779
colorManipulator 0.00% 0.00% 3,745 3,745 1,538 1,538
docs.landing 0.00% 0.00% 49,914 49,914 10,815 10,815
docs.main 0.00% 0.00% 645,771 645,771 200,653 200,653
packages/material-ui/build/umd/material-ui.production.min.js -0.15% -0.07% 298,116 297,681 82,865 82,806

Generated by 🚫 dangerJS against 148ea35

@joshwooding joshwooding marked this pull request as ready for review April 5, 2019 21:16

const [focused, setFocused] = React.useState(false);

if (disabled && focused) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow, at first I was like: wtf is this. But then, looking twice at the logic, it looks valid 👌.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the function component version of

static getDerivedStateFromProps(props, state) {
  if (props.disabled && state.focused) {
    return { focused: false };
  }
  return null;
}

Hooks FAQ: How do I implement getDerivedStateFromProps?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the link.

@oliviertassinari oliviertassinari added the scope: text field Changes related to the text field. label Apr 6, 2019
@joshwooding joshwooding mentioned this pull request Apr 6, 2019
29 tasks
@oliviertassinari oliviertassinari merged commit 370e89e into mui:next Apr 7, 2019
@joshwooding joshwooding deleted the formcontrol-function-component branch April 7, 2019 12:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

scope: text field Changes related to the text field. type: new feature Expand the scope of the product to solve a new problem.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants