mirror of
https://github.com/terribleplan/next.js.git
synced 2024-01-19 02:48:18 +00:00
examples/with-react-md: Fixed "Cannot read property 'focus' of undefined" (#961)
This commit is contained in:
parent
3e34430f74
commit
fca0a39cbc
|
@ -1,6 +1,8 @@
|
||||||
import Head from 'next/head'
|
import Head from 'next/head'
|
||||||
import Link from 'next/link'
|
import Link from 'next/link'
|
||||||
|
|
||||||
|
import { PureComponent } from 'react'
|
||||||
|
|
||||||
import Avatar from 'react-md/lib/Avatars'
|
import Avatar from 'react-md/lib/Avatars'
|
||||||
import Button from 'react-md/lib/Buttons/Button'
|
import Button from 'react-md/lib/Buttons/Button'
|
||||||
import FontIcon from 'react-md/lib/FontIcons'
|
import FontIcon from 'react-md/lib/FontIcons'
|
||||||
|
@ -28,17 +30,23 @@ const drawerHeaderChildren = [
|
||||||
/>
|
/>
|
||||||
]
|
]
|
||||||
|
|
||||||
const NavigationLink = (props) => {
|
class NavigationLink extends PureComponent {
|
||||||
const { href, as, children, ..._props } = props
|
// NOTE: Don't try using Stateless (function) component here. `ref` is
|
||||||
return (
|
// required by React-MD/AccessibleFakeButton, but Stateless components
|
||||||
<div {..._props}>
|
// don't have one by design:
|
||||||
<Link href={href} as={as}>
|
// https://github.com/facebook/react/issues/4936
|
||||||
<a className='md-list-tile' style={{padding: 0, overflow: 'hidden'}}>
|
render () {
|
||||||
{children}
|
const { href, as, children, ..._props } = this.props
|
||||||
</a>
|
return (
|
||||||
</Link>
|
<div {..._props} style={{padding: 0}}>
|
||||||
</div>
|
<Link href={href} as={as}>
|
||||||
)
|
<a className='md-list-tile md-list-tile--mini' style={{width: '100%', overflow: 'hidden'}}>
|
||||||
|
{children}
|
||||||
|
</a>
|
||||||
|
</Link>
|
||||||
|
</div>
|
||||||
|
)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
export default () => {
|
export default () => {
|
||||||
|
|
Loading…
Reference in a new issue