@napps/nodes. The package reconciles JSX into native JSI nodes.
Create a component
Create a project from the Custom Component template, then add a component to it:napps create-component creates src/Promo.component.tsx, exports it from index.ts, and adds an entry to napps.config.json. --target sets where the component can be placed: Home, Product, Collection, Cart, Menu, or CustomPage. Repeat it or pass a comma-separated list for several targets. Run the command without options to be prompted instead.
A component file looks like this:
meta declares merchant-configurable settings. The CLI syncs those fields during deployment. Pass the component arguments into React through RootComponentProps.
JSX nodes
Supported intrinsic nodes includebox, column, row, text, img, video, touchable, button, textInput, scrollable, pager, bottomSheet, and gestureDetector.
All nodes accept style, key, and class. Nodes that render a subtree also accept children;
img, video, button, and textInput are leaf nodes and do not render children. Classes do not
cascade to children.
Component lifecycle
BaseReactUIComponent mounts the React tree when the native component is created and unmounts it when the component is destroyed. In development, the CLI reuses the root during Fast Refresh so React state can survive edits.
Next steps
- Learn the React hooks.
- Browse the supported nodes and their properties.
- Define styles and layout.
- Add animations and gestures.
- Copy patterns from UI examples.