@audira/carbon-react-native 0.0.1-alpha.10 → 0.0.1-alpha.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +43 -8
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -21,17 +21,17 @@ Install the library to your project
|
|
|
21
21
|
|
|
22
22
|
with npm
|
|
23
23
|
```
|
|
24
|
-
npm install @audira/carbon-react-native
|
|
24
|
+
npm install @audira/carbon-react-native @audira/carbon-react-native-elements
|
|
25
25
|
```
|
|
26
26
|
|
|
27
27
|
pnpm
|
|
28
28
|
```
|
|
29
|
-
pnpm install @audira/carbon-react-native
|
|
29
|
+
pnpm install @audira/carbon-react-native @audira/carbon-react-native-elements
|
|
30
30
|
```
|
|
31
31
|
|
|
32
32
|
yarn
|
|
33
33
|
```
|
|
34
|
-
yarn add @audira/carbon-react-native
|
|
34
|
+
yarn add @audira/carbon-react-native @audira/carbon-react-native-elements
|
|
35
35
|
```
|
|
36
36
|
|
|
37
37
|
### Peer Dependencies
|
|
@@ -115,8 +115,43 @@ export default function YourReactComponent() {
|
|
|
115
115
|
```
|
|
116
116
|
All components are also made by using `ThemeContext` by the way. All members of the color is same as the official color tokens [here](https://carbondesignsystem.com/elements/color/tokens), but it is using underscore (_) instead of dash (-).
|
|
117
117
|
|
|
118
|
-
###
|
|
119
|
-
|
|
118
|
+
### Coloring StyleSheet
|
|
119
|
+
Instead of inline styles, you can also use color token from this library's `StyleSheet`. This is also recommended way to support [React Native for Web](https://necolas.github.io/react-native-web)'s to generate CSS
|
|
120
|
+
```tsx
|
|
121
|
+
import {
|
|
122
|
+
useContext,
|
|
123
|
+
} from 'react'
|
|
124
|
+
|
|
125
|
+
import {
|
|
126
|
+
StyleSheet,
|
|
127
|
+
Text,
|
|
128
|
+
ThemeContext,
|
|
129
|
+
} from '@audira/carbon-react-native'
|
|
130
|
+
|
|
131
|
+
export default function YourReactComponent() {
|
|
132
|
+
/**
|
|
133
|
+
* Keep this to make `style` prop reactive on color scheme changes
|
|
134
|
+
*/
|
|
135
|
+
useContext(ThemeContext)
|
|
136
|
+
|
|
137
|
+
return (
|
|
138
|
+
<Text type="label_01" style={ style.linkText }>
|
|
139
|
+
React Native
|
|
140
|
+
</Text>
|
|
141
|
+
)
|
|
142
|
+
}
|
|
143
|
+
|
|
144
|
+
const style = StyleSheet.create(color => {
|
|
145
|
+
return {
|
|
146
|
+
linkText: {
|
|
147
|
+
color: color.link_primary,
|
|
148
|
+
},
|
|
149
|
+
}
|
|
150
|
+
})
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
### Elements
|
|
154
|
+
You can use elements are available which are `Color`, `Spacing`, `Typography`, and `Motion`. Refer to this [source](https://github.com/RakaDoank/carbon-react-native/tree/main/packages/carbon-react-native-elements/src)
|
|
120
155
|
```tsx
|
|
121
156
|
import {
|
|
122
157
|
StyleSheet,
|
|
@@ -124,8 +159,8 @@ import {
|
|
|
124
159
|
} from 'react-native'
|
|
125
160
|
|
|
126
161
|
import {
|
|
127
|
-
|
|
128
|
-
} from '@audira/carbon-react-native'
|
|
162
|
+
Spacing,
|
|
163
|
+
} from '@audira/carbon-react-native-elements'
|
|
129
164
|
|
|
130
165
|
export default function YourReactComponent() {
|
|
131
166
|
return (
|
|
@@ -137,7 +172,7 @@ export default function YourReactComponent() {
|
|
|
137
172
|
|
|
138
173
|
const style = StyleSheet.create({
|
|
139
174
|
container: {
|
|
140
|
-
paddingHorizontal:
|
|
175
|
+
paddingHorizontal: Spacing.spacing_05,
|
|
141
176
|
},
|
|
142
177
|
})
|
|
143
178
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@audira/carbon-react-native",
|
|
3
|
-
"version": "0.0.1-alpha.
|
|
3
|
+
"version": "0.0.1-alpha.11",
|
|
4
4
|
"license": "MIT",
|
|
5
5
|
"homepage": "https://github.com/RakaDoank/carbon-react-native",
|
|
6
6
|
"repository": "https://github.com/RakaDoank/carbon-react-native",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"react-native": ">=0.72",
|
|
14
14
|
"react-native-reanimated": ">=3",
|
|
15
15
|
"react-native-svg": ">=15",
|
|
16
|
-
"@audira/carbon-react-native-elements": "0.0.1-alpha.
|
|
16
|
+
"@audira/carbon-react-native-elements": "0.0.1-alpha.11"
|
|
17
17
|
},
|
|
18
18
|
"devDependencies": {
|
|
19
19
|
"@react-native/typescript-config": "0.78.0",
|