-
-
Notifications
You must be signed in to change notification settings - Fork 2.2k
Expand file tree
/
Copy pathGetStartedButtons.tsx
More file actions
110 lines (101 loc) · 2.45 KB
/
GetStartedButtons.tsx
File metadata and controls
110 lines (101 loc) · 2.45 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
import * as React from 'react';
import { StyleSheet, View } from 'react-native';
//@ts-ignore
import BrowserOnly from '@docusaurus/BrowserOnly';
//@ts-ignore
import Link from '@docusaurus/Link';
//@ts-ignore
import { useColorMode } from '@docusaurus/theme-common';
import {
Button,
DarkTheme as DarkTheme,
LightTheme as DefaultTheme,
PaperProvider,
} from 'react-native-paper';
const styles = StyleSheet.create({
container: {
flexDirection: 'row',
justifyContent: 'center',
paddingBottom: 16,
},
button: {
marginRight: 16,
},
});
const noTextDecoration = {
textDecoration: 'none',
};
// Needed for ripple effect when pressing `Button`, however navigation is handled by `Link`
const noop = () => {};
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>
</Link>
<Button
mode="outlined"
onPress={() =>
window.open(
'https://snack.expo.dev/@react-native-paper/react-native-paper-example_v5'
)
}
>
Try on Snack
</Button>
</View>
);
};
const Shimmer = () => {
/* Docusaurus won't call StyleSheet.create() server-side */
/* eslint-disable react-native/no-inline-styles, react-native/no-color-literals */
return (
<View
style={{
display: 'flex',
flexDirection: 'row',
justifyContent: 'center',
paddingBottom: 18,
}}
>
<View
style={{
width: 121,
marginRight: 16,
borderWidth: 1,
borderColor: 'rgba(125, 82, 96, 0.4)',
borderStyle: 'solid',
borderRadius: 40,
height: 40,
}}
/>
<View
style={{
width: 132,
borderWidth: 1,
borderColor: 'rgba(125, 82, 96, 0.4)',
borderStyle: 'solid',
borderRadius: 40,
height: 40,
}}
/>
</View>
);
};
const ThemedGetStarted = () => {
const isDarkTheme = useColorMode().colorMode === 'dark';
return (
<PaperProvider theme={isDarkTheme ? DarkTheme : DefaultTheme}>
<GetStartedButton />
</PaperProvider>
);
};
export default function ClientSideGetStarted() {
return (
<BrowserOnly fallback={<Shimmer />}>
{() => <ThemedGetStarted />}
</BrowserOnly>
);
}