Skip to content
This repository was archived by the owner on Nov 21, 2025. It is now read-only.

Commit d9e7dd8

Browse files
committed
docs: fix docz + react-native example
1 parent c1d892c commit d9e7dd8

File tree

7 files changed

+34
-166
lines changed

7 files changed

+34
-166
lines changed

examples/react-native/doczrc.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
11
export default {
22
title: 'React Native',
3-
native: true,
43
}
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
exports.onCreateWebpackConfig = args => {
2+
args.actions.setWebpackConfig({
3+
resolve: {
4+
alias: {
5+
'react-native': 'react-native-web',
6+
},
7+
},
8+
})
9+
}

examples/react-native/package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,14 +13,12 @@
1313
"build": "docz build"
1414
},
1515
"dependencies": {
16-
"@emotion/core": "^10.0.14",
17-
"@emotion/primitives": "^10.0.14",
1816
"docz": "next",
1917
"prop-types": "^15.7.2",
2018
"react": "^16.8.6",
2119
"react-art": "^16.8.6",
2220
"react-dom": "^16.8.6",
23-
"react-native-web": "^0.11.5",
21+
"react-native-web": "^0.11.7",
2422
"scheduler": "^0.15.0"
2523
},
2624
"devDependencies": {

examples/react-native/src/components/Alert.jsx

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
1-
import React, { Fragment } from 'react'
2-
import { Text as BaseText } from 'react-native'
3-
import styled from '@emotion/primitives'
4-
import * as t from 'prop-types'
1+
import React from 'react'
2+
import t from 'prop-types'
3+
import { View, Text } from 'react-native'
54

65
const kinds = {
76
info: '#5352ED',
@@ -10,21 +9,22 @@ const kinds = {
109
warning: '#FFA502',
1110
}
1211

13-
const AlertStyled = styled.View`
14-
padding: 15px 20px;
15-
background: white;
16-
border-radius: 3px;
17-
background: ${({ kind = 'info' }) => kinds[kind]};
18-
`
19-
20-
export const Text = styled(BaseText)`
21-
color: white;
22-
`
23-
24-
export const Alert = ({ kind = 'info', ...props }) => (
25-
<AlertStyled {...props} kind={kind} />
12+
const AlertStyled = ({ children, kind, ...rest }) => (
13+
<View
14+
style={{
15+
padding: 20,
16+
background: 'white',
17+
borderRadius: 3,
18+
background: kinds[kind],
19+
}}
20+
{...rest}
21+
>
22+
<Text style={{ color: 'white' }}>{children}</Text>
23+
</View>
2624
)
2725

26+
export const Alert = props => <AlertStyled {...props} />
27+
2828
Alert.propTypes = {
2929
kind: t.oneOf(['info', 'positive', 'negative', 'warning']),
3030
}

examples/react-native/src/components/Alert.mdx

Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ menu: Components
44
---
55

66
import { Playground, Props } from 'docz'
7-
import { Alert, Text } from './Alert'
7+
import { Alert } from './Alert'
88

99
# Alert
1010

@@ -15,28 +15,14 @@ import { Alert, Text } from './Alert'
1515
## Basic usage
1616

1717
<Playground>
18-
<Alert>
19-
<Text>Hello world</Text>
20-
</Alert>
18+
<Alert>Some message</Alert>
2119
</Playground>
2220

2321
## Using different kinds
2422

2523
<Playground>
26-
<Alert kind="info"><Text>Some message</Text></Alert>
27-
<Alert kind="positive"><Text>Some message</Text></Alert>
28-
<Alert kind="negative"><Text>Some message</Text></Alert>
29-
<Alert kind="warning"><Text>Some message</Text></Alert>
30-
</Playground>
31-
32-
33-
## Use with children as a function
34-
35-
<Playground>
36-
{() => {
37-
const message = 'Hello world'
38-
return (
39-
<Alert><Text>{message}</Text></Alert>
40-
)
41-
}}
42-
</Playground>
24+
<Alert kind="info">Some message</Alert>
25+
<Alert kind="positive">Some message</Alert>
26+
<Alert kind="negative">Some message</Alert>
27+
<Alert kind="warning">Some message</Alert>
28+
</Playground>

examples/react-native/src/components/Button.jsx

Lines changed: 0 additions & 78 deletions
This file was deleted.

examples/react-native/src/components/Button.mdx

Lines changed: 0 additions & 46 deletions
This file was deleted.

0 commit comments

Comments
 (0)