@audira/carbon-react-native 0.0.1-alpha.2 → 0.0.1-alpha.3
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 +31 -21
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,46 +2,56 @@
|
|
|
2
2
|
Carbon for React Native
|
|
3
3
|
</h1>
|
|
4
4
|
|
|
5
|
-
> This library is completely rewritten and not intended to be the replacement of the official [carbon-react-native](https://github.com/carbon-design-system/carbon-react-native)
|
|
5
|
+
> This library is completely rewritten and not intended to be the replacement of the official [carbon-react-native](https://github.com/carbon-design-system/carbon-react-native)
|
|
6
|
+
|
|
7
|
+
> ⚠️ It is still in development
|
|
6
8
|
|
|
7
9
|
Build React Native apps with component and shared patterns using Carbon.
|
|
8
10
|
|
|
9
11
|
## Documentation
|
|
10
12
|
Documentation available with [docusaurus](https://docusaurus.io/) project on this repository under [docs](https://github.com/RakaDoank/carbon-react-native/tree/main/docs) directory. It's not completed yet, even the library, but it will be documented enough, as soon as the library is ready to use. You can start the docs web project with `npm run start` command in the [docs](https://github.com/RakaDoank/carbon-react-native/tree/main/docs) directory.
|
|
11
13
|
|
|
14
|
+
You can also see the [example](https://github.com/RakaDoank/carbon-react-native/tree/main/example) app.
|
|
15
|
+
|
|
12
16
|
## Compatibility
|
|
13
17
|
This library is just a pure JavaScript usage in React Native and only depends on the primitive React Native components with [react-native-reanimated](https://github.com/software-mansion/react-native-reanimated) and [react-native-svg](https://github.com/software-mansion/react-native-svg). It should compatible on all platforms available that can be built with React Native, but i cannot sure that. For the web only, [Carbon React](https://react.carbondesignsystem.com) is already there and do its best and solve a lot of accessibility feature.
|
|
14
18
|
|
|
15
19
|
## Installation
|
|
16
20
|
This project is not released yet on npm registry. You have to install it manually,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
|
|
22
|
+
With npm
|
|
23
|
+
```
|
|
24
|
+
npm install @audira/carbon-react-native
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
pnpm
|
|
28
|
+
```
|
|
29
|
+
pnpm install @audira/carbon-react-native
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
yarn
|
|
20
33
|
```
|
|
21
|
-
|
|
34
|
+
yarn add @audira/carbon-react-native
|
|
22
35
|
```
|
|
23
|
-
Change the path argument, it's relative from this repository lives
|
|
24
36
|
|
|
25
|
-
|
|
26
|
-
```
|
|
27
|
-
npm install --save ./.carbon-react-native
|
|
28
|
-
```
|
|
29
|
-
Ensure it is the correct path.
|
|
37
|
+
### Peer Dependencies
|
|
30
38
|
|
|
31
|
-
|
|
39
|
+
Install these dependencies on your React Native project, (skip one of these library if already installed)
|
|
32
40
|
- [react-native-reanimated](https://github.com/software-mansion/react-native-reanimated)
|
|
33
41
|
- [react-native-svg](https://github.com/software-mansion/react-native-svg)
|
|
34
42
|
- [@carbon/icons](https://www.npmjs.com/package/@carbon/icons)
|
|
35
43
|
- [@carbon/icon-helpers](https://www.npmjs.com/package/@carbon/icon-helpers)
|
|
36
44
|
|
|
37
|
-
|
|
45
|
+
### Font Installation
|
|
46
|
+
Install the `IBM Plex Sans` font to your project with [react-native-asset](https://www.npmjs.com/package/react-native-asset). Update your `react-native.config.js` file (create it on your root project directory if doesn't exist)
|
|
38
47
|
```js
|
|
39
48
|
module.exports = {
|
|
40
49
|
assets: [
|
|
41
|
-
'./node_modules/@
|
|
50
|
+
'./node_modules/@audira/carbon-react-native/assets/fonts/',
|
|
42
51
|
],
|
|
43
52
|
}
|
|
44
53
|
```
|
|
54
|
+
Then, run `npx react-native-asset` to link the fonts
|
|
45
55
|
|
|
46
56
|
## Initialize
|
|
47
57
|
This library depends on React Context to use the color tokens correctly based on the current color scheme. You have to wrap your whole React App once with `<CarbonReactNative>`
|
|
@@ -49,7 +59,7 @@ This library depends on React Context to use the color tokens correctly based on
|
|
|
49
59
|
// Somewhere like in your App.tsx file
|
|
50
60
|
import {
|
|
51
61
|
CarbonReactNative,
|
|
52
|
-
} from '@
|
|
62
|
+
} from '@audira/carbon-react-native'
|
|
53
63
|
|
|
54
64
|
export default function App() {
|
|
55
65
|
return (
|
|
@@ -66,7 +76,7 @@ Not all components are available yet, but you can test one of this library's com
|
|
|
66
76
|
```tsx
|
|
67
77
|
import {
|
|
68
78
|
Button,
|
|
69
|
-
} from '@
|
|
79
|
+
} from '@audira/carbon-react-native'
|
|
70
80
|
|
|
71
81
|
import AddIcon from '@carbon/icons/es/add/20'
|
|
72
82
|
|
|
@@ -91,7 +101,7 @@ import {
|
|
|
91
101
|
import {
|
|
92
102
|
Text,
|
|
93
103
|
ThemeContext,
|
|
94
|
-
} from '@
|
|
104
|
+
} from '@audira/carbon-react-native'
|
|
95
105
|
|
|
96
106
|
export default function YourReactComponent() {
|
|
97
107
|
const themeContext = useContext(ThemeContext)
|
|
@@ -115,7 +125,7 @@ import {
|
|
|
115
125
|
|
|
116
126
|
import {
|
|
117
127
|
SpacingConstant,
|
|
118
|
-
} from '@
|
|
128
|
+
} from '@audira/carbon-react-native'
|
|
119
129
|
|
|
120
130
|
export default function YourReactComponent() {
|
|
121
131
|
return (
|
|
@@ -143,7 +153,7 @@ If you want override the colorScheme, as an example you only want to use the `gr
|
|
|
143
153
|
```tsx
|
|
144
154
|
import {
|
|
145
155
|
CarbonReactNative,
|
|
146
|
-
} from '@
|
|
156
|
+
} from '@audira/carbon-react-native'
|
|
147
157
|
|
|
148
158
|
export default function App() {
|
|
149
159
|
return (
|
|
@@ -161,7 +171,7 @@ Not recommended to override the color token that are made by Carbon, but you can
|
|
|
161
171
|
import {
|
|
162
172
|
CarbonReactNative,
|
|
163
173
|
ColorConstant,
|
|
164
|
-
} from '@
|
|
174
|
+
} from '@audira/carbon-react-native'
|
|
165
175
|
|
|
166
176
|
export default function App() {
|
|
167
177
|
return (
|
|
@@ -189,7 +199,7 @@ import {
|
|
|
189
199
|
CarbonReactNative,
|
|
190
200
|
ColorHelper,
|
|
191
201
|
type ThemeType,
|
|
192
|
-
} from '@
|
|
202
|
+
} from '@audira/carbon-react-native'
|
|
193
203
|
|
|
194
204
|
export default function App() {
|
|
195
205
|
const
|