From 16bbf8070ac63765af0321caef4adb532e9414bd Mon Sep 17 00:00:00 2001 From: Chung Leong Date: Mon, 28 Jan 2019 22:46:54 +0100 Subject: [PATCH] Fixed text selection. Made Breadcrumb a PureComponent. --- src/front-end.jsx | 2 +- src/widgets/breadcrumb.jsx | 24 ++++++++++++++---------- 2 files changed, 15 insertions(+), 11 deletions(-) diff --git a/src/front-end.jsx b/src/front-end.jsx index 84f6e7d..adc3d28 100644 --- a/src/front-end.jsx +++ b/src/front-end.jsx @@ -62,7 +62,7 @@ class FrontEnd extends PureComponent { if (typeof(window) === 'object') { let Hammer = require('hammerjs'); - let hammer = new Hammer(document.body); + let hammer = new Hammer(document.body, { cssProps: { userSelect: 'auto' } }); hammer.on('swipeleft', this.handleSwipeLeft); hammer.on('swiperight', this.handleSwipeRight); } diff --git a/src/widgets/breadcrumb.jsx b/src/widgets/breadcrumb.jsx index eff48f6..cce092b 100644 --- a/src/widgets/breadcrumb.jsx +++ b/src/widgets/breadcrumb.jsx @@ -1,15 +1,19 @@ -import React from 'react'; +import React, { PureComponent } from 'react'; -function Breadcrumb(props) { - let { trail } = props; - let children = [] - let key = 0; - for (let item of trail) { - children.push({item.label}); - children.push(' > '); +class Breadcrumb extends PureComponent { + static displayName = 'Breadcrumb'; + + render() { + let { trail } = this.props; + let children = [] + let key = 0; + for (let item of trail) { + children.push({item.label}); + children.push(' > '); + } + children.pop(); + return

{children}

; } - children.pop(); - return

{children}

; } if (process.env.NODE_ENV !== 'production') {