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

create-react-once-app

v0.0.2

Published

React Native template for a quick start with React Once.

Downloads

6

Readme

React Once

⚠️ This is pre-release stuff, and while it may be a good starting off point, it doesn't have the easy upgradability that I might like to add if people are interested. There may be bloat left over from years of updating this codebase (going back 6 years), but that too can be fixed if there's interest.

Learn once, Write once, Use Everywhere, React Once

What it is

React Once is an open example of universal, "write once, run everywhere" using React (Native) syntax and libraries. It runs native on all platforms it currently supports, and showcases many packages working--ones useful in starting a project too.

TLDR

🧰 Web support and full Next/SSR benefits

📱 iOS support

🖥 macOS support

🏄‍♀️ Very streamlined Redux

🔍 Flow type checking

🌐 Multi-language support

🔏 Example code including auth

📸 Custom icon examples

⚠️ I have not tested it on android yet, fyi

Purpose

I think in the long run, naming "React Native" what it's called was a mistake. It's made it seem too separate from React in my experience with other devs and companies. The mantra of "learn once, write anywhere" was very important as it set realistic goals for the time. It's let us use this declarative UI framework on web and mobile for the past 7 years, whereas if they'd tried to make it work universally since day one it'd either have the same downsides as other "write once" libraries that use web views, or taken ages to be released.

Installation

This repo helps in initializing a template. It's a cli tool in the vein of create-react-app. Important: after running the create command below, create a .env file containing API_HOST=http://localhost:3001. This will let you run with the mock API.

npx create-react-once-app my-app
cd my-app
npm run dev

And as standard on iOS:

cd ios
pod install
cd ..

And then use npm run ios or open it in XCode to run. To run on macOS you must also do it in XCode as I haven't added a script for that yet. See below for notes on M1 (which I use with success).

Source code

The source code is located here (https://gitlab.com/NoahGray/react-once-template/-/tree/main/template), and all tickets can be found there, or added there.

Routing

Because we use react-navigation for "Native" (oops I called it native) and next for web/SSR, we use expo-next-react-navigation for most links. But that doesn't mean we still don't have to maintain a src/pages folder for Next's routing and react-navigation in App.js. With smart coding, this is not too hard. The docs of expo-next-react-navigation should show how similar it is to react-navigation, but it means understanding Next's file/folder based routing.

Redux / State management

In this app kit, a great deal of Redux boilerplate is taken care of using ApiClient.js which adds authentication to requests, and adds a minimal but powerful client for REST requests (promises-based) to each Redux action so they can be written in just a few lines. Look under src/store for implementation, and src/store/modules for examples of reducers (which if you replicate, add to reducers.js).

Installation on M1 macsOS ~11.2

Development is screaming fast on the M1 Macs. However, there is mixed success getting Cocoapods working with pod install. The method I used to get around this is to do pod install like so cd ios && arch -x86_64 pod install. This does NOT force you to use Rosetta (at least it doesn't seem to) for XCode and everything else too. It seems to make great use of the M1 and is extremely fast and never turns on the fans. Version 1.11.0 of Cocoapods is planned to fix this issue and perhaps install natively on M1 which will be a slightly smoother install and maybe even somehow faster, if that's possible.