-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(android): slow autoscroll with fabric
Fix autoscroll not scrolling enough on Android with Fabric enabled. Make autoscroll speed more consistent with iOS.
- Loading branch information
Showing
4 changed files
with
41 additions
and
19 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 was deleted.
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,3 +1,31 @@ | ||
// Default constants | ||
export const AUTOSCROLL_INCREMENT = 5; | ||
export const AUTOSCROLL_DELAY = 0; | ||
import {Platform} from 'react-native'; | ||
|
||
const IOS_CONFIG = { | ||
delay: 80, | ||
increment: 100, | ||
}; | ||
|
||
const ANDROID_FABRIC_CONFIG = { | ||
delay: 50, | ||
increment: 80, | ||
}; | ||
|
||
const ANDROID_PAPER_CONFIG = { | ||
delay: 10, | ||
increment: 4, | ||
}; | ||
|
||
export const IS_FABRIC = | ||
global && typeof global === 'object' && 'nativeFabricUIManager' in global; | ||
|
||
export const AUTOSCROLL_CONFIG = Platform.select({ | ||
// autoscroll behaves differently with Fabric and Paper on Android | ||
android: IS_FABRIC ? ANDROID_FABRIC_CONFIG : ANDROID_PAPER_CONFIG, | ||
ios: IOS_CONFIG, | ||
|
||
// unsupported platforms | ||
web: IOS_CONFIG, | ||
macos: IOS_CONFIG, | ||
windows: IOS_CONFIG, | ||
native: IOS_CONFIG, | ||
}); |
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