小编BIl*_*omo的帖子

未生成 Hermes 源图以进行本机反应

我正在使用 Windows 11 并尝试在使用命令进行调试时生成 React Native TypeScript SourceMapyarn create-env --staging && react-native run-android --variant=stagingDebug --appIdSuffix=staging

我希望在 处生成打字稿源映射android/app/build/sourcemap,但该文件夹不存在。我在https://reactnative.dev/docs/next/sourcemaps#:~:text=Source%20maps%20are%20disabled%20by,React%20Native%20code%20and%20images%22.&text=sh-上有以下文档,如果%20done%20正确%20%2D%20you%20may%20see%20的%20output%20location%20,map%20期间%20Metro%20build%20output

将 build.gradle 更新为android/app/build.gradle如下值

project.ext.react = [
    enableHermes: true,  // clean and rebuild if changing
    bundleInStaging: true,  
    bundleInRelease: true,
    hermesFlagsRelease: ["-O", "-output-source-map"],
    hermesFlagsDebug: ["-O", "-output-source-map"],
    // entryFile: "index.js",
    // bundleInPre: true
]
Run Code Online (Sandbox Code Playgroud)

但仍然没有作品。

android reactjs react-native

6
推荐指数
0
解决办法
866
查看次数

Redux 存储在分派后不更新

我试图在渲染之前获取我的组件加载数据,所以我使用 componentWillMount 来调度我的 getTransaction() 操作和结果成功(我将 redux-logger 作为中间件来了解成功或失败)。问题是我的 redux 商店没有得到更新。我需要这些数据作为道具传递给子组件。主要问题是在Transaction.js 这是我的代码

事务.js

import React from "react";
import { connect } from "react-redux"
import { withRouter } from 'react-router-dom';

import { getAuthenticatedUsername } from '../../utils/authorization'
import Layout from "./../layout/Index"
import Table from "../../components/table/Table"

import { getTransaction } from "../../actions/transactionActions"

import "./styles.scss"

function mapStateToProps(state){
  return {
    transaction: state.transaction
  }
}
class Transaction extends React.Component {

  componentWillMount() {
    this.props.dispatch(getTransaction());
  }

  render() {
    console.log(this.props);//transaction not get updated, only get initial state from transactionActions
    return …
Run Code Online (Sandbox Code Playgroud)

reactjs react-redux

1
推荐指数
1
解决办法
7256
查看次数

标签 统计

reactjs ×2

android ×1

react-native ×1

react-redux ×1