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

@harrysong/components-react

v10.5.2

Published

Taro 组件库(React 版本)。

Downloads

7

Readme

@harrysong/components-react

Taro 组件库(React 版本)。

@harrysong/components 使用了基于 Web ComponentsStencil 框架进行开发,于部分手机会出现兼容性问题:

  • 多行文字截断失效
  • 部分安卓机(OV居多),样式 visibility 切换失败导致页面白屏

因此开发者可以使用此包对 React 框架的 H5 组件库进行替代,来提高兼容性。

使用方法

Taro 项目

本特性还没发布,需要 link 到本地使用。

1. 下载 Taro 仓库,切换分支

git clone https://github.com/NervJS/taro.git
cd taro
git checkout components-compat

2. 安装、编译

yarn
yarn run bootstrap
yarn run build

3. 把相关依赖 link 到全局

cd packages/taro-webpack-runner
npm link
cd ../packages/taro-loader
npm link
cd ../packages/taro-components-react
npm link

项目

1. 设置项目配置 h5.useHtmlComponents

// config/index.js
module.exports = {
  h5: {
    useHtmlComponents: true
  }
}

2. 把相关依赖 link 到本地

npm link @harrysong/webpack-runner
npm link @harrysong/taro-loader
npm link @harrysong/components-react

3. 开始编译

taro build --type h5 --watch

改造方法

目前只适配了 ViewTextSwiper 组件,开发者可以根据使用到的组件按以下改造方法进行适配:

拷贝 Taro v2 的对应组件,进行修改

这里拷贝 Taro2 的对应组件到 taro/packages/taro-components-react/src/components 目录下。

组件需要修改的地方有:

  1. Nerv 相关的引用修改为 react
  2. 文件改为 .tsx,增加 Typings(可选)

修改引用入口、rollup 配置

在入口文件增加组件的导出:

// taro-components/react/index
export { xxxx } from './dist/xxx'

修改 rollup 配置,添加 input:

// taro-components/rollup.config.js
export default {
  input: {
    'xxx/index': 'src/components/xxx/index.[jsx|tsx]'
  }
}

编译组件库

cd taro/packages/taro-components-react
npm run dev
# 完成后重新刷新浏览器即可