Skip to content

Commit

Permalink
Include scrollbar width in total picker width
Browse files Browse the repository at this point in the history
  • Loading branch information
sonicdoe committed Jun 23, 2017
1 parent 522b74f commit 385408b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
1 change: 1 addition & 0 deletions example/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ module.exports = {
loader: 'babel-loader',
include: [
path.resolve('src'),
path.resolve('node_modules/measure-scrollbar'),
path.resolve('data'),
path.resolve('example'),
],
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@
"url": "https://github.com/missive/emoji-mart/issues"
},
"homepage": "https://github.com/missive/emoji-mart",
"dependencies": {},
"dependencies": {
"measure-scrollbar": "^0.1.0"
},
"peerDependencies": {
"react": "^0.14.0 || ^15.0.0-0"
},
Expand Down
3 changes: 2 additions & 1 deletion src/components/picker.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import '../vendor/raf-polyfill'

import React from 'react'
import PropTypes from 'prop-types'
import measureScrollbar from 'measure-scrollbar'
import data from '../../data'

import store from '../utils/store'
Expand Down Expand Up @@ -328,7 +329,7 @@ export default class Picker extends React.Component {
render() {
var { perLine, emojiSize, set, sheetSize, style, title, emoji, color, native, backgroundImageFn, emojisToShowFilter, include, exclude, autoFocus } = this.props,
{ skin } = this.state,
width = (perLine * (emojiSize + 12)) + 12 + 2
width = (perLine * (emojiSize + 12)) + 12 + 2 + measureScrollbar()

return <div style={{width: width, ...style}} className='emoji-mart'>
<div className='emoji-mart-bar'>
Expand Down
1 change: 1 addition & 0 deletions src/webpack.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ module.exports = {
loader: 'babel-loader',
include: [
path.resolve('src'),
path.resolve('node_modules/measure-scrollbar'),
path.resolve('data'),
],
},
Expand Down
4 changes: 4 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -1712,6 +1712,10 @@ lru-cache@2.2.x:
version "2.2.4"
resolved "https://registry.yarnpkg.com/lru-cache/-/lru-cache-2.2.4.tgz#6c658619becf14031d0d0b594b16042ce4dc063d"

measure-scrollbar@^0.1.0:
version "0.1.0"
resolved "https://registry.yarnpkg.com/measure-scrollbar/-/measure-scrollbar-0.1.0.tgz#2bbfac6773bcbb98d814e6890554c0b92846fe6f"

media-typer@0.3.0:
version "0.3.0"
resolved "https://registry.yarnpkg.com/media-typer/-/media-typer-0.3.0.tgz#8710d7af0aa626f8fffa1ce00168545263255748"
Expand Down

0 comments on commit 385408b

Please sign in to comment.