如何在React Native中不使用'this'关键字的情况下访问元素的属性?我有一个与父类本身绑定为“ this”的函数,但我想访问被单击元素的属性。这是代码-
import {Circle} from 'react-native-svg';
export default App extends Component {
constructor(props) {
super(props);
this.state = {activeX: null}
}
handleTouch(event) {
const x = event.target.cx; //How to access "cx" property here?
this.setState({ activeX: x });
}
render() {
return (
<Circle cx='10' cy='10' r='5' onPress={this.handleTouch.bind(this)}/>
<Circle cx='20' cy='20' r='5' onPress={this.handleTouch.bind(this)}/>
);
}
}
Run Code Online (Sandbox Code Playgroud) 身份验证后,地球引擎 API 通过 Initialize() 函数成功与服务器连接。
import ee
ee.Initialize()
Run Code Online (Sandbox Code Playgroud)
但是,一旦我开始使用代理服务器,初始化就会失败并生成以下错误。
TimeoutError: [WinError 10060] A connection attempt failed because the
connected party did not properly respond after a period of time, or
established connection failed because connected host has failed to respond
Run Code Online (Sandbox Code Playgroud)
我尝试过修改IPython笔记本服务器环境
import os
os.environ['HTTP_PROXY'] = 'my_proxy_id:proxy_port'
os.environ['HTTPS_PROXY'] = 'my_proxy_id:proxy_port'
Run Code Online (Sandbox Code Playgroud)
ee 库仍然无法与服务器连接。如何更新代理设置?