Skip to content

Commit c3fedbd

Browse files
iamclaytonraysatya164
authored andcommitted
docs: add imports to doc examples - closes callstack#223 (callstack#256)
1 parent 442653c commit c3fedbd

29 files changed

+108
-6
lines changed

src/components/Button.js

+3
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,9 @@ type State = {
8080
*
8181
* ## Usage
8282
* ```js
83+
* import * as React from 'react';
84+
* import { Button } from 'react-native-paper';
85+
*
8386
* const MyComponent = () => (
8487
* <Button raised onPress={() => console.log('Pressed')}>
8588
* Press me

src/components/Card/Card.js

+11
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,17 @@ type State = {
4747
*
4848
* ## Usage
4949
* ```js
50+
* import * as React from 'react';
51+
* import {
52+
* Button,
53+
* Card,
54+
* CardActions,
55+
* CardContent,
56+
* CardCover,
57+
* Title,
58+
* Paragraph
59+
* } from 'react-native-paper';
60+
*
5061
* const MyComponent = () => (
5162
* <Card>
5263
* <CardContent>

src/components/Card/CardActions.js

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ type Props = {
1616
*
1717
* ## Usage
1818
* ```js
19+
* import * as React from 'react';
20+
* import { Button, Card, CardActions } from 'react-native-paper';
21+
*
1922
* const MyComponent = () => (
2023
* <Card>
2124
* <CardActions>

src/components/Card/CardContent.js

+3
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ type Props = {
2424
*
2525
* ## Usage
2626
* ```js
27+
* import * as React from 'react';
28+
* import { Card, CardContent, Title, Paragraph } from 'react-native-paper';
29+
*
2730
* const MyComponent = () => (
2831
* <Card>
2932
* <CardContent>

src/components/Card/CardCover.js

+3
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,9 @@ type Props = {
2727
*
2828
* ## Usage
2929
* ```js
30+
* import * as React from 'react';
31+
* import { Card, CardCover } from 'react-native-paper';
32+
*
3033
* const MyComponent = () => (
3134
* <Card>
3235
* <CardCover source={{ uri: 'https://picsum.photos/700' }} />

src/components/Checkbox.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,10 @@ type State = {
5959
*
6060
* ## Usage
6161
* ```js
62-
* export default class MyComponent extends Component {
62+
* import * as React from 'react';
63+
* import { Checkbox } from 'react-native-paper';
64+
*
65+
* export default class MyComponent extends React.Component {
6366
* state = {
6467
* checked: false,
6568
* };

src/components/Dialog/Dialog.js

+4
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,10 @@ type Props = {
4747
*
4848
* ## Usage
4949
* ```js
50+
* import * as React from 'react';
51+
* import { Text, View } from 'react-native';
52+
* import { Button, Dialog, DialogActions, DialogContent, DialogTitle, Paragraph } from 'react-native-paper';
53+
*
5054
* export default class MyComponent extends React.Component {
5155
* state = {
5256
* visible: false,

src/components/Dialog/DialogActions.js

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ type Props = {
1616
*
1717
* ## Usage
1818
* ```js
19+
* import * as React from 'react';
20+
* import { Button, Dialog, DialogActions } from 'react-native-paper';
21+
*
1922
* export default class MyComponent extends React.Component {
2023
* state = {
2124
* visible: false,

src/components/Dialog/DialogContent.js

+3
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,9 @@ type Props = {
1616
*
1717
* ## Usage
1818
* ```js
19+
* import * as React from 'react';
20+
* import { Dialog, DialogContent, Paragraph } from 'react-native-paper';
21+
*
1922
* export default class MyComponent extends React.Component {
2023
* state = {
2124
* visible: false,

src/components/Dialog/DialogScrollArea.js

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,10 @@ type Props = {
1717
*
1818
* ## Usage
1919
* ```js
20+
* import * as React from 'react';
21+
* import { ScrollView } from 'react-native';
22+
* import { Dialog, DialogScrollArea } from 'react-native-paper';
23+
*
2024
* export default class MyComponent extends React.Component {
2125
* state = {
2226
* visible: false,

src/components/Dialog/DialogTitle.js

+3
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ type Props = {
2323
*
2424
* ## Usage
2525
* ```js
26+
* import * as React from 'react';
27+
* import { Dialog, DialogContent, DialogTitle, Paragraph } from 'react-native-paper';
28+
*
2629
* export default class MyComponent extends React.Component {
2730
* state = {
2831
* visible: false,

src/components/Divider.js

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ type Props = {
2424
*
2525
* ## Usage
2626
* ```js
27+
* import * as React from 'react';
28+
* import { Text, View } from 'react-native';
29+
* import { Divider } from 'react-native-paper';
30+
*
2731
* const MyComponent = () => (
2832
* <View>
2933
* <Text>Apple</Text>

src/components/DrawerItem.js

+3
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,9 @@ type Props = {
4545
*
4646
* ## Usage
4747
* ```js
48+
* import * as React from 'react';
49+
* import { DrawerItem } from 'react-native-paper';
50+
*
4851
* const MyComponent = () => (
4952
* <DrawerItem label="First Item" />
5053
* );

src/components/DrawerSection.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,10 @@ type Props = {
2727
*
2828
* ## Usage
2929
* ```js
30-
* export default class MyComponent extends Component {
30+
* import * as React from 'react';
31+
* import { DrawerSection, DrawerItem } from 'react-native-paper';
32+
*
33+
* export default class MyComponent extends React.Component {
3134
* state = {
3235
* active: 'First Item',
3336
* };

src/components/FAB.js

+3
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@ type Props = {
5151
*
5252
* ## Usage
5353
* ```js
54+
* import * as React from 'react';
55+
* import { FAB } from 'react-native-paper';
56+
*
5457
* const MyComponent = () => (
5558
* <FAB
5659
* small

src/components/Modal.js

+4
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ type State = {
4040
*
4141
* ## Usage
4242
* ```js
43+
* import * as React from 'react';
44+
* import { Text } from 'react-native';
45+
* import { Modal } from 'react-native-paper';
46+
*
4347
* export default class MyComponent extends React.Component {
4448
* state = {
4549
* visible: false,

src/components/Paper.js

+4
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,10 @@ type Props = {
3030
*
3131
* ## Usage
3232
* ```js
33+
* import * as React from 'react';
34+
* import { Text } from 'react-native';
35+
* import { Paper } from 'react-native-paper';
36+
*
3337
* const MyComponent = () => (
3438
* <Paper style={styles.paper}>
3539
* <Text>Paper</Text>

src/components/ProgressBar.js

+3
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,9 @@ const ProgressBarComponent = Platform.select({
4141
*
4242
* ## Usage
4343
* ```js
44+
* import * as React from 'react';
45+
* import { ProgressBar } from 'react-native-paper';
46+
*
4447
* const MyComponent = () => (
4548
* <ProgressBar progress={0.5} color={Colors.red800} />
4649
* );

src/components/RadioButton.js

+5-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,11 @@ const BORDER_WIDTH = 2;
6161
*
6262
* ## Usage
6363
* ```js
64-
* export default class MyComponent extends Component {
64+
* import * as React from 'react';
65+
* import { View } from 'react-native';
66+
* import { RadioButton } from 'react-native-paper';
67+
*
68+
* export default class MyComponent extends React.Component {
6569
* state = {
6670
* checked: 'firstOption',
6771
* };

src/components/SearchBar.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,10 @@ type Props = {
4848
*
4949
* ## Usage
5050
* ```js
51-
* export default class MyComponent extends Component {
51+
* import React from 'react';
52+
* import { SearchBar } from 'react-native-paper';
53+
*
54+
* export default class MyComponent extends React.Component {
5255
* state = {
5356
* firstQuery: '',
5457
* };

src/components/Switch.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,10 @@ type Props = {
5555
*
5656
* ## Usage
5757
* ```js
58-
* export default class MyComponent extends Component {
58+
* import * as React from 'react';
59+
* import { Switch } from 'react-native-paper';
60+
*
61+
* export default class MyComponent extends React.Component {
5962
* state = {
6063
* isSwitchOn: false,
6164
* };

src/components/TextInput.js

+3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,9 @@ type State = {
8282
*
8383
* ## Usage
8484
* ```js
85+
* import * as React from 'react';
86+
* import { TextInput } from 'react-native-paper';
87+
*
8588
* class MyComponent extends React.Component {
8689
* state = {
8790
* text: ''

src/components/Toolbar/Toolbar.js

+4-1
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,10 @@ type Props = {
4747
*
4848
* ## Usage
4949
* ```js
50-
* export default class MyComponent extends Component {
50+
* import * as React from 'react';
51+
* import { Toolbar, ToolbarBackAction, ToolbarContent, ToolbarAction } from 'react-native-paper';
52+
*
53+
* export default class MyComponent extends React.Component {
5154
* render() {
5255
* return (
5356
* <Toolbar>

src/components/TouchableRipple.js

+4
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,10 @@ type Props = {
5555
*
5656
* ## Usage
5757
* ```js
58+
* import * as React from 'react';
59+
* import { View } from 'react-native';
60+
* import { Paragraph, TouchableRipple } from 'react-native-paper';
61+
*
5862
* const MyComponent = () => (
5963
* <TouchableRipple
6064
* onPress={() => {}}

src/components/Typography/Caption.js

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ type Props = {
1717
*
1818
* ## Usage
1919
* ```js
20+
* import * as React from 'react';
21+
* import { Caption } from 'react-native-paper';
22+
*
2023
* const MyComponent = () => (
2124
* <Caption>Caption</Caption>
2225
* );

src/components/Typography/Headline.js

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ type Props = {
1717
*
1818
* ## Usage
1919
* ```js
20+
* import * as React from 'react';
21+
* import { Headline } from 'react-native-paper';
22+
*
2023
* const MyComponent = () => (
2124
* <Headline>Headline</Headline>
2225
* );

src/components/Typography/Paragraph.js

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ type Props = {
1717
*
1818
* ## Usage
1919
* ```js
20+
* import * as React from 'react';
21+
* import { Paragraph } from 'react-native-paper';
22+
*
2023
* const MyComponent = () => (
2124
* <Paragraph>Paragraph</Paragraph>
2225
* );

src/components/Typography/Subheading.js

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ type Props = {
1717
*
1818
* ## Usage
1919
* ```js
20+
* import * as React from 'react';
21+
* import { Subheading } from 'react-native-paper';
22+
*
2023
* const MyComponent = () => (
2124
* <Subheading>Subheading</Subheading>
2225
* );

src/components/Typography/Title.js

+3
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ type Props = {
1717
*
1818
* ## Usage
1919
* ```js
20+
* import * as React from 'react';
21+
* import { Title } from 'react-native-paper';
22+
*
2023
* const MyComponent = () => (
2124
* <Title>Title</Title>
2225
* );

0 commit comments

Comments
 (0)