Giter Site home page Giter Site logo

wuba / taro-react-native Goto Github PK

View Code? Open in Web Editor NEW

This project forked from nervjs/taro

93.0 8.0 12.0 453.06 MB

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5 等应用。 https://taro.jd.com/

Home Page: https://taro-docs.jd.com/

License: MIT License

JavaScript 38.89% HTML 0.74% CSS 0.38% TypeScript 59.28% Vue 0.03% SCSS 0.65% Less 0.01% Sass 0.01% Stylus 0.01% Shell 0.01%

taro-react-native's Introduction

Taro

开放式跨端跨框架解决方案,轻松构建可以运行在 小程序/Web/APP 上的应用

PRs Welcome GitHub contributors GitHub commit activity GitHub closed issues GitHub commits since latest release (by date) GitHub Release Date

简体中文 | English

👽 Taro['tɑ:roʊ],泰罗·奥特曼,宇宙警备队总教官,实力最强的奥特曼。

目录

  1. 简介
  2. 学习资源
  3. 社区共享
  4. 使用案例
  5. 特性介绍
  6. 加入共建
  7. 问题反馈与建议
  8. 特别鸣谢
  9. 贡献者们
  10. 开发计划
  11. 更新日志
  12. 开发交流

简介

开放式跨端跨框架解决方案,支持使用 React/Vue/Nerv 等框架来开发微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等应用。现如今市面上端的形态多种多样,Web、React Native、微信小程序等各种端大行其道,当业务要求同时在不同的端都要求有所表现的时候,针对不同的端去编写多套代码的成本显然非常高,这时候只编写一套代码就能够适配到多端的能力就显得极为需要

版本迁移

Taro 1/2 迁移至 Taro 3,请阅读《Taro 版本升级权威指南》

学习资源

5 分钟上手 Taro 开发

awesome-taro

掘金小册:Taro 多端开发实现原理与实战

社区共享

Taro 物料市场——让每一个轮子产生价值

UI 库

名称 地址 介绍 支持的框架 支持的 Taro 版本
taro-ui https://taro-ui.jd.com/#/ 一套基于 Taro 框架开发的多端 UI 组件库 React Taro 1/2/3 (Taro 3 需要安装 alpha 版本)
NutUI https://nutui.jd.com/#/ 京东风格的轻量级移动端 Vue 组件库 Vue3 Taro 3
taroify https://taroify.gitee.io/taroify.com/introduce/ 轻量、可靠的小程序端 Taro 组件库(Vant 的 Taro 版本) React Taro 3
@antmjs/vantui https://antmjs.github.io/vantui/#/home 基于有赞 VantWeapp 开发的同时支持 Taro 和 React 的 UI 库 React Taro 3
Tard https://tard-ui.selling.cn/ 一套基于Taro框架开发的多端React UI组件库 React Taro 3

使用案例

Taro 已经投入了我们的生产环境中使用,业界也在广泛地使用 Taro 开发多端应用。

征集更多优秀案例

特性介绍

跨框架支持

React/Nerv 支持

在 Taro 3 中可以使用完整的 React/Nerv 开发体验,具体请参考基础教程——React

代码示例

import React, { Component } from 'react'
import { View, Text } from '@tarojs/components'

export default class Index extends Component {
  state = {
    msg: 'Hello World! '
  }
  
  componentWillUnmount () { }

  componentDidShow () { }

  componentDidHide () { }

  render () {
    return (
      <View className='index'>
        <Text>{this.state.msg}</Text>
      </View>
    )
  }
}

Vue 支持

在 Taro 3 中可以使用完整的 Vue 开发体验,具体请参考基础教程——Vue

代码示例

<template>
  <view class="index">
    <text>{{msg}}</text>
  </view>
</template>

<script>
export default {
  data () {
    return {
      msg: 'Hello World!'
    }
  },
  created () {},
  onShow () {},
  onHide () {}
}
</script>

多端转换支持

Taro 方案的初心就是为了打造一个多端开发的解决方案。

目前 Taro 3 可以支持转换到微信/京东/百度/支付宝/字节跳动/ QQ 小程序/H5/React Native 等端。

加入共建

加入 Taro 社区共建倡议

Taro 邀你加入社区共建

为 Taro 贡献代码

Taro 非常欢迎社区开发者为 Taro 贡献代码,在贡献之前请先阅读贡献指南

如果你想为 Taro 实现一个重要功能,需要先撰写 RFC 文档,按照 Taro 的RFC 机制进行操作,在经过社区讨论完善后才可以进行代码的提交。

问题反馈与建议

给 Taro 提 ISSUE

强烈推荐阅读 《提问的智慧》《如何向开源社区提问题》《如何有效地报告 Bug》《如何向开源项目提交无法解答的问题》,更好的问题更容易获得帮助。

Let's fund issues in this repository

特别鸣谢

nanjingboy jsNewbee Qiyu8 Garfield550
nanjingboy jsNewbee Qiyu8 Garfield Lee

贡献者们

开发计划

Milestones

更新日志

本项目遵从 Angular Style Commit Message Conventions,更新日志请查阅 Release

开发交流

官方交流微信群

License

MIT License

Copyright (c) O2Team

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

taro-react-native's People

Contributors

advancedcat avatar bigmeow avatar biorz avatar bless-l avatar caidingxian avatar chant-lee avatar chen-jj avatar cncolder avatar dependabot-preview[bot] avatar fjc0k avatar garfield550 avatar honlyhuang avatar ichengbo avatar jinjinjin0731 avatar js-newbee avatar littly avatar luckyadam avatar manjiz avatar nanjingboy avatar pines-cheng avatar qiyu8 avatar shinken008 avatar simbachen avatar springhgui avatar symind avatar yechunxi avatar yuche avatar zacksleo avatar zakarycode avatar zhiqingchen avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

taro-react-native's Issues

Video组件onPlay事件重复触发

问题描述

Video组件,onPlay事件会在播放时重复触发

期望

onPlay事件仅在播放开始时触发一次(对比微信小程序)

复现代码

<Video
  src='https://f.video.weibocdn.com/Y6kGr4x5lx07KVKOn68w010412005o0b0E010.mp4?label=mp4_ld&template=360x640.24.0&trans_finger=81b11b8c5ffb62d33ceb3244bdd17e7b&ori=0&ps=1BVp4ysnknHVZu&Expires=1615200805&ssig=ABkh9gnMX9&KID=unistore,video'
  poster="https://tukuimg.bdstatic.com/processed/59dfed09b5efe57cdc0f3b7c4d2b2d2f.jpeg@s_0,w_660,h_370,q_80,f_webp"
  onPlay={this.onPlay}
  objectFit='contain'
  id='video'
/>

Video组件设置autoplay、loop属性问题

问题描述

Video组件设置autoplay=false, loop=true,视频播放结束后不会自动循环播放

期望

autoplay=false, loop=true时,视频播放结束后应该会自动循环播放

复现代码

<Video
  src='http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400'
  controls={true}
  autoplay={false}
  id='video'
  loop={true}
/>

提供打包自动化方案

问题描述

用户在使用 Taro 开发 APP 时,经常会配到各类环境问题,且难以解决,开发人员也难以提供帮助。

解决方案

todo

metro 相关 lib 升级至 0.64

问题描述

metro 相关依赖,目前落后主版本较多

解决方案

升级至较新的版本

  1. 注意与各个版本之间的兼容情况。0.57,0.63,0.64

CustomWrapper 组件支持

问题描述

error: Error: Unable to resolve module `@tarojs/components-rn/dist/components/CustomWrapper` from `src/taro-ui/components/grid/index.js`: @tarojs/components-rn/dist/components/CustomWrapper could not be found within the project.

3.0新增的CustomWrapper,3.2可能还没有补全。这个组件在RN里,跟Block或者Fragment应该是一样作用的

相关代码: NervJS@4148d4a

解决方案

方案同 RN 里的Block。

Video组件showCenterPlayBtn属性问题

问题描述

Video组件,showCenterPlayBtn为false时,视频底部的播放控件未显示

期望

showCenterPlayBtn为false时,视频底部的播放控件依旧显示(对比微信小程序)

复现代码

<Video
  src='http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400'
  controls
  showCenterPlayBtn={false}
  id='video'
/>

Taro.getCurrentPages()没有page.options

问题描述

Taro-RN,使用 Taro.getCurrentPages() 获取当前页面实例,参数跟其他端没保持一致。能拿到 page.route ,但是拿不到page.options。
node_modules/@tarojs/taro/types/api/framework/index.d.ts里面关于Taro.Page的定义虽然没options,但是实际小程序端是有的。

期望

期望跟小程序同步,加上page.options数据

提供修改接口的方案

问题描述

怎么修改@tarojs/taro中的方法? 例如修改 Taro.chooseImage 的逻辑。直接修改 Taro.chooseImage = XXX 不行。

解决方案

todo

  1. 可考虑将按需加载的配置提供出来,供业务进行配置。

CameraContext对象调用takePhoto有较大概率失败

问题描述

createCameraContext 创建的CameraContext对象,调用takePhoto有较大概率失败,严重影响用户体验

期望

调用takePhoto能成功

复现代码

try{
  this.cameraContext.takePhoto({
    quality: 'high',
    success: res => {
      const {tempImagePath} = res;
      this.setState({
        imageSrc: tempImagePath
      });
    },
    fail: res => alert('拍照失败:'+JSON.stringify(res))
  })
}catch(err){
  alert('出错:'+JSON.stringify(err))
}

提供跨端通用的 iconfont 解决方案

问题描述

NervJS#8180 (comment)

在小程序、h5中使用字体图标是比较简单的,直接下载iconfont的项目通过引用css即可,在rn端好像这样并不行,看你们提供的示例都没有带iconfont, 想问下有没有能适合rn和小程序端通用的字体图标方案呢?

解决方案

todo

加速计事件监听和绑定问题

问题描述

加速计API,事件监听和绑定有顺序关系,但是监听和绑定应该是分离的;

期望

无论是监听后绑定事件,还是监听前绑定事件,事件都应该生效;
支持绑定多个事件,同一个事件绑定多次,则认为是多个事件;
参考陀螺仪实现。

Video组件initialTime设置无效

问题描述

Video组件,设置initialTime后,视频没有从指定时间开始播放

期望

置initialTime后,视频应该从指定时间开始播放

复现代码

<Video
  src='http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400'
  autoplay
  initialTime={20}
  id='video'
/>

Video组件onFullscreenChange事件重复触发

问题描述

Video组件在全屏播放时,onFullscreenChange事件会触发2次

期望

每次全屏播放时,onFullscreenChange事件仅触发一次

复现代码

onEnded = (e) => {
  alert('onEnded:'+JSON.stringify(e))
}
onFullscreenChange = (e) => {
  this.count++;
  alert('onFullscreenChange'+this.count)
  console.log('onFullscreenChange', e)
}
<Video
  src='http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400'
  autoplay
  controls
  poster="https://tukuimg.bdstatic.com/processed/59dfed09b5efe57cdc0f3b7c4d2b2d2f.jpeg@s_0,w_660,h_370,q_80,f_webp"
  onEnded={this.onEnded}
  onFullscreenChange={this.onFullscreenChange}
  objectFit='contain'
  id='video'
/>

Video组件ios退出全屏时播放暂停

问题描述

Video组件,ios在全屏状态下视频播放中,退出全屏时,视频播放会自动暂停(安卓不会)

期望

全屏播放时,退出全屏不影响播放状态

复现代码

<Video
  src='http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400'
  controls
  id='video'
/>

Button组件,hoverStartTime属性无效

问题描述

表单组件 - Button,hoverStartTime设置为2秒,但是实际上轻轻按下就会立即出现点击态

期望

hoverStartTime设置为2秒时,按下按钮2秒后才会出现点击态

复现代码

<Button
    type="primary"
    hoverStartTime={2000}
    hoverStyle={{ backgroundColor: 'blue' }}
>
    点我看看
</Button>

完善测试用例

问题描述

仍有较多组件及api,无测试用例覆盖

todo 列表梳理

解决方案

增加测试用例覆盖

视频API requestFullScreen调用未生效

问题描述

1、点击播放按钮,会如下报错误;
image

2、ios点击“进入全屏”, requestFullScreen调用无效;安卓点击全屏,视频会断断续续播放,且不会进入全屏状态;

期望

requestFullScreen可正常全屏视频;视频播放不会报错;

复现代码

import React, { Component } from 'react'
import Taro from '@tarojs/taro'
import { Video, View, Button, Text } from '@tarojs/components'
import './index.scss'

export default class Index extends Component {

  constructor(props){
    super(props)
    this.state = {
      count: 0
    }
  }

  videoContext
  count = 0

  fullScreen = () => {
    this?.videoContext?.requestFullScreen();
    console.log('fullScreen');
  }

  render () {
    return (
      <View>
        <View className='test-item'>
          <View className='components-page'>
              <View className='test-item'>
              <View className="test-block-hd">
                <Text className="test-block-hd__text"> —— 视频组件测试 —— </Text>
              </View>

              <View className="test-block-bd">
                <View className='components-page'>
                <Text className="bug-title">问题:initialTime设置无效</Text>
                  <Video
                    src='http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400'
                    autoplay
                    initialTime={20000}
                    id='video'
                  />
                  <View className='control-list'>
                    <Button type="primary" onClick={this.fullScreen}>进入全屏</Button>
                  </View>
                </View>
              </View>    
            </View>
          </View>
        </View>
      </View>
    )
  }
}

Video组件onPause事件不会触发

问题描述

Video组件在暂停视频时,onPause事件不会触发

期望

onPause事件在视频暂停时触发

复现代码

<Video
  src='http://wxsnsdy.tc.qq.com/105/20210/snsdyvideodownload?filekey=30280201010421301f0201690402534804102ca905ce620b1241b726bc41dcff44e00204012882540400&bizid=1023&hy=SH&fileparam=302c020101042530230204136ffd93020457e3c4ff02024ef202031e8d7f02030f42400204045a320a0201000400'
  autoplay
  controls
  poster="https://tukuimg.bdstatic.com/processed/59dfed09b5efe57cdc0f3b7c4d2b2d2f.jpeg@s_0,w_660,h_370,q_80,f_webp"
  onPause={this.onPause}
  objectFit='contain'
  id='video'
/>

createCameraContext首次调用返回undefined

问题描述

APP重新加载后,第一次调用API createCameraContext,返回的内容总是undefined

期望

调用createCameraContext,返回一个CameraContext对象

复现代码

this.cameraContext = Taro.createCameraContext()

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.