-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
bf73f5c
commit 1fb5be3
Showing
4 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,22 @@ | ||
import CONST from '../../../CONST'; | ||
import getBrowser from '../../../libs/getBrowser'; | ||
import styles from '../../../styles/styles'; | ||
|
||
const pickerStyles = disabled => styles.expensiPicker(disabled); | ||
const pickerStylesWeb = () => { | ||
if ([CONST.BROWSER.FIREFOX].includes(getBrowser())) { | ||
return { | ||
textIndent: -2, | ||
}; | ||
} | ||
return {}; | ||
}; | ||
|
||
const pickerStyles = disabled => ({ | ||
...styles.expensiPicker(disabled), | ||
inputWeb: { | ||
...styles.expensiPicker(disabled).inputWeb, | ||
...pickerStylesWeb(), | ||
}, | ||
}); | ||
|
||
export default pickerStyles; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export default () => ''; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
import CONST from '../../CONST'; | ||
|
||
/** | ||
* fetch Browser Name and version from UA string | ||
* | ||
* @return {String} e.g. Chrome 80 | ||
*/ | ||
function getBrowserVersion() { | ||
const {userAgent} = window.navigator; | ||
let match = userAgent.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []; | ||
let temp; | ||
|
||
if (/trident/i.test(match[1])) { | ||
temp = /\brv[ :]+(\d+)/g.exec(userAgent) || []; | ||
|
||
return `IE ${temp[1] || ''}`; | ||
} | ||
|
||
if (match[1] === 'Chrome') { | ||
temp = userAgent.match(/\b(OPR|Edge)\/(\d+)/); | ||
|
||
if (temp !== null) { | ||
return temp.slice(1).join(' ').replace('OPR', 'Opera'); | ||
} | ||
|
||
temp = userAgent.match(/\b(Edg)\/(\d+)/); | ||
|
||
if (temp !== null) { | ||
return temp.slice(1).join(' ').replace('Edg', 'Edge'); | ||
} | ||
} | ||
|
||
match = match[2] ? [match[1], match[2]] : [navigator.appName, navigator.appVersion, '-?']; | ||
temp = userAgent.match(/version\/(\d+)/i); | ||
|
||
if (temp !== null) { | ||
match.splice(1, 1, temp[1]); | ||
} | ||
|
||
return match.join(' '); | ||
} | ||
|
||
/** | ||
* Get the Browser name | ||
* @returns {String} | ||
*/ | ||
export default () => { | ||
const browserAndVersion = getBrowserVersion(); | ||
const [browser] = browserAndVersion.split(' '); | ||
return browser ? browser.toLowerCase() : CONST.BROWSER.OTHER; | ||
}; |