Skip to content

Commit 85e304c

Browse files
committed
docs: add get started button on initial page (#3697)
1 parent c2bf446 commit 85e304c

File tree

3 files changed

+64
-2
lines changed

3 files changed

+64
-2
lines changed

docs/src/components/BannerExample.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,7 @@ const BannerExample = () => {
142142
export default function WithProvider() {
143143
const isDarkTheme = useColorMode().colorMode === 'dark';
144144
return (
145-
<BrowserOnly>
145+
<BrowserOnly fallback={<ProgressBar indeterminate />}>
146146
{() => (
147147
<Provider theme={isDarkTheme ? DarkTheme : DefaultTheme}>
148148
<BannerExample />
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
import * as React from 'react';
2+
import { StyleSheet, View } from 'react-native';
3+
4+
import BrowserOnly from '@docusaurus/BrowserOnly';
5+
import Link from '@docusaurus/Link';
6+
import { useColorMode } from '@docusaurus/theme-common';
7+
import {
8+
Button,
9+
MD3DarkTheme as DarkTheme,
10+
MD3LightTheme as DefaultTheme,
11+
Provider,
12+
} from 'react-native-paper';
13+
14+
const styles = StyleSheet.create({
15+
container: {
16+
flexDirection: 'row',
17+
justifyContent: 'center',
18+
paddingBottom: 16,
19+
},
20+
button: {
21+
marginRight: 16,
22+
},
23+
});
24+
25+
const GetStartedButton = () => {
26+
return (
27+
<View style={styles.container}>
28+
<Link to="docs/guides/getting-started" style={{ textDecoration: 'none' }}>
29+
<Button mode="elevated" style={styles.button}>
30+
Get started
31+
</Button>
32+
</Link>
33+
<Button
34+
mode="elevated"
35+
onPress={() =>
36+
window.open(
37+
'https://snack.expo.dev/@react-native-paper/react-native-paper-example_v5'
38+
)
39+
}
40+
>
41+
Try on Snack
42+
</Button>
43+
</View>
44+
);
45+
};
46+
47+
export default function WithProvider() {
48+
const isDarkTheme = useColorMode().colorMode === 'dark';
49+
return (
50+
<BrowserOnly>
51+
{() => (
52+
<Provider theme={isDarkTheme ? DarkTheme : DefaultTheme}>
53+
<GetStartedButton />
54+
</Provider>
55+
)}
56+
</BrowserOnly>
57+
);
58+
}

docs/src/pages/index.mdx

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,15 @@
22

33
# Cross-platform Material Design for React Native
44

5+
import {Button} from 'react-native-paper';
6+
import GetStartedButtons from '../components/GetStartedButtons';
57
import BannerExample from '../components/BannerExample';
68

79
Paper is a collection of customizable and production-ready components for React Native, following Google’s Material Design guidelines.
810

9-
Try the demo on [Snack](https://snack.expo.dev/@react-native-paper/react-native-paper-example_v5), [iOS](https://apps.apple.com/app/react-native-paper/id1548934513) or [Android](https://play.google.com/store/apps/details?id=com.callstack.reactnativepaperexample).
11+
<GetStartedButtons />
12+
13+
Or check the demo app on [iOS](https://apps.apple.com/app/react-native-paper/id1548934513) or [Android](https://play.google.com/store/apps/details?id=com.callstack.reactnativepaperexample).
1014

1115
<BannerExample />
1216

0 commit comments

Comments
 (0)