Fix pull to refresh refresh component clipping on Android

Summary: Currently the pull to refresh icon on browse feed is super cut off on Android. Expose the progressViewOffset prop from FBPullToRefresh to support offsetting the PTR component to make the component more visible.

Reviewed By: yungsters

Differential Revision: D10274679

fbshipit-source-id: 1735c4d2d98523ccc3d1ec3733465028ae33df7b
This commit is contained in:
Andy Huang 2018-10-15 12:38:42 -07:00 committed by Facebook Github Bot
parent b0d68c0bb9
commit 8a3a0ad2d0
1 changed files with 4 additions and 4 deletions

View File

@ -30,7 +30,7 @@ if (Platform.OS === 'android') {
} else { } else {
var RefreshLayoutConsts = {SIZE: {}}; var RefreshLayoutConsts = {SIZE: {}};
} }
type NativeRefreshControlType = Class<NativeComponent<Props>>; type NativeRefreshControlType = Class<NativeComponent<RefreshControlProps>>;
const NativeRefreshControl: NativeRefreshControlType = const NativeRefreshControl: NativeRefreshControlType =
Platform.OS === 'ios' Platform.OS === 'ios'
@ -78,7 +78,7 @@ type AndroidProps = $ReadOnly<{|
progressViewOffset?: ?number, progressViewOffset?: ?number,
|}>; |}>;
type Props = $ReadOnly<{| export type RefreshControlProps = $ReadOnly<{|
...ViewProps, ...ViewProps,
...IOSProps, ...IOSProps,
...AndroidProps, ...AndroidProps,
@ -139,7 +139,7 @@ type Props = $ReadOnly<{|
* __Note:__ `refreshing` is a controlled prop, this is why it needs to be set to true * __Note:__ `refreshing` is a controlled prop, this is why it needs to be set to true
* in the `onRefresh` function otherwise the refresh indicator will stop immediately. * in the `onRefresh` function otherwise the refresh indicator will stop immediately.
*/ */
class RefreshControl extends React.Component<Props> { class RefreshControl extends React.Component<RefreshControlProps> {
static SIZE = RefreshLayoutConsts.SIZE; static SIZE = RefreshLayoutConsts.SIZE;
_nativeRef: ?React.ElementRef<NativeRefreshControlType> = null; _nativeRef: ?React.ElementRef<NativeRefreshControlType> = null;
@ -149,7 +149,7 @@ class RefreshControl extends React.Component<Props> {
this._lastNativeRefreshing = this.props.refreshing; this._lastNativeRefreshing = this.props.refreshing;
} }
componentDidUpdate(prevProps: Props) { componentDidUpdate(prevProps: RefreshControlProps) {
// RefreshControl is a controlled component so if the native refreshing // RefreshControl is a controlled component so if the native refreshing
// value doesn't match the current js refreshing prop update it to // value doesn't match the current js refreshing prop update it to
// the js value. // the js value.