1 | # react-native-jigsaw
|
2 |
|
3 | [Draftbit's](https://draftbit.com) component library used inside our Builder. It's based on [React Native Paper](https://github.com/callstack/react-native-paper) but allows us to extend and empower our users with more features ⚡️
|
4 |
|
5 | ## Differences between React Native Paper and Jigsaw
|
6 |
|
7 | - Embedded themes. Jigsaw has a very robust theming system that is directly integrated into our builder. React Native Paper is based on Material Design where ours is more generalized for both iOS and Android. That doesn't make it any better or worse, it just means ours is directly integrated into our product and by controlling the library we can make changes as often as we need
|
8 |
|
9 | - Different components & use cases. React Native Paper is really great for building Material-style apps where we use Jigsaw to build any type of app. You'll find a different series of components for different use cases
|
10 |
|
11 | We love React Native Paper and even plan on supporting it one day as a different component library, Jigsaw just allows us to deeply embed components, props, themes directly into the Draftbit platform
|
12 |
|
13 | ## Differences between @draftbit/ui and @draftbit/web
|
14 |
|
15 | @draftbit/web is only used for our internal builder. Because we're using `@expo/vector-icons` and React Native's way of compiling files, this isn't compatible inside create-react-app. The fix is to publish a separate `@draftbit/web` file with Icon.web.tsx being the Icon.tsx file and Icon.native.tsx being the Icon.tsx file.
|
16 |
|
17 | Both icon files live inside `files/` top level, next to `src`.
|
18 |
|
19 | ## Installation
|
20 |
|
21 | ```sh
|
22 | npm install @draftbit/ui
|
23 | ```
|
24 |
|
25 | ## Publishing
|
26 |
|
27 | ```sh
|
28 | yarn publish:both
|
29 | ```
|
30 |
|
31 | ## Contributing
|
32 |
|
33 | See the [contributing guide](CONTRIBUTING.md) to learn how to contribute to the repository and the development workflow.
|
34 |
|
35 | ## Adding components
|
36 |
|
37 |
|
38 | ### Primitives (Text, View)
|
39 |
|
40 | Most of the primitives should already be here. If a component with no actual logic needs to be added, you can add that into `src/mappings` (see that folder for an example)
|
41 |
|
42 | ### Custom Components
|
43 |
|
44 | All components live inside `src/components/MyComponent.ts`. Add your component, add the required `SEED_DATA` and you should be good to go!
|
45 |
|
46 | ## Seed Data
|
47 |
|
48 | Seed data is how we know what to render and support inside the product. It takes on this format. `src/core/component-types.js` will show you the different GROUPS, PROP_TYPES, FORM_TYPES, and other fields you might need.
|
49 |
|
50 | ```js
|
51 | group: GROUPS.advanced,
|
52 | name: "textBreakStrategy",
|
53 | label: "textBreakStrategy",
|
54 | description:
|
55 | "Set text break strategy on Android API Level 23+, possible values are simple, highQuality, balanced The default value is highQuality.",
|
56 | options: ["simple", "highQuality", "balanced"],
|
57 | editable: true,
|
58 | required: false,
|
59 | formType: FORM_TYPES.flatArray,
|
60 | propType: PROP_TYPES.STRING,
|
61 | defaultValue: "highQuality",
|
62 | ```
|
63 |
|
64 | ## License
|
65 |
|
66 | MIT
|