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

@wakeapp/taro-components-react

v1.0.16

Published

惟客宝 Taro React 组件库,基于 @tarojs/components,主要用于解决兼容性问题

Downloads

11

Readme

@wakeda/taro-components-react

Taro 组件库(React 版本)。

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

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

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

使用方法

1. 设置项目配置 h5.useHtmlComponents

// config/index.js
module.exports = {
  h5: {
    // 注意:暂时关闭,等所有组件迁移过来之后开启
    useHtmlComponents: true,
    // 设置 alias
    webpackChain(config) {
      config.resolve.alias.set(
        '@tarojs/components$',
        '@wakeda/taro-components-react/index'
      );
      console.log(config.resolve.alias);
    },
  },
};

改造方法

目前只适配了 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
# 完成后重新刷新浏览器即可