Upgrade NPM dependencies/packages: ESLint
This commit is contained in:
parent
61e653a510
commit
d8bc26a8ea
|
@ -1033,7 +1033,7 @@
|
|||
"resolved": "https://registry.npmjs.org/@atlassian/eslint-config-atlassian-fecq/-/eslint-config-atlassian-fecq-2.0.3.tgz",
|
||||
"integrity": "sha1-dloGlEPAPus735qYWNID+AF2XZ4=",
|
||||
"requires": {
|
||||
"eslint": "4.11.0",
|
||||
"eslint": "4.12.1",
|
||||
"prompt": "0.2.14",
|
||||
"strip-json-comments": "1.0.4"
|
||||
},
|
||||
|
@ -1075,9 +1075,9 @@
|
|||
"integrity": "sha1-NTL991fwUR9oj2wvoltUqM7y3xo="
|
||||
},
|
||||
"@babel/code-frame": {
|
||||
"version": "7.0.0-beta.32",
|
||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.32.tgz",
|
||||
"integrity": "sha512-EVq4T1a2GviKiQ75OfxNrGPPhJyXzg9jjORuuwhloZbFdrhT4FHa73sv9OFWBwX7rl2b6bxBVmfxrBQYWYz9tA==",
|
||||
"version": "7.0.0-beta.31",
|
||||
"resolved": "https://registry.npmjs.org/@babel/code-frame/-/code-frame-7.0.0-beta.31.tgz",
|
||||
"integrity": "sha512-yd7CkUughvHQoEahQqcMdrZw6o/6PwUxiRkfZuVDVHCDe77mysD/suoNyk5mK6phTnRW1kyIbPHyCJgxw++LXg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"chalk": "2.3.0",
|
||||
|
@ -1086,65 +1086,66 @@
|
|||
}
|
||||
},
|
||||
"@babel/helper-function-name": {
|
||||
"version": "7.0.0-beta.32",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.32.tgz",
|
||||
"integrity": "sha512-ysfIt7p72xm5fjSJsv7fMVN/j+EwIdqu8/MJjt6TqB4wM2r6rFRi0ujBTWDkLGQkRB/P5uDV8qcFCHAHnNzmsg==",
|
||||
"version": "7.0.0-beta.31",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.0.0-beta.31.tgz",
|
||||
"integrity": "sha512-c+DAyp8LMm2nzSs2uXEuxp4LYGSUYEyHtU3fU57avFChjsnTmmpWmXj2dv0yUxHTEydgVAv5fIzA+4KJwoqWDA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/helper-get-function-arity": "7.0.0-beta.32",
|
||||
"@babel/template": "7.0.0-beta.32",
|
||||
"@babel/types": "7.0.0-beta.32"
|
||||
"@babel/helper-get-function-arity": "7.0.0-beta.31",
|
||||
"@babel/template": "7.0.0-beta.31",
|
||||
"@babel/traverse": "7.0.0-beta.31",
|
||||
"@babel/types": "7.0.0-beta.31"
|
||||
}
|
||||
},
|
||||
"@babel/helper-get-function-arity": {
|
||||
"version": "7.0.0-beta.32",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.32.tgz",
|
||||
"integrity": "sha512-bm7lIlizycJQY5SJ3HXWJV4XjSrOt1onzrDcOxUo9FEnKRZDEr/zfi5ar2s5tvvZvve/jGHwZKVKekRw2cjPCQ==",
|
||||
"version": "7.0.0-beta.31",
|
||||
"resolved": "https://registry.npmjs.org/@babel/helper-get-function-arity/-/helper-get-function-arity-7.0.0-beta.31.tgz",
|
||||
"integrity": "sha512-m7rVVX/dMLbbB9NCzKYRrrFb0qZxgpmQ4Wv6y7zEsB6skoJHRuXVeb/hAFze79vXBbuD63ci7AVHXzAdZSk9KQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/types": "7.0.0-beta.32"
|
||||
"@babel/types": "7.0.0-beta.31"
|
||||
}
|
||||
},
|
||||
"@babel/template": {
|
||||
"version": "7.0.0-beta.32",
|
||||
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.0.0-beta.32.tgz",
|
||||
"integrity": "sha512-DB9sLgX2mfE29vjAkxHlzLyWr31EO9HaYoAM/UsPSsL70Eudl0i25URwIfQT6S6ckeVFnFP1t6PhERVeV4EAHA==",
|
||||
"version": "7.0.0-beta.31",
|
||||
"resolved": "https://registry.npmjs.org/@babel/template/-/template-7.0.0-beta.31.tgz",
|
||||
"integrity": "sha512-97IRmLvoDhIDSQkqklVt3UCxJsv0LUEVb/0DzXWtc8Lgiyxj567qZkmTG9aR21CmcJVVIvq2Y/moZj4oEpl5AA==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "7.0.0-beta.32",
|
||||
"@babel/types": "7.0.0-beta.32",
|
||||
"babylon": "7.0.0-beta.32",
|
||||
"@babel/code-frame": "7.0.0-beta.31",
|
||||
"@babel/types": "7.0.0-beta.31",
|
||||
"babylon": "7.0.0-beta.31",
|
||||
"lodash": "4.17.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"babylon": {
|
||||
"version": "7.0.0-beta.32",
|
||||
"resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.32.tgz",
|
||||
"integrity": "sha512-PvAmyP2IJEBVAuE5yVzrTSWCCN9VMa1eGns8w3w6FYD/ivHSUmS7n+F40Fmjn+0nCQSUFR96wP0CqQ4jxTnF4Q==",
|
||||
"version": "7.0.0-beta.31",
|
||||
"resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.31.tgz",
|
||||
"integrity": "sha512-6lm2mV3S51yEnKmQQNnswoABL1U1H1KHoCCVwdwI3hvIv+W7ya4ki7Aw4o4KxtUHjNKkK5WpZb22rrMMOcJXJQ==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"@babel/traverse": {
|
||||
"version": "7.0.0-beta.32",
|
||||
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.0.0-beta.32.tgz",
|
||||
"integrity": "sha512-dGe2CLduCIZ/iDkbmnqspQguRy5ARvI+zC8TiwFnsJ2YYO2TWK7x2aEwrbkSmi0iPlBP+Syiag7Idc1qNQq74g==",
|
||||
"version": "7.0.0-beta.31",
|
||||
"resolved": "https://registry.npmjs.org/@babel/traverse/-/traverse-7.0.0-beta.31.tgz",
|
||||
"integrity": "sha512-3N+VJW+KlezEjFBG7WSYeMyC5kIqVLPb/PGSzCDPFcJrnArluD1GIl7Y3xC7cjKiTq2/JohaLWHVPjJWHlo9Gg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "7.0.0-beta.32",
|
||||
"@babel/helper-function-name": "7.0.0-beta.32",
|
||||
"@babel/types": "7.0.0-beta.32",
|
||||
"babylon": "7.0.0-beta.32",
|
||||
"@babel/code-frame": "7.0.0-beta.31",
|
||||
"@babel/helper-function-name": "7.0.0-beta.31",
|
||||
"@babel/types": "7.0.0-beta.31",
|
||||
"babylon": "7.0.0-beta.31",
|
||||
"debug": "3.1.0",
|
||||
"globals": "10.3.0",
|
||||
"globals": "10.4.0",
|
||||
"invariant": "2.2.2",
|
||||
"lodash": "4.17.4"
|
||||
},
|
||||
"dependencies": {
|
||||
"babylon": {
|
||||
"version": "7.0.0-beta.32",
|
||||
"resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.32.tgz",
|
||||
"integrity": "sha512-PvAmyP2IJEBVAuE5yVzrTSWCCN9VMa1eGns8w3w6FYD/ivHSUmS7n+F40Fmjn+0nCQSUFR96wP0CqQ4jxTnF4Q==",
|
||||
"version": "7.0.0-beta.31",
|
||||
"resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.31.tgz",
|
||||
"integrity": "sha512-6lm2mV3S51yEnKmQQNnswoABL1U1H1KHoCCVwdwI3hvIv+W7ya4ki7Aw4o4KxtUHjNKkK5WpZb22rrMMOcJXJQ==",
|
||||
"dev": true
|
||||
},
|
||||
"debug": {
|
||||
|
@ -1157,17 +1158,17 @@
|
|||
}
|
||||
},
|
||||
"globals": {
|
||||
"version": "10.3.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-10.3.0.tgz",
|
||||
"integrity": "sha512-1g6qO5vMbiPHbRTDtR9JVjRkAhkgH4nSANYGyx1eOfqgxcMnYMMD+7MjmjfzXjwFpVUE/7/NzF+jQxYE7P4r7A==",
|
||||
"version": "10.4.0",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-10.4.0.tgz",
|
||||
"integrity": "sha512-uNUtxIZpGyuaq+5BqGGQHsL4wUlJAXRqOm6g3Y48/CWNGTLONgBibI0lh6lGxjR2HljFYUfszb+mk4WkgMntsA==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
},
|
||||
"@babel/types": {
|
||||
"version": "7.0.0-beta.32",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.0.0-beta.32.tgz",
|
||||
"integrity": "sha512-w8+wzVcYCMb9OfaBfay2Vg5hyj7UfBX6qQtA+kB0qsW1h1NH/7xHMwvTZNqkuFBwjz5wxGS2QmaIcC3HH+UoxA==",
|
||||
"version": "7.0.0-beta.31",
|
||||
"resolved": "https://registry.npmjs.org/@babel/types/-/types-7.0.0-beta.31.tgz",
|
||||
"integrity": "sha512-exAHB+NeFGxkfQ5dSUD03xl3zYGneeSk2Mw2ldTt/nTvYxuDiuSp3DlxgUBgzbdTFG4fbwPk0WtKWOoTXCmNGg==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"esutils": "2.0.2",
|
||||
|
@ -1878,21 +1879,21 @@
|
|||
}
|
||||
},
|
||||
"babel-eslint": {
|
||||
"version": "8.0.2",
|
||||
"resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-8.0.2.tgz",
|
||||
"integrity": "sha512-yyl5U088oE+419+BNLJDKVWkUokuPLQeQt9ZTy9uM9kAzbtQgyYL3JkG425B8jxXA7MwTxnDAtRLMKJNH36qjA==",
|
||||
"version": "8.0.3",
|
||||
"resolved": "https://registry.npmjs.org/babel-eslint/-/babel-eslint-8.0.3.tgz",
|
||||
"integrity": "sha512-7D4iUpylEiKJPGbeSAlNddGcmA41PadgZ6UAb6JVyh003h3d0EbZusYFBR/+nBgqtaVJM2J2zUVa3N0hrpMH6g==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"@babel/code-frame": "7.0.0-beta.32",
|
||||
"@babel/traverse": "7.0.0-beta.32",
|
||||
"@babel/types": "7.0.0-beta.32",
|
||||
"babylon": "7.0.0-beta.32"
|
||||
"@babel/code-frame": "7.0.0-beta.31",
|
||||
"@babel/traverse": "7.0.0-beta.31",
|
||||
"@babel/types": "7.0.0-beta.31",
|
||||
"babylon": "7.0.0-beta.31"
|
||||
},
|
||||
"dependencies": {
|
||||
"babylon": {
|
||||
"version": "7.0.0-beta.32",
|
||||
"resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.32.tgz",
|
||||
"integrity": "sha512-PvAmyP2IJEBVAuE5yVzrTSWCCN9VMa1eGns8w3w6FYD/ivHSUmS7n+F40Fmjn+0nCQSUFR96wP0CqQ4jxTnF4Q==",
|
||||
"version": "7.0.0-beta.31",
|
||||
"resolved": "https://registry.npmjs.org/babylon/-/babylon-7.0.0-beta.31.tgz",
|
||||
"integrity": "sha512-6lm2mV3S51yEnKmQQNnswoABL1U1H1KHoCCVwdwI3hvIv+W7ya4ki7Aw4o4KxtUHjNKkK5WpZb22rrMMOcJXJQ==",
|
||||
"dev": true
|
||||
}
|
||||
}
|
||||
|
@ -5293,12 +5294,11 @@
|
|||
}
|
||||
},
|
||||
"doctrine": {
|
||||
"version": "2.0.0",
|
||||
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.0.tgz",
|
||||
"integrity": "sha1-xz2NKQnSIpHhoAejlYBNqLZl/mM=",
|
||||
"version": "2.0.2",
|
||||
"resolved": "https://registry.npmjs.org/doctrine/-/doctrine-2.0.2.tgz",
|
||||
"integrity": "sha512-y0tm5Pq6ywp3qSTZ1vPgVdAnbDEoeoc5wlOHXoY1c4Wug/a7JvqHIl7BTvwodaHmejWkK/9dSb3sCYfyo/om8A==",
|
||||
"requires": {
|
||||
"esutils": "2.0.2",
|
||||
"isarray": "1.0.0"
|
||||
"esutils": "2.0.2"
|
||||
}
|
||||
},
|
||||
"dom-helpers": {
|
||||
|
@ -5804,9 +5804,9 @@
|
|||
}
|
||||
},
|
||||
"eslint": {
|
||||
"version": "4.11.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-4.11.0.tgz",
|
||||
"integrity": "sha512-UWbhQpaKlm8h5x/VLwm0S1kheMrDj8jPwhnBMjr/Dlo3qqT7MvcN/UfKAR3E1N4lr4YNtOvS4m3hwsrVc/ky7g==",
|
||||
"version": "4.12.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint/-/eslint-4.12.1.tgz",
|
||||
"integrity": "sha512-28hOYej+NZ/R5H1yMvyKa1+bPlu+fnsIAQffK6hxXgvmXnImos2bA5XfCn5dYv2k2mrKj+/U/Z4L5ICWxC7TQw==",
|
||||
"requires": {
|
||||
"ajv": "5.3.0",
|
||||
"babel-code-frame": "6.26.0",
|
||||
|
@ -5814,7 +5814,7 @@
|
|||
"concat-stream": "1.6.0",
|
||||
"cross-spawn": "5.1.0",
|
||||
"debug": "3.1.0",
|
||||
"doctrine": "2.0.0",
|
||||
"doctrine": "2.0.2",
|
||||
"eslint-scope": "3.7.1",
|
||||
"espree": "3.5.2",
|
||||
"esquery": "1.0.0",
|
||||
|
@ -5823,7 +5823,7 @@
|
|||
"file-entry-cache": "2.0.0",
|
||||
"functional-red-black-tree": "1.0.1",
|
||||
"glob": "7.1.2",
|
||||
"globals": "9.18.0",
|
||||
"globals": "11.0.1",
|
||||
"ignore": "3.3.7",
|
||||
"imurmurhash": "0.1.4",
|
||||
"inquirer": "3.3.0",
|
||||
|
@ -5877,6 +5877,11 @@
|
|||
"path-is-absolute": "1.0.1"
|
||||
}
|
||||
},
|
||||
"globals": {
|
||||
"version": "11.0.1",
|
||||
"resolved": "https://registry.npmjs.org/globals/-/globals-11.0.1.tgz",
|
||||
"integrity": "sha1-Eqh7sBDlFUOWrMU14eQ/x1Ow5eg="
|
||||
},
|
||||
"minimatch": {
|
||||
"version": "3.0.4",
|
||||
"resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.4.tgz",
|
||||
|
@ -6062,21 +6067,21 @@
|
|||
}
|
||||
},
|
||||
"eslint-plugin-react": {
|
||||
"version": "7.4.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.4.0.tgz",
|
||||
"integrity": "sha512-tvjU9u3VqmW2vVuYnE8Qptq+6ji4JltjOjJ9u7VAOxVYkUkyBZWRvNYKbDv5fN+L6wiA+4we9+qQahZ0m63XEA==",
|
||||
"version": "7.5.1",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react/-/eslint-plugin-react-7.5.1.tgz",
|
||||
"integrity": "sha512-YGSjB9Qu6QbVTroUZi66pYky3DfoIPLdHQ/wmrBGyBRnwxQsBXAov9j2rpXt/55i8nyMv6IRWJv2s4d4YnduzQ==",
|
||||
"dev": true,
|
||||
"requires": {
|
||||
"doctrine": "2.0.0",
|
||||
"doctrine": "2.0.2",
|
||||
"has": "1.0.1",
|
||||
"jsx-ast-utils": "2.0.1",
|
||||
"prop-types": "15.6.0"
|
||||
}
|
||||
},
|
||||
"eslint-plugin-react-native": {
|
||||
"version": "3.1.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react-native/-/eslint-plugin-react-native-3.1.0.tgz",
|
||||
"integrity": "sha1-A/lflZv/eoJntUcsuH0BDjRvciQ=",
|
||||
"version": "3.2.0",
|
||||
"resolved": "https://registry.npmjs.org/eslint-plugin-react-native/-/eslint-plugin-react-native-3.2.0.tgz",
|
||||
"integrity": "sha512-b/VrvsLM17FCul+RTXi4owZaP/u3Xo0IWv2ZTxgGGAyaNKscGbTvvoV/MxhYxRSuDmG7uAM9l7DN6wTGyC2U+Q==",
|
||||
"dev": true
|
||||
},
|
||||
"eslint-scope": {
|
||||
|
@ -11107,7 +11112,7 @@
|
|||
}
|
||||
},
|
||||
"lib-jitsi-meet": {
|
||||
"version": "github:jitsi/lib-jitsi-meet#067b8c3867d7e47a1f3fd8fccf702ffb3076c4a8",
|
||||
"version": "github:jitsi/lib-jitsi-meet#b4adec279669a08213adb543ef46a11e0d840b92",
|
||||
"requires": {
|
||||
"async": "0.9.0",
|
||||
"current-executing-script": "0.1.3",
|
||||
|
|
10
package.json
10
package.json
|
@ -46,7 +46,7 @@
|
|||
"js-md5": "0.6.1",
|
||||
"jssha": "2.2.0",
|
||||
"jwt-decode": "2.2.0",
|
||||
"lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#067b8c3867d7e47a1f3fd8fccf702ffb3076c4a8",
|
||||
"lib-jitsi-meet": "github:jitsi/lib-jitsi-meet#b4adec279669a08213adb543ef46a11e0d840b92",
|
||||
"lodash": "4.17.4",
|
||||
"nuclear-js": "1.4.0",
|
||||
"postis": "2.2.0",
|
||||
|
@ -75,7 +75,7 @@
|
|||
},
|
||||
"devDependencies": {
|
||||
"babel-core": "6.26.0",
|
||||
"babel-eslint": "8.0.2",
|
||||
"babel-eslint": "8.0.3",
|
||||
"babel-loader": "7.1.2",
|
||||
"babel-polyfill": "6.26.0",
|
||||
"babel-preset-env": "1.6.1",
|
||||
|
@ -83,13 +83,13 @@
|
|||
"babel-preset-stage-1": "6.24.1",
|
||||
"clean-css": "3.4.25",
|
||||
"css-loader": "0.28.7",
|
||||
"eslint": "4.11.0",
|
||||
"eslint": "4.12.1",
|
||||
"eslint-config-jitsi": "github:jitsi/eslint-config-jitsi#v0.1",
|
||||
"eslint-plugin-flowtype": "2.39.1",
|
||||
"eslint-plugin-import": "2.8.0",
|
||||
"eslint-plugin-jsdoc": "3.2.0",
|
||||
"eslint-plugin-react": "7.4.0",
|
||||
"eslint-plugin-react-native": "3.1.0",
|
||||
"eslint-plugin-react": "7.5.1",
|
||||
"eslint-plugin-react-native": "3.2.0",
|
||||
"expose-loader": "0.7.4",
|
||||
"file-loader": "1.1.5",
|
||||
"flow-bin": "0.53.0",
|
||||
|
|
|
@ -21,10 +21,6 @@ import { simpleBottomSheet as styles } from './styles';
|
|||
*/
|
||||
const BUTTON_UNDERLAY_COLOR = '#eee';
|
||||
|
||||
/**
|
||||
* {@code SimpleBottomSheet}'s React {@code Component} prop types.
|
||||
*/
|
||||
|
||||
type Option = {
|
||||
|
||||
/**
|
||||
|
@ -44,6 +40,10 @@ type Option = {
|
|||
text: string
|
||||
};
|
||||
|
||||
|
||||
/**
|
||||
* The type of {@code SimpleBottomSheet}'s React {@code Component} prop types.
|
||||
*/
|
||||
type Props = {
|
||||
|
||||
/**
|
||||
|
@ -125,7 +125,9 @@ class SimpleBottomSheet extends Component<Props> {
|
|||
* @returns {void}
|
||||
*/
|
||||
_onButtonPress(option) {
|
||||
this.props.onSubmit && this.props.onSubmit(option);
|
||||
const { onSubmit } = this.props;
|
||||
|
||||
onSubmit && onSubmit(option);
|
||||
}
|
||||
|
||||
_onCancel: () => void;
|
||||
|
@ -137,7 +139,9 @@ class SimpleBottomSheet extends Component<Props> {
|
|||
* @returns {void}
|
||||
*/
|
||||
_onCancel() {
|
||||
this.props.onCancel && this.props.onCancel();
|
||||
const { onCancel } = this.props;
|
||||
|
||||
onCancel && onCancel();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -160,14 +164,30 @@ class SimpleBottomSheet extends Component<Props> {
|
|||
* @returns {ReactElement} - A row element with an icon and text.
|
||||
*/
|
||||
_renderRow(option, index) {
|
||||
const onPress = this._onButtonPress.bind(this, option);
|
||||
const { iconName, selected, text } = option;
|
||||
const selectedStyle = selected ? styles.rowSelectedText : {};
|
||||
|
||||
return (
|
||||
<TouchableHighlight
|
||||
key = { index }
|
||||
onPress = { onPress }
|
||||
|
||||
// TODO The following disables an eslint error alerting about a
|
||||
// known potential/theoretical performance pernalty:
|
||||
//
|
||||
// A bind call or arrow function in a JSX prop will create a
|
||||
// brand new function on every single render. This is bad for
|
||||
// performance, as it will result in the garbage collector being
|
||||
// invoked way more than is necessary. It may also cause
|
||||
// unnecessary re-renders if a brand new function is passed as a
|
||||
// prop to a component that uses reference equality check on the
|
||||
// prop to determine if it should update.
|
||||
//
|
||||
// I'm not addressing the potential/theoretical performance
|
||||
// penalty at the time of this writing because it doesn't seem
|
||||
// to me that it's a practical performance penalty in the case.
|
||||
//
|
||||
// eslint-disable-next-line react/jsx-no-bind
|
||||
onPress = { this._onButtonPress.bind(this, option) }
|
||||
underlayColor = { BUTTON_UNDERLAY_COLOR } >
|
||||
<View style = { styles.row } >
|
||||
<Icon
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
/* @flow */
|
||||
// @flow
|
||||
|
||||
import PropTypes from 'prop-types';
|
||||
import React, { Component } from 'react';
|
||||
|
@ -18,10 +18,6 @@ import ToolbarButton from './ToolbarButton';
|
|||
* @extends Component
|
||||
*/
|
||||
class Toolbar extends Component<*> {
|
||||
_onMouseOut: Function;
|
||||
_onMouseOver: Function;
|
||||
_renderToolbarButton: Function;
|
||||
|
||||
/**
|
||||
* Base toolbar component's property types.
|
||||
*
|
||||
|
@ -86,7 +82,7 @@ class Toolbar extends Component<*> {
|
|||
<StatelessToolbar { ...props }>
|
||||
{
|
||||
[ ...this.props.toolbarButtons.entries() ]
|
||||
.map(this._renderToolbarButton)
|
||||
.map(this._renderToolbarButton)
|
||||
}
|
||||
{
|
||||
this.props.children
|
||||
|
@ -95,26 +91,32 @@ class Toolbar extends Component<*> {
|
|||
);
|
||||
}
|
||||
|
||||
_onMouseOut: () => void;
|
||||
|
||||
/**
|
||||
* Dispatches an action signalling that toolbar is no being hovered.
|
||||
*
|
||||
* @protected
|
||||
* @returns {Object} Dispatched action.
|
||||
* @returns {void}
|
||||
*/
|
||||
_onMouseOut() {
|
||||
this.props.dispatch(setToolbarHovered(false));
|
||||
}
|
||||
|
||||
_onMouseOver: () => void;
|
||||
|
||||
/**
|
||||
* Dispatches an action signalling that toolbar is now being hovered.
|
||||
*
|
||||
* @protected
|
||||
* @returns {Object} Dispatched action.
|
||||
* @returns {void}
|
||||
*/
|
||||
_onMouseOver() {
|
||||
this.props.dispatch(setToolbarHovered(true));
|
||||
}
|
||||
|
||||
_renderToolbarButton: (Array<*>) => React$Element<*>;
|
||||
|
||||
/**
|
||||
* Renders toolbar button. Method is passed to map function.
|
||||
*
|
||||
|
@ -123,20 +125,18 @@ class Toolbar extends Component<*> {
|
|||
* @private
|
||||
* @returns {ReactElement} A toolbar button.
|
||||
*/
|
||||
_renderToolbarButton(keyValuePair: Array<*>): React$Element<*> {
|
||||
const [ key, button ] = keyValuePair;
|
||||
_renderToolbarButton([ key, button ]): React$Element<*> {
|
||||
const { tooltipPosition } = this.props;
|
||||
|
||||
if (button.component) {
|
||||
|
||||
return (
|
||||
<button.component
|
||||
key = { key }
|
||||
toggled = { button.toggled }
|
||||
tooltipPosition = { this.props.tooltipPosition } />
|
||||
tooltipPosition = { tooltipPosition } />
|
||||
);
|
||||
}
|
||||
|
||||
const { tooltipPosition } = this.props;
|
||||
const {
|
||||
childComponent: ChildComponent,
|
||||
onClick,
|
||||
|
@ -150,6 +150,23 @@ class Toolbar extends Component<*> {
|
|||
<ToolbarButton
|
||||
button = { button }
|
||||
key = { key }
|
||||
|
||||
// TODO The following disables an eslint error alerting about a
|
||||
// known potential/theoretical performance pernalty:
|
||||
//
|
||||
// A bind call or arrow function in a JSX prop will create a
|
||||
// brand new function on every single render. This is bad for
|
||||
// performance, as it will result in the garbage collector being
|
||||
// invoked way more than is necessary. It may also cause
|
||||
// unnecessary re-renders if a brand new function is passed as a
|
||||
// prop to a component that uses reference equality check on the
|
||||
// prop to determine if it should update.
|
||||
//
|
||||
// I'm not addressing the potential/theoretical performance
|
||||
// penalty at the time of this writing because I don't know for
|
||||
// a fact that it's a practical performance penalty in the case.
|
||||
//
|
||||
// eslint-disable-next-line react/jsx-no-bind
|
||||
onClick = { onClickWithDispatch }
|
||||
onMount = { onMount }
|
||||
onUnmount = { onUnmount }
|
||||
|
|
Loading…
Reference in New Issue