Skip to content

Commit 7ddeb37

Browse files
authored
docs: Adds prop docs to Loading component docs (#304)
* Added props to Loading component docs * fix typo * revert change * reorder structure
1 parent c59f498 commit 7ddeb37

1 file changed

Lines changed: 75 additions & 5 deletions

File tree

packages/extras/docs/components/Loading.md

Lines changed: 75 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,7 @@ import { Required } from '@site/src/components';
55
AMA provides an accessible `<Loading ... />` component that auto focuses and announces the accessibility label and busy state. This component wraps the standard [React Native ActivityIndicator](https://reactnative.dev/docs/activityindicator).
66

77
:::note
8-
The `Loading` component by default is absolutely positioned and will fill it's parents container. In the example below this would be the `<View>`. This behaviour can be overridden by the `Loading` components props. See props section below.
9-
:::
10-
11-
:::tip
12-
Use the `Loading` component it as a top-level component in your screen while data is being fetched or as a replacement for sections of your screen that are loading to prevent accessibility users from interacting with data that is stale.
8+
The `Loading` component by default is absolutely positioned and will fill it's parents container. This behavior can be overridden by the `Loading` components props. See [props](#props) section below.
139
:::
1410

1511
## Example
@@ -30,3 +26,77 @@ const Screen = () => {
3026
);
3127
};
3228
```
29+
30+
:::tip
31+
Use the `Loading` component it as a top-level component in your screen while data is being fetched or as a replacement for sections of your screen that are loading to prevent accessibility users from interacting with data that is stale.
32+
:::
33+
34+
## Props
35+
36+
:::note
37+
If you want to control the position of the loading indicator you can pass a `style` prop to the `Loading` component which will add styles to the `Loading` containers view. Alternatively you can completely override the current containers style by passing a `containerProps` prop with a style object key-value pair.
38+
:::
39+
40+
### <Required /> `isLoading`
41+
42+
The isLoading state determines if the `Loading` component is returned and is required for the component to function.
43+
44+
| Type | Default |
45+
| ------- | ------- |
46+
| boolean | false |
47+
48+
### `title`
49+
50+
The text used in the `accessibilityLabel` and also shown below the activity indicator if `showTitle` is set to true (default).
51+
52+
| Type | Default |
53+
| ------ | --------- |
54+
| string | 'Loading' |
55+
56+
### `showTitle`
57+
58+
Whether or not a title text should be shown below the activity indicator.
59+
60+
| Type | Default |
61+
| ------- | ------- |
62+
| boolean | true |
63+
64+
### `style`
65+
66+
A prop to add styles to use for the `Loading` component container view with style merging (style arrays).
67+
68+
| Type | Default |
69+
| --------- | --------- |
70+
| ViewStyle | undefined |
71+
72+
<details open>
73+
<summary>Styles already applied to the `Loading` component container view</summary>
74+
75+
Your styles will be merged with these styles:
76+
77+
```css
78+
{
79+
position: 'absolute',
80+
top: 0,
81+
left: 0,
82+
right: 0,
83+
bottom: 0,
84+
justifyContent: 'center',
85+
alignItems: 'center',
86+
zIndex: 100,
87+
}
88+
```
89+
90+
</details>
91+
92+
### `containerProps`
93+
94+
A prop to control any `Loading` component container view props.
95+
96+
| Type | Default |
97+
| ------------------------------------------- | --------- |
98+
| Omit\<AutofocusContainerProps, 'children'\> | undefined |
99+
100+
:::note
101+
The `Loading` component container is AMA's `AutofocusContainer` component. The `containerProps` prop is an object that will be spread onto the `AutofocusContainer` component.
102+
:::

0 commit comments

Comments
 (0)