小编Mic*_*hem的帖子

我如何解构 {this.props.children}?

我想为我的移动应用程序添加背景,但是当我使用“this.props.children”时,eslint 说我“必须使用解构道具分配”。为什么我可以解构这个道具?

这是我的代码,

export default class WallPaper extends Component {
  render() {
    return (
      <ImageBackground
        source={backgroundimg}
        imageStyle={{ opacity: 0.9 }}
        style={styles.container}
      >
        {this.props.children}
      </ImageBackground>
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

当我使用此代码时

export default class WallPaper extends Component {
  render() {
    const { children } = this.props;
    return (
      <ImageBackground
        source={backgroundimg}
        imageStyle={{ opacity: 0.9 }}
        style={styles.container}
      >
        {children}
      </ImageBackground>
    );
  }
}
Run Code Online (Sandbox Code Playgroud)

我有这个错误“道具验证中缺少‘儿童’” 错误

当我使用此代码时,

export default class WallPaper extends Component {
  render() {
     (this.props) => {
    return (
      <ImageBackground
        source={backgroundimg}
        imageStyle={{ opacity: 0.9 }} …
Run Code Online (Sandbox Code Playgroud)

javascript destructuring node.js reactjs react-native

7
推荐指数
2
解决办法
4872
查看次数

Rotate text using pdfbox

I'm trying to rotate text using pdfbox by I couldn't achieve it. I tried to set the texMatrix but my text is not rotating as intended.

Does someone have an idea of how I could turn at 90 degrees my text?

This is my code :

contentStream.beginText();

 float tx = titleWidth / 2;
 float ty = titleHeight / 2;

contentStream.setTextMatrix(Matrix.getTranslateInstance(tx, ty)); 
contentStream.setTextMatrix(Matrix.getRotateInstance(Math.toRadians(90),tx,ty));
contentStream.setTextMatrix(Matrix.getTranslateInstance(-tx, -ty));

 contentStream.newLineAtOffset(xPos, yPos);

contentStream.setFont(font, fontSize);
contentStream.showText("Tets");
contentStream.endText();
Run Code Online (Sandbox Code Playgroud)

Thank You

java pdfbox

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

为什么图标按钮不居中?

我正在开发 Flutter 应用程序,但我不明白为什么我的图标按钮不在页面中间居中。我把我的代码包裹在一个Center()

这是我的页面:

https://imgur.com/a/YlCW3Xu

这是我的代码:

import "package:flutter/material.dart";
import 'package:font_awesome_flutter/font_awesome_flutter.dart';

class LogInScreen extends StatefulWidget {
  @override
  _LogInScreenState createState() => new _LogInScreenState();
}

class _LogInScreenState extends State<LogInScreen> {
  String _email, _password;
  @override
  Widget build(BuildContext context) {
    return new Scaffold(
      body: Center(
          child: ListView(
        children: <Widget>[
          Column(children: <Widget>[
            new Container(
              padding: (EdgeInsets.only(top: 50)),
              child: Text(
                "Sign In",
                style: TextStyle(
                  fontSize: 40,
                ),
              ),
            ),
            new Container(
                padding: (EdgeInsets.only(top: 50, left: 35, right: 35)),
                child: Column(children: <Widget>[
                  new Form(
                      child: new Column(children: …
Run Code Online (Sandbox Code Playgroud)

user-interface flutter

5
推荐指数
2
解决办法
1万
查看次数

我们如何在React Navigation V3中使用bottomTabNavigator进行滑动

我正在使用 React navigation V3,我想在我的 BottomTabNavigator 中使用滑动。我不能这样做,因为 createBottomTabNavigator 还不支持它,并且 createBottomNavigator 实际上已被弃用。这很烦人,因为在 React navigation V2 中我们可以很容易地做到这一点。只是 createMaterialTopTabNavigator 支持滑动,但我想要一个底部导航器而不是顶部导航器

react-navigation

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

当我运行我的传奇时,我有这个错误“错误:调用:参数 [对象对象] 不是函数”

当我的动作创建者触发 mi saga 时,我有错误

"Error: call: argument [object Object] is not a function
    at check (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:126468:13)
    at getFnCallDesc (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:127645:22)
    at call (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:127658:25)
    at loginRequestSaga$ (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:128869:38)
    at tryCatch (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:21519:19)
    at Generator.invoke [as _invoke] (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:21694:24)
    at Generator.prototype.(anonymous function) [as next] (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:21562:23)
    at next (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:127025:29)
    at proc (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:127000:5)
    at runForkEffect (blob:file:///95bb5b45-c4c5-44db-9d56-d4dcee551ace:127241:21)"
Run Code Online (Sandbox Code Playgroud)

我正在运行 react native 0.57 和最新版本的 redux saga

这是我的传奇

import { put, call, select } from 'redux-saga/effects';
import { userServices } from '../../services';
import { userActions } from '../actions';
import { userConstants } …
Run Code Online (Sandbox Code Playgroud)

react-native redux redux-saga

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

我应该使用express-graphql还是appolo-server-graphql

我正在开发一个使用 graphql ajd 的 Express 后端,我不知道是否需要使用 express-graphql 或 appolo-server-graphql 库。感谢您的帮助!

graphql express-graphql

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