-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Use debounce only on android, apply on share.
- Loading branch information
1 parent
e951e75
commit 55b6aad
Showing
4 changed files
with
25 additions
and
6 deletions.
There are no files selected for viewing
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
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
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
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,12 @@ | ||
import { debounce } from "lodash"; | ||
import { Platform } from "react-native"; | ||
|
||
/** | ||
* Debounces the function only on Android. | ||
* @param func The function to debounce | ||
* @param wait The wait time if debouncing. | ||
*/ | ||
export const debounceOnAndroid = <T extends (...args: any) => any>(func: T, wait: number = 1000) => { | ||
if (Platform.OS === "ios") return func; | ||
else return debounce(func, wait, { leading: false, trailing: false }); | ||
}; |