我有一个GraphQL服务器,托管在express上.我想通过发回nodejs缓冲区对象将图像返回给客户端.如何配置graphql server,返回字节,而不是json?我不希望通过base64这样做,因为图像很大.
只是想知道我们是否可以在react-native中使用CSS动画和转换?即
<Image style={animateImage} / >
StyleSheet.create({
animateImage {
width: 100px;
height: 100px;
background: red;
transition: width 3s;
transition-delay: 1s;
}
});
Run Code Online (Sandbox Code Playgroud) 我正在尝试模拟我的 graphql 服务器,以便当我查询时,它返回模拟数据而不是转到 graphql 服务器。当我对模拟 graphql 运行查询时,我收到了这个错误:
"errors":[{"message":"Syntax Error GraphQL request (1:13) Expected $, found Name
\"input\"\n\n1: query login(input: {userName: \"james\" , passWord: \"password\"}
这是我目前的设置:
询问
let query = `query login(input: {userName: "james" , passWord: "password"}){
login(input: {userName: "james" , passWord: "password"})
}`;
Run Code Online (Sandbox Code Playgroud)
架构
const typeDefs = `
type loginCrendentialsType {
data: String
}
input loginInputType{
userName: String!
passWord: String!
}
type RootQuery {
login(input: loginInputType): [loginCrendentialsType]
}
schema {
query: RootQuery
}
`;
Run Code Online (Sandbox Code Playgroud)
嘲笑
const mocks = {
login: …Run Code Online (Sandbox Code Playgroud) 出于某种原因,我的 allEmployees 无状态组件没有被呈现,我不知道为什么。我收到以下警告:
标签employeesData上的未知道具<allEmployees>。从元素中移除这个道具。
容器
class employeeListPage extends React.Component {
constructor(props) {
super(props);
this.state = {
employees : {}
};
}
render(){
return(
<div>
<allEmployees employeesData = {this.props.employees} />
</div>
)
}
}
function mapStateToProps(state, ownProps){
return{
employees: state.employees
}
}
function mapDispatchToProps(dispatch){
return {
employeeActions : bindActionCreators(employeeActions, dispatch)
};
}
export default connect(mapStateToProps, mapDispatchToProps )(employeeListPage);
Run Code Online (Sandbox Code Playgroud)
allEmployees 组件
const allEmployees = (props) => (
<div>
<table>
<thead>
<tr>
<th>Employee Number</th>
<th>Employee Full Name</th>
<th>Active Employee</th>
<th>Origin</th> …Run Code Online (Sandbox Code Playgroud)