Skip to content

Commit

Permalink
Merge pull request #30160 from software-mansion-labs/ts-migration/get…
Browse files Browse the repository at this point in the history
…-permitted-decimal-separator

[TS migration] Migrate 'getPermittedDecimalSeparator' lib to TypeScript
  • Loading branch information
AndrewGable authored Nov 7, 2023
2 parents 76a5ace + 3640c82 commit 4a220bd
Show file tree
Hide file tree
Showing 5 changed files with 24 additions and 14 deletions.
3 changes: 0 additions & 3 deletions src/libs/getPermittedDecimalSeparator/index.ios.js

This file was deleted.

7 changes: 7 additions & 0 deletions src/libs/getPermittedDecimalSeparator/index.ios.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
// On iOS keyboard can only have one symbol at a time (either dot or comma) so we accept both
// Details: https://expensify.slack.com/archives/C01GTK53T8Q/p1658936908481629
import GetPermittedDecimalSeparator from './types';

const getPermittedDecimalSeparator: GetPermittedDecimalSeparator = () => '.,';

export default getPermittedDecimalSeparator;
11 changes: 0 additions & 11 deletions src/libs/getPermittedDecimalSeparator/index.js

This file was deleted.

14 changes: 14 additions & 0 deletions src/libs/getPermittedDecimalSeparator/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import getOperatingSystem from '@libs/getOperatingSystem';
import CONST from '@src/CONST';
import getPermittedDecimalSeparatorIOS from './index.ios';
import GetPermittedDecimalSeparator from './types';

const getPermittedDecimalSeparator: GetPermittedDecimalSeparator = (localizedSeparator) => {
if (getOperatingSystem() === CONST.OS.IOS) {
return getPermittedDecimalSeparatorIOS(localizedSeparator);
}

return localizedSeparator;
};

export default getPermittedDecimalSeparator;
3 changes: 3 additions & 0 deletions src/libs/getPermittedDecimalSeparator/types.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
type GetPermittedDecimalSeparator = (localizedSeparator: string) => string;

export default GetPermittedDecimalSeparator;

0 comments on commit 4a220bd

Please sign in to comment.