Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 11 additions & 15 deletions docs/docs/guides/03-icons.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ You can pass the name of an icon from [`MaterialDesignIcons`](https://pictogramm
Example:

```js
<Button icon="camera">Press me</Button>
<Button icon="camera" label="Press me" />
```

:::note
Expand Down Expand Up @@ -63,15 +63,14 @@ Remote image:
```js
<Button
icon={{ uri: 'https://avatars0.githubusercontent.com/u/17571969?v=3&s=400' }}
>
Press me
</Button>
label="Press me"
/>
```

Local image:

```js
<Button icon={require('../assets/chameleon.jpg')}>Press me</Button>
<Button icon={require('../assets/chameleon.jpg')} label="Press me" />
```

### 3. A render function
Expand All @@ -88,9 +87,8 @@ Example:
style={{ width: size, height: size, tintColor: color }}
/>
)}
>
Press me
</Button>
label="Press me"
/>
```

### 4. Use custom icons
Expand Down Expand Up @@ -131,15 +129,14 @@ Example for using an image source:
},
direction: 'rtl',
}}
>
Press me
</Button>
label="Press me"
/>
```

Example for using an icon name:

```js
<Button icon={{ source: 'add-a-photo', direction: 'rtl' }}>Press me</Button>
<Button icon={{ source: 'add-a-photo', direction: 'rtl' }} label="Press me" />
```

You can also use a render function. Along with `size` and `color`, you have access to `direction` which will either be `'rtl'` or `'ltr'`. You can then decide how to render your icon component accordingly.
Expand All @@ -163,7 +160,6 @@ Example of using a render function:
]}
/>
)}
>
Press me
</Button>
label="Press me"
/>
```
8 changes: 5 additions & 3 deletions docs/docs/guides/09-react-navigation.md
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ function HomeScreen({ navigation }) {
return (
<View style={style.container}>
<Text>Home Screen</Text>
<Button mode="contained" onPress={() => navigation.navigate('Details')}>
Go to details
</Button>
<Button
mode="contained"
onPress={() => navigation.navigate('Details')}
label="Go to details"
/>
</View>
);
}
Expand Down
6 changes: 3 additions & 3 deletions docs/docs/guides/11-ripple-effect.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@ The `rippleColor` prop is available for every pressable component which allows y
rippleColor="#FF000020"
icon="camera"
mode="contained"
onPress={() => console.log('Pressed')}>
Press me
</Button>
onPress={() => console.log('Pressed')}
label="Press me"
/>
```

## Disable ripple effect in all components
Expand Down
22 changes: 13 additions & 9 deletions docs/src/components/BannerExample.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -74,15 +74,19 @@ const BannerExample = () => {
>
<Stack spacing={16}>
<Stack direction="row" spacing={8} style={styles.row}>
<Button loading onPress={() => {}}>
Loading
</Button>
<Button mode="contained-tonal" icon="camera" onPress={() => {}}>
Icon
</Button>
<Button icon="camera" mode="contained" onPress={() => {}}>
Press me
</Button>
<Button loading onPress={() => {}} label="Loading" />
<Button
mode="contained-tonal"
icon="camera"
onPress={() => {}}
label="Icon"
/>
<Button
icon="camera"
mode="contained"
onPress={() => {}}
label="Press me"
/>
<FAB icon="plus" size="small" onPress={() => {}} />
<FAB icon="plus" size="medium" onPress={() => {}} />
<FAB icon="plus" size="large" onPress={() => {}} />
Expand Down
14 changes: 8 additions & 6 deletions docs/src/components/GetStartedButtons.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,12 @@ const GetStartedButton = () => {
return (
<View style={styles.container}>
<Link to="/docs/guides/getting-started" style={noTextDecoration}>
<Button mode="contained" style={styles.button} onPress={noop}>
Get started
</Button>
<Button
mode="contained"
style={styles.button}
onPress={noop}
label="Get started"
/>
</Link>
<Button
mode="outlined"
Expand All @@ -47,9 +50,8 @@ const GetStartedButton = () => {
'https://snack.expo.dev/@react-native-paper/react-native-paper-example_v5'
)
}
>
Try on Snack
</Button>
label="Try on Snack"
/>
</View>
);
};
Expand Down
2 changes: 1 addition & 1 deletion example/src/DrawerItems.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -264,7 +264,7 @@ function DrawerItems() {
<Text variant="labelMedium">example</Text> directory.
</Text>
<Dialog.Actions>
<Button onPress={_handleDismissRTLDialog}>Ok</Button>
<Button onPress={_handleDismissRTLDialog} label="Ok" />
</Dialog.Actions>
</Dialog.Content>
</Dialog>
Expand Down
Loading
Loading