npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

@barelyhuman/preact-native

v0.1.1-beta.11

Published

> **Warning**: This is an experimental approach at creating a renderer for > preact

Downloads

18

Readme

preact-native

Warning: This is an experimental approach at creating a renderer for preact

Note: untill this reaches v1.0.0, the entire featureset might change, since we are still figuring out what works best

I wouldn't really recommend using this for production but putting down the base usage setup so that anyone who'd wish to help with development can at least get a test environment ready.

Install

$ npm install @barelyhuman/preact-native preact

Usage

  1. Setup a base react native project using npx react-native init
  2. Change index.js to include the withPreact from the library
/**
 * @format
 */
import { AppRegistry } from 'react-native'
import App from './App'
import { name as appName } from './app.json'
import { withPreact } from '@barelyhuman/preact-native'

AppRegistry.registerComponent(appName, () => withPreact(App))
  1. Then add the following to the top of the App.js file
/** @jsxImportSource preact */
import { SafeAreaView, View, Text, TextInput } from '@barelyhuman/preact-native'
  1. Once the above is setup, you can just go ahead and write preact components as usual.

Note: instead of preact/hooks please use @preact/signals for the time being, once fixed this note will be removed

Eg:

/** @jsxImportSource preact */
import { SafeAreaView, View, Text } from '@barelyhuman/preact-native'

export default function App() {
  return <Home />
}

function Home() {
  return (
    <>
      <SafeAreaView>
        <View>
          <Text color={'red'}>Hello</Text>
        </View>
      </SafeAreaView>
    </>
  )
}

Note: All react related stuff (react as a dep and render tree needing react) will be removed from the library once I can handle creation of all these native modules manually without having to re-write the entire react native base from scratch

Roadmap

  • [x] A minimal dom
  • [x] Create views from the bridge instead of rendering with react
    • [x] Create native views (Views created on the iOS and Android platform APIs)
    • [x] Create derived views (Views created on top of the above by manipulating the SDK)
  • [x] Update view styles from the bridge
  • [x] Update text nodes from the bridge
  • [x] Add compat for preact to make it possible for preact to diff and render without the need for a react tree generator import {render} from "preact-native/dom"
  • [ ] Handle events (presses, input, gestures) , aka events from preact will be on the DOM, need to be proxied as events to the Native SDK
  • [x] Handling for Bridge level style props

Contribute

read the CONTRIBUTING.md

Why ?

It seemed like a nice project to try out my limits in terms of complicated stuff and also because I got bored of building websites. Also, I personally think preact has become a lot more stable and has less breaking changes every 3 versions thus making it easier to maintain and upgrade older projects.

License

MIT © reaper