Skip to content

Taro3.6.30 react-native上 使用react-redux的页面无法触发componentDidShow #16858

@Slngle

Description

@Slngle

相关平台

React Native

使用框架: React

复现步骤

import { Component } from 'react'

import { View } from '@tarojs/components'

import { connect } from 'react-redux'

@connect(({ userInfo }) => ({

realName: userInfo.realName,

}))

export default class MyPage extends Component {

componentDidMount() {

console.log('componentDidMount')

}

componentDidShow() {

console.log('componentDidShow')

}

render() {

const { realName } = this.props

return <View className="MyPage">{realName}</View>

}
}

期望结果

控制台打出 componentDidMount componentDidShow

实际结果

只打出 componentDidMount

环境信息

👽 Taro v3.6.30


  Taro CLI 3.6.30 environment info:
    System:
      OS: macOS 14.4.1
      Shell: 5.9 - /bin/zsh
    Binaries:
      Node: 18.20.3 - ~/.nvm/versions/node/v18.20.3/bin/node
      Yarn: 1.22.22 - ~/.nvm/versions/node/v18.20.3/bin/yarn
      npm: 10.7.0 - ~/.nvm/versions/node/v18.20.3/bin/npm
    npmPackages:
      @tarojs/cli: 3.6.30 => 3.6.30 
      @tarojs/components: 3.6.30 => 3.6.30 
      @tarojs/helper: 3.6.30 => 3.6.30 
      @tarojs/mini-runner: 3.6.30 => 3.6.30 
      @tarojs/plugin-framework-react: 3.6.30 => 3.6.30 
      @tarojs/plugin-platform-alipay: 3.6.30 => 3.6.30 
      @tarojs/plugin-platform-h5: 3.6.30 => 3.6.30 
      @tarojs/plugin-platform-jd: 3.6.30 => 3.6.30 
      @tarojs/plugin-platform-qq: 3.6.30 => 3.6.30 
      @tarojs/plugin-platform-swan: 3.6.30 => 3.6.30 
      @tarojs/plugin-platform-tt: 3.6.30 => 3.6.30 
      @tarojs/plugin-platform-weapp: 3.6.30 => 3.6.30 
      @tarojs/react: 3.6.30 => 3.6.30 
      @tarojs/rn-runner: 3.6.30 => 3.6.30 
      @tarojs/rn-supporter: 3.6.30 => 3.6.30 
      @tarojs/runtime: 3.6.30 => 3.6.30 
      @tarojs/runtime-rn: 3.6.30 => 3.6.30 
      @tarojs/shared: 3.6.30 => 3.6.30 
      @tarojs/taro: 3.6.30 => 3.6.30 
      @tarojs/taro-loader: 3.6.30 => 3.6.30 
      @tarojs/taro-rn: 3.6.30 => 3.6.30 
      @tarojs/webpack5-runner: 3.6.30 => 3.6.30 
      babel-preset-taro: 3.6.30 => 3.6.30 
      eslint-config-taro: 3.6.30 => 3.6.30 
      expo: ~47.0.3 => 47.0.14 
      react: ^18.1.0 => 18.3.1 
      react-native: ^0.70.1 => 0.70.15 

补充信息

猜测是高阶产生的问题被react-redux重写。但是里面taro本身react-native实现componentDIdShow可能也用的是高阶

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions