Skip to content

Commit

Permalink
Merge branch '3.x' into fix/types
Browse files Browse the repository at this point in the history
  • Loading branch information
TheKonka authored Sep 16, 2024
2 parents 4e6c51f + 36173b8 commit 7945c38
Show file tree
Hide file tree
Showing 98 changed files with 323 additions and 144 deletions.
2 changes: 1 addition & 1 deletion crates/native_binding/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tarojs/binding",
"version": "3.6.34",
"version": "3.6.35",
"description": "Node binding for taro",
"main": "binding.js",
"typings": "binding.d.ts",
Expand Down
13 changes: 6 additions & 7 deletions examples/mini-program-example/src/pages/index/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,21 +49,20 @@ export default function Index() {
</Button>
<Button
onClick={()=>{
nativeApi.harmonyNavigateTo({
indexHtmlPath: '/spa/new/index.html',
taroPath: 'pages/performance/index/index'
Taro.navigateTo({
url: 'pages/harmony-hybrid/mix-router/home/index'
})
}}>
多实例(多SPA跳转):性能列表页
多实例及混合路由测试页
</Button>
<Button
onClick={()=>{
nativeApi.harmonyNavigateTo({
nativeApi.navigateToTaroHybrid({
indexHtmlPath: '/spa/new/index.html',
taroPath: 'pages/api/index/index'
taroPath: '/pages/index/index'
})
}}>
单实例(单SPA):接口列表页
多实例(单SPA):首页
</Button>
</View>
)
Expand Down
13 changes: 7 additions & 6 deletions examples/mini-program-example/src/util/nativeApi.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
// @ts-ignore
const decorator = window.MethodChannel && window.MethodChannel.jsBridgeMode({ isAsync: false, autoRelease: true }) || (target => target)
const sync = window.MethodChannel && window.MethodChannel.jsBridgeMode({ isAsync: false, autoRelease: true }) || (target => target)

// @proxyClassSign('')
class NativeApi {
// @ts-ignore
@decorator
harmonyNavigateTo(options: any) {
return options
}
@sync
navigateToTaroHybrid(_options: any) {}


@sync
navigateToNative(_options: any){}
}

const nativeApi = new NativeApi()
Expand Down
2 changes: 1 addition & 1 deletion npm/darwin-arm64/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tarojs/binding-darwin-arm64",
"description": "Native binding for taro",
"version": "3.6.34",
"version": "3.6.35",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/darwin-x64/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tarojs/binding-darwin-x64",
"description": "Native binding for taro",
"version": "3.6.34",
"version": "3.6.35",
"os": [
"darwin"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/linux-x64-gnu/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tarojs/binding-linux-x64-gnu",
"description": "Native binding for taro",
"version": "3.6.34",
"version": "3.6.35",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/linux-x64-musl/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tarojs/binding-linux-x64-musl",
"version": "3.6.34",
"version": "3.6.35",
"os": [
"linux"
],
Expand Down
2 changes: 1 addition & 1 deletion npm/win32-x64-msvc/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@tarojs/binding-win32-x64-msvc",
"description": "Native binding for taro",
"version": "3.6.34",
"version": "3.6.35",
"os": [
"win32"
],
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "taro",
"version": "3.6.34",
"version": "3.6.35",
"description": "开放式跨端跨框架开发解决方案",
"homepage": "https://github.com/NervJS/taro#readme",
"author": "O2Team",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-plugin-transform-react-jsx-to-rn-stylesheet",
"version": "3.6.34",
"version": "3.6.35",
"description": "Transform stylesheet selector to style in JSX Elements.",
"license": "MIT",
"main": "dist/index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-plugin-transform-taroapi/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-plugin-transform-taroapi",
"version": "3.6.34",
"version": "3.6.35",
"main": "dist/index.js",
"scripts": {
"build": "tsc",
Expand Down
2 changes: 1 addition & 1 deletion packages/babel-preset-taro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "babel-preset-taro",
"version": "3.6.34",
"version": "3.6.35",
"description": "Taro babel preset",
"author": "yuche <i@yuche.me>",
"homepage": "https://github.com/nervjs/taro/tree/master/packages/babel-preset-taro#readme",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-app/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tarojs/create-app",
"version": "3.6.34",
"version": "3.6.35",
"description": "create taro app with one command",
"author": "VincentW <Vincent.Mr.W@gmail.com>",
"homepage": "https://github.com/nervjs/taro/tree/master/packages/create-app#readme",
Expand Down
2 changes: 1 addition & 1 deletion packages/css-to-react-native/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "taro-css-to-react-native",
"description": "Convert CSS text to a React Native stylesheet object",
"version": "3.6.34",
"version": "3.6.35",
"main": "dist/index.js",
"license": "MIT",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/eslint-config-taro/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "eslint-config-taro",
"version": "3.6.34",
"version": "3.6.35",
"description": "Taro specific linting rules for ESLint",
"main": "index.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-html-transform/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postcss-html-transform",
"version": "3.6.34",
"version": "3.6.35",
"description": "transform html tag name selector",
"main": "index.js",
"author": "drchan",
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-plugin-constparse/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postcss-plugin-constparse",
"version": "3.6.34",
"version": "3.6.35",
"description": "parse constants defined in config",
"main": "index.js",
"author": "Simba",
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-pxtransform/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postcss-pxtransform",
"version": "3.6.34",
"version": "3.6.35",
"description": "PostCSS plugin px 转小程序 rpx及h5 rem 单位",
"main": "index.js",
"keywords": [
Expand Down
2 changes: 1 addition & 1 deletion packages/postcss-unit-transform/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "postcss-taro-unit-transform",
"version": "3.6.34",
"version": "3.6.35",
"description": "小程序单位转换",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/shared/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tarojs/shared",
"version": "3.6.34",
"version": "3.6.35",
"description": "Taro utils internal use.",
"author": "yuche <i@yuche.me>",
"homepage": "https://github.com/nervjs/taro/tree/master/packages/shared#readme",
Expand Down
2 changes: 1 addition & 1 deletion packages/stylelint-config-taro-rn/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "stylelint-config-taro-rn",
"version": "3.6.34",
"version": "3.6.35",
"description": "Shareable stylelint config for React Native CSS modules",
"main": "index.js",
"files": [
Expand Down
2 changes: 1 addition & 1 deletion packages/stylelint-taro-rn/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "stylelint-taro-rn",
"description": "A collection of React Native specific rules for stylelint",
"version": "3.6.34",
"version": "3.6.35",
"main": "dist/index.js",
"files": [
"dist",
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-alipay/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tarojs/plugin-platform-alipay",
"version": "3.6.34",
"version": "3.6.35",
"description": "支付宝小程序平台插件",
"author": "Chen-jj",
"homepage": "https://github.com/nervjs/taro/tree/master/packages/taro-alipay#readme",
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-api/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tarojs/api",
"version": "3.6.34",
"version": "3.6.35",
"description": "Taro common API",
"author": "yuche <i@yuche.me>",
"homepage": "https://github.com/nervjs/taro/tree/master/packages/api#readme",
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-cli-convertor/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tarojs/cli-convertor",
"version": "3.6.34",
"version": "3.6.35",
"description": "cli tool for taro-convert",
"main": "index.js",
"scripts": {
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-cli/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tarojs/cli",
"version": "3.6.34",
"version": "3.6.35",
"description": "cli tool for taro",
"main": "index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components-advanced/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tarojs/components-advanced",
"version": "3.6.34",
"version": "3.6.35",
"description": "",
"main": "dist/index.js",
"types": "dist/index.d.ts",
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components-library-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tarojs/components-library-react",
"version": "3.6.34",
"version": "3.6.35",
"description": "Taro 组件库 React 版本库",
"private": true,
"main": "index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components-library-vue2/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tarojs/components-library-vue2",
"version": "3.6.34",
"version": "3.6.35",
"description": "Taro 组件库 Vue2 版本库",
"private": true,
"main": "index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components-library-vue3/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tarojs/components-library-vue3",
"version": "3.6.34",
"version": "3.6.35",
"description": "Taro 组件库 Vue3 版本库",
"private": true,
"main": "index.js",
Expand Down
2 changes: 1 addition & 1 deletion packages/taro-components-react/package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@tarojs/components-react",
"version": "3.6.34",
"version": "3.6.35",
"description": "",
"main:h5": "src/index.js",
"main": "dist/index.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import './style/index.scss'
import classNames from 'classnames'
import React from 'react'

import { omit } from '../../utils'
import { createForwardRefComponent, omit } from '../../utils'

interface IProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'type'> {
size?: string
Expand All @@ -15,6 +15,7 @@ interface IProps extends Omit<React.ButtonHTMLAttributes<HTMLButtonElement>, 'ty
loading?: boolean
type?: string
className?: string
forwardedRef?: React.MutableRefObject<HTMLButtonElement>
}

interface IState {
Expand Down Expand Up @@ -54,6 +55,7 @@ class Button extends React.Component<IProps, IState> {
hoverStayTime = 70,
loading = false,
type,
forwardedRef,
} = this.props
const cls = classNames(
className,
Expand Down Expand Up @@ -96,8 +98,9 @@ class Button extends React.Component<IProps, IState> {

return (
<button
{...omit(this.props, ['hoverClass', 'onTouchStart', 'onTouchEnd', 'type', 'loading'])}
{...omit(this.props, ['hoverClass', 'onTouchStart', 'onTouchEnd', 'type', 'loading', 'forwardedRef'])}
type={type}
ref={forwardedRef}
className={cls}
style={style}
onClick={onClick}
Expand All @@ -114,4 +117,4 @@ class Button extends React.Component<IProps, IState> {
}
}

export default Button
export default createForwardRefComponent(Button)
9 changes: 5 additions & 4 deletions packages/taro-components-react/src/components/icon/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -3,18 +3,19 @@ import './style/index.scss'
import classNames from 'classnames'
import React from 'react'

import { omit } from '../../utils'
import { createForwardRefComponent, omit } from '../../utils'


interface IProps {
type: string
color: string
size?: number | string
className?: string
forwardedRef?: React.MutableRefObject<HTMLLIElement>
}

const Icon = (props: IProps) => {
let { type, className = '', size = '23', color } = props
let { type, className = '', size = '23', color, forwardedRef } = props
if (type) type = type.replace(/_/g, '-')
const cls = classNames(
{
Expand All @@ -25,7 +26,7 @@ const Icon = (props: IProps) => {
const style = { 'font-size': size + 'px', color: color }

return (
<i {...omit(props, ['type', 'className'])} className={cls} style={style} />
<i {...omit(props, ['type', 'className', 'forwardedRef'])} className={cls} style={style} ref={forwardedRef} />
)
}
export default Icon
export default createForwardRefComponent(Icon)
Loading

0 comments on commit 7945c38

Please sign in to comment.