我正在使用react-navigation和 stack-navigator 来管理我的屏幕。
我正在使用的平台:
我有一个屏幕,它充当模态形式,但它实际上是一个全屏。为什么“作为模态形式”的部分很重要?那是因为它是一种带有一些选项和透明背景颜色的模态菜单。
如您所见,在第二个示例中,背景颜色被完全替换,或者之前加载的组件被卸载,因此我想要达到的效果丢失了。 这个想法是能够像任何其他屏幕一样导航到这个屏幕。
如果使用 react-navigation 无法完成,我可以采取什么其他方式来完成?
该组件执行操作(redux),因为它是一个跨应用程序组件并在内部封装了许多机制和逻辑,这就是为什么我不能将它用作PureComponent使用此组件的中继。至少,使这个组件成为 PureComponent 将迫使我在许多其他组件中复制许多机制和逻辑。
为了这个问题,也为了避免问题太大,两个屏幕的风格完全相同,但推动的一个StackNavigation取代了backgroundColor,或者卸载了以前的屏幕。
这是我到目前为止所拥有的:
//PlaylistSelector.js
render() {
//Just a full size empty screen to check and avoid bugs
//Using red instead of transparent, works
return (
<View style={{ flex: 1, backgroundColor: 'transparent' }}>
</View>
);
}
//Navigator.js
import { StackNavigator } from 'react-navigation';
import Album from './Album'; //This is …Run Code Online (Sandbox Code Playgroud) javascript android react-native react-navigation stack-navigator
我正在尝试开始使用 Uniswap V3。作为示例,我采用了最基本的用例:给定 X 数量的 ETH,将其交换为 DAI。不幸的是,我无法让它发挥作用。
已经有一个非常相似的问题(没有答案),但略有不同,因为代码看起来不像我的。
我正在使用 Hardhat 分叉主网,然后将 Remix 连接到localhost:8545
npx hardhat node --fork https://mainnet.infura.io/v3/{MY_API_KEY}
Run Code Online (Sandbox Code Playgroud)
安全帽配置如下:
solidity: {
compilers: [
{
version: "0.8.7",
settings: {
optimizer: {
enabled: true,
runs: 1000,
}
}
}
]
}
Run Code Online (Sandbox Code Playgroud)
正如您所注意到的(完整合同位于最底部),该合同提供了 3 个应付功能:
function convertExactEthToDai() external payable;
function convertEthToExactDai(uint256 daiAmount) external payable;
function getEstimatedETHforDAI(uint daiAmount) external payable returns (uint256);
Run Code Online (Sandbox Code Playgroud)
所有这些都失败了,甚至 getEstimatedETHforDAI 也失败了,它相当简单且只读(几乎)。没有给定的理由,所以我是盲目的。当我从 Remix 执行该函数时,我只收到一个一般错误"Returned error: Error: Transaction reverted without a reason string"。当我查看安全帽控制台时,我看到以下错误:
eth_sendTransaction
Contract call: <UnrecognizedContract> …Run Code Online (Sandbox Code Playgroud) 当我尝试使用 Jest模拟react-native-sound 时,出现以下错误:
//PlayerService.js
import Sound from 'react-native-sound';
try {
console.log('Sound: ' + JSON.stringify(Sound)); //Sound: {}
_trackPlaying = new Sound('path', Sound.LIBRARY, error => { });
} catch (error) {
console.log('error: ' + JSON.stringify(error)); //error: {}
}
Run Code Online (Sandbox Code Playgroud)
//PlayerService.tests.js
jest.mock('react-native-sound', () => ({
Sound: jest.fn((path, type, callback) => {
})
}));
Run Code Online (Sandbox Code Playgroud)
// 包.json
{
"devDependencies": {
"babel-cli": "^6.26.0",
"babel-jest": "^21.2.0",
"babel-plugin-transform-flow-strip-types": "^6.22.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-flow": "^6.23.0",
"flow": "^0.2.3",
"jest": "^21.2.1"
},
"jest": {
"modulePathIgnorePatterns": [
"__mocks__/"
]
},
"dependencies": { …Run Code Online (Sandbox Code Playgroud) 我面临的问题是:
在这张图中,我想要的效果很好,因为一些属性是固定的。
现在,当我更改更长的文本时,问题就出现了。
所以,这就是我现在所拥有的:
这就是我想要的:
这是我正在使用的代码:
ReactJS 方面:
constructor(props) {
super(props);
this.state = {
checked: false
}
}
componentDidMount() {
window.addEventListener('scroll', () => {
if (event.srcElement.body.scrollTop >= 1400) {
this.setState({ checked: true });
}
});
}
render() {
return (
<div>
... stuff
<span style={{ fontSize: "40px", color: this.state.theme.COLOR_3 }}>
<input type="checkbox" id="Resume-chk" style={{ display: "none" }} checked={this.state.checked} />
<b id="Resume-title">{this.state.languageSet.RESUME}</b>
</span>
... more stuff
<div>
);
}
Run Code Online (Sandbox Code Playgroud)
CSS方面:
//This is the text
#Resume-title {
display: inline-block;
-webkit-transition: color …Run Code Online (Sandbox Code Playgroud) 我正在从事一项用 C++ 创建 MIPS 模拟器的任务。我收到
错误:'temporaries' 未命名类型
错误:'saved' 未命名类型
我只是在实现算术部分并且正在使用三个文件,main.cpp、al.cpp、al.h。
al.h
#ifndef AL_H
#define AL_H
#include<vector>
#include<string>
#include<cstdlib>
#include<iostream>
int *temporaries;
int *saved;
typedef struct
{
std::string name;
int value;
}label;
//function declarations
#endif
Run Code Online (Sandbox Code Playgroud)
主程序
#include "al.h"
#include<fstream>
std::vector<label> labels;
temporaries=malloc(10*sizeof(int));
saved=malloc(10*sizeof(int));
//main()
Run Code Online (Sandbox Code Playgroud)
cpp文件
#include "al.h"
using namespace std;
//function definitions
Run Code Online (Sandbox Code Playgroud)
我正在使用 g++
g++ al.cpp main.cpp al.h
Run Code Online (Sandbox Code Playgroud)
我只是编程的初学者。如果有人可以帮助我,那就太好了。
编辑
使用extern的头文件,并宣布在源文件中,就像稻田显示变量,它是固定的。感谢所有的帮助!
react-native ×2
reactjs ×2
android ×1
c++ ×1
css ×1
hardhat ×1
html ×1
javascript ×1
jestjs ×1
mocking ×1
remix ×1
solidity ×1
unit-testing ×1