我正在尝试从需要添加源的react native BackgroundImage添加背景图像source={require('*--iamge path --*')}
但是我的 eslint throw Require 语句不是 import 语句的一部分。错误。我尝试以不同的方式导入图像,例如:
- const image = '--image path--'
- import image = require('--image path--')
- <BackgroundImage source={require('--image path--')}>
Run Code Online (Sandbox Code Playgroud) 在我的 graphQL API(带有打字稿和 type-graphql)中,我试图运行一个突变,其中inputType的枚举值定义如下
export enum GenderType {
female = 'female',
male = 'male',
}
registerEnumType(GenderType, {
name: 'GenderType',
});
Run Code Online (Sandbox Code Playgroud)
我正在尝试执行此更改。
mutation {
registerStudent(data: {
name: "John",
gender: "male",
}) {
id
}
}
Run Code Online (Sandbox Code Playgroud)
但是当我尝试执行突变时,它给出了一个错误说
"message": "Enum "GenderType" 不能代表非枚举值:"female"。你的意思是枚举值是 "female" 还是 "male"?,
我认为这是因为我如何在type-graphql 中使用 registerEnumType 定义枚举类型。
我正在尝试使用AWS EC2实例来测试我的ML项目。在包安装过程中TensorFlow每次都会被kill掉。
我使用 AWS 试用 EC2t2.micro类型实例进行测试。
t2.micro11GBUbuntu Server 20.04 LTS (HVM), SSD Volume Type对此有什么解决办法吗?
它成功加载index.html,没有js错误,但是没有任何内容呈现到页面上。网页上没有任何内容。它仅在我检查网页时显示标签。我有一个名为“列表”的组件。
list.js
import React, { Component } from "react";
class list extends Component {
render() {
return (
<div>
<h1>Hello</h1>
<h1>Hello</h1>
</div>
);
}
}
export default list;
Run Code Online (Sandbox Code Playgroud)
我在App.js上导入了它
import React, { Component } from "react";
import "./App.css";
import list from "./components/list";
class App extends Component {
render() {
return (
<div className="App">
<list />
</div>
);
}
}
export default App;
Run Code Online (Sandbox Code Playgroud)
我正在使用create react app,我需要将prop值分配给组件的样式。在这种情况下,需要将背景图片“ url”作为样式的道具传递。
index.js
import React from "react";
import ReactDOM from "react-dom";
import Background from "./background";
import "./styles.css";
function App() {
return (
<div className="App">
<Background source="./assets/image.jpg" />
</div>
);
}
const rootElement = document.getElementById("root");
ReactDOM.render(<App />, rootElement);
Run Code Online (Sandbox Code Playgroud)
background.js
import React from "react";
const styles = {
backgroundImage: "url()"
};
export default class Background extends React.Component {
render() {
return <div style={styles.background} />;
}
}
Run Code Online (Sandbox Code Playgroud)
在下面的链接中找到代码: codcodesandbox示例
我正在使用 react-native 0.61 并且有两个文件。正如您在下面看到的,我将位置从 FethcLocation.js 传递到 app.js 文件并将其分配为位置对象。然后我将其传递给 userMaps.js 文件并将其分配给经度和纬度值。但我收到一个错误说...
警告:失败的道具类型:提供给,预期
region.latitude的类型的 道具无效。stringMapViewnumber
获取位置.js
import React from 'react';
import {View} from 'react-native';
navigator.geolocation = require('@react-native-community/geolocation');
class FetchLocation extends React.Component {
componentDidMount() {
navigator.geolocation.getCurrentPosition(
position => {
this.props.setLocation(position);
},
error => {
console.log(error);
},
{enableHighAccuracy: false, timeout: 20000, maximumAge: 10000},
);
}
render() {
return <View></View>;
}
}
export default FetchLocation;
Run Code Online (Sandbox Code Playgroud)
应用程序.js
import React from 'react';
import {Button} from 'react-native';
import FetchLocation from './components/FetchLocation';
import UserMaps from …Run Code Online (Sandbox Code Playgroud) reactjs ×3
react-native ×2
amazon-ec2 ×1
css ×1
enums ×1
eslint ×1
graphql ×1
javascript ×1
typegraphql ×1
typescript ×1