@apple-pie/slice-native 0.0.0-stage → 0.1.0
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 +55 -2
- package/dist/cjs/index.js +810 -0
- package/dist/esm/index.mjs +806 -0
- package/dist/types/components/Icon/NativeIcon.d.ts +2 -0
- package/dist/types/components/Icon/_types.d.ts +16 -0
- package/dist/types/components/Icon/iconRegistry.d.ts +17 -0
- package/dist/types/components/Icon/icons.d.ts +137 -0
- package/dist/types/components/Icon/index.d.ts +3 -0
- package/dist/types/index.d.ts +2 -0
- package/package.json +42 -5
package/README.md
CHANGED
|
@@ -1,3 +1,56 @@
|
|
|
1
|
-
#
|
|
1
|
+
# @apple-pie/icons-native
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
React Native SVG icons, with the same names and artwork as the web UIKit.
|
|
4
|
+
|
|
5
|
+
```tsx
|
|
6
|
+
import { Icon, SliceIcons } from '@apple-pie/icons-native';
|
|
7
|
+
|
|
8
|
+
<Icon
|
|
9
|
+
name={SliceIcons.ui.home}
|
|
10
|
+
size={24}
|
|
11
|
+
strokeColor="#334155"
|
|
12
|
+
accessibilityLabel="Go home"
|
|
13
|
+
onPress={() => navigation.navigate('Home')}
|
|
14
|
+
/>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`NativeIcon` is also exported as an alias of `Icon`. Supply native SVG props and
|
|
18
|
+
native `style` objects; use `onPress` instead of `onClick`. CSS classes, cursor
|
|
19
|
+
styling (`pointer`), and browser keyboard handlers are not part of this API.
|
|
20
|
+
Use an enclosing React Native `Pressable` when you need a larger touch target or
|
|
21
|
+
button feedback, and mark the icon `accessible={false}` when it is decorative.
|
|
22
|
+
|
|
23
|
+
Defaults are 20×20, stroke width 1.5, and black/white colors based on the system
|
|
24
|
+
color scheme. Pass `strokeColor` and `coverUp` explicitly to match an app theme.
|
|
25
|
+
`fillColor` retains the web API's meaning: **opacity from 0 to 1**, not a color.
|
|
26
|
+
`fill` enables that opacity (default 0.125 in light mode, 0.2 in dark mode).
|
|
27
|
+
`toggle` selects the on variant when available; unknown names render nothing.
|
|
28
|
+
`disabled` blocks press callbacks and halves the specified opacity.
|
|
29
|
+
|
|
30
|
+
The package requires React, React Native, and react-native-svg as peers. Install
|
|
31
|
+
the native SVG dependency in the consuming app using its normal native/Expo setup.
|
|
32
|
+
|
|
33
|
+
## Development
|
|
34
|
+
|
|
35
|
+
The package manifest and entry point live in `native/`. Icon components, types,
|
|
36
|
+
generated artwork, and tests live in `native/components/Icon/`.
|
|
37
|
+
|
|
38
|
+
From this directory, run `npm run generate` after changing the web icon registry
|
|
39
|
+
or `SliceIcons` constants. Generated files contain native SVG components and have
|
|
40
|
+
no runtime imports from the web UIKit. Run `npm run typecheck` with the peer
|
|
41
|
+
dependencies installed and TypeScript available from the repository.
|
|
42
|
+
|
|
43
|
+
From the repository root:
|
|
44
|
+
|
|
45
|
+
```sh
|
|
46
|
+
npm install --prefix native
|
|
47
|
+
npm run build --prefix native
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
The build refreshes generated icons, checks types, and produces `dist/cjs/index.js`,
|
|
51
|
+
`dist/esm/index.mjs`, and declarations under `dist/types`. React, React Native, and
|
|
52
|
+
react-native-svg stay external peer dependencies. The web build is independent.
|
|
53
|
+
|
|
54
|
+
Run `npm pack --dry-run` from `native/` to inspect the publishable files, or
|
|
55
|
+
`npm pack` to create a tarball. The `prepack` hook builds automatically. Build and
|
|
56
|
+
pack from this repository: generation uses the web artwork in `src/components/Icon`.
|