diff --git a/docs/refreshcontrol.md b/docs/refreshcontrol.md index 681099bdf9d..10f27095d48 100644 --- a/docs/refreshcontrol.md +++ b/docs/refreshcontrol.md @@ -9,19 +9,10 @@ This component is used inside a ScrollView or ListView to add pull to refresh fu ```SnackPlayer name=RefreshControl&supportedPlatforms=ios,android import React from 'react'; -import { - ScrollView, - RefreshControl, - StyleSheet, - Text, - SafeAreaView, -} from 'react-native'; -import Constants from 'expo-constants'; +import { RefreshControl, SafeAreaView, ScrollView, StyleSheet, Text } from 'react-native'; const wait = (timeout) => { - return new Promise(resolve => { - setTimeout(resolve, timeout); - }); + return new Promise(resolve => setTimeout(resolve, timeout)); } const App = () => { @@ -29,7 +20,6 @@ const App = () => { const onRefresh = React.useCallback(() => { setRefreshing(true); - wait(2000).then(() => setRefreshing(false)); }, []); @@ -38,7 +28,10 @@ const App = () => { + } > Pull down to see RefreshControl indicator @@ -50,7 +43,6 @@ const App = () => { const styles = StyleSheet.create({ container: { flex: 1, - marginTop: Constants.statusBarHeight, }, scrollView: { flex: 1, @@ -63,7 +55,7 @@ const styles = StyleSheet.create({ export default App; ``` -**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. +> 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. --- @@ -73,100 +65,119 @@ export default App; Inherits [View Props](view.md#props). -### `refreshing` +--- + +###
Required
**`refreshing`** Whether the view should be indicating an active refresh. -| Type | Required | -| ---- | -------- | -| bool | Yes | +| Type | +| ------- | +| boolean | --- -### `onRefresh` +### `colors`
Android
-Called when the view starts refreshing. +The colors (at least one) that will be used to draw the refresh indicator. -| Type | Required | -| -------- | -------- | -| function | No | +| Type | +| ---------------------------- | +| array of [colors](colors.md) | --- -### `colors` +### `enabled`
Android
-The colors (at least one) that will be used to draw the refresh indicator. +Whether the pull to refresh functionality is enabled. -| Type | Required | Platform | -| --------------------------- | -------- | -------- | -| array of [color](colors.md) | No | Android | +| Type | Default | +| ------- | ------- | +| boolean | `true` | --- -### `enabled` +### `onRefresh` -Whether the pull to refresh functionality is enabled. +Called when the view starts refreshing. -| Type | Required | Platform | -| ---- | -------- | -------- | -| bool | No | Android | +| Type | +| -------- | +| function | --- -### `progressBackgroundColor` +### `progressBackgroundColor`
Android
The background color of the refresh indicator. -| Type | Required | Platform | -| ------------------ | -------- | -------- | -| [color](colors.md) | No | Android | +| Type | +| ------------------ | +| [color](colors.md) | --- -### `progressViewOffset` +### `progressViewOffset`
Android
-Progress view top offset +Progress view top offset. -| Type | Required | Platform | -| ------ | -------- | -------- | -| number | No | Android | +| Type | Default | +| ------ | ------- | +| number | `0` | --- -### `size` +### `size`
Android
-Size of the refresh indicator, see RefreshControl.SIZE. +Size of the refresh indicator. -| Type | Required | Platform | -| ---------------------------------------------------------------------- | -------- | -------- | -| enum(RefreshLayoutConsts.SIZE.DEFAULT, RefreshLayoutConsts.SIZE.LARGE) | No | Android | +| Type | Default | +| ---------------------------------------------------------------- | -------------------------------- | +| [RefreshControl.SIZE](refreshcontrol.md#refreshlayoutconstssize) | RefreshLayoutConsts.SIZE.DEFAULT | --- -### `tintColor` +### `tintColor`
iOS
The color of the refresh indicator. -| Type | Required | Platform | -| ------------------ | -------- | -------- | -| [color](colors.md) | No | iOS | +| Type | +| ------------------ | +| [color](colors.md) | --- -### `title` +### `title`
iOS
The title displayed under the refresh indicator. -| Type | Required | Platform | -| ------ | -------- | -------- | -| string | No | iOS | +| Type | +| ------ | +| string | --- -### `titleColor` +### `titleColor`
iOS
+ +The color of the refresh indicator title. + +| Type | +| ------------------ | +| [color](colors.md) | + +## Type Definitions + +### RefreshLayoutConsts.SIZE + +The SwipeRefreshLayout Android component constants. The acctual component size may vary between devices. You can read more about the native component in the [Android documentation](https://developer.android.com/reference/androidx/swiperefreshlayout/widget/SwipeRefreshLayout). + +| Type | +| ---- | +| enum | -Title color. +**Constants:** -| Type | Required | Platform | -| ------------------ | -------- | -------- | -| [color](colors.md) | No | iOS | +| Name | Type | Value | Description | +| ------- | ---- | ----- | --------------------------- | +| DEFAULT | int | `1` | Default RefreshControl size | +| LARGE | int | `0` | Large RefreshControl size | diff --git a/website/static/css/docs.css b/website/static/css/docs.css index 66a3e448620..c15eb37a555 100644 --- a/website/static/css/docs.css +++ b/website/static/css/docs.css @@ -177,8 +177,7 @@ figcaption { /* Right side navigation */ .onPageNav { - overflow: visible; - overflow-y: auto; + flex: 0 0 246px; } .onPageNav a, @@ -197,7 +196,7 @@ figcaption { } .onPageNav ul ul { - padding: 8px 0 0 16px; + padding: 8px 0 0 14px; } .onPageNav ul ul li { @@ -335,7 +334,6 @@ td .label.required { height: 6px; border-radius: 100%; margin-left: 2px; - margin-right: -12px; white-space: nowrap; overflow: hidden; color: transparent; diff --git a/website/static/css/react-native.css b/website/static/css/react-native.css index 0381842673a..23e190491a7 100644 --- a/website/static/css/react-native.css +++ b/website/static/css/react-native.css @@ -44,7 +44,7 @@ body, max-width: 900px; } .docMainWrapper > *:last-child { - margin-right: 20px; + margin-right: 14px; } }