我有一个组件,它的大小接收道具.道具可以是字符串或数字ex:"LARGE"
或17
.
我可以让React.PropTypes知道这可以是propTypes验证中的一个或另一个吗?
如果我没有指定类型,我会收到警告: prop type `size` is invalid; it must be a function, usually from React.PropTypes.
MyComponent.propTypes = {
size: React.PropTypes
}
Run Code Online (Sandbox Code Playgroud) ESLint是否可以忽略整个目录的一个特定规则?
就我而言,我想忽略import/prefer-default-export
一个名为的目录commonComponents
我正在尝试将我的springboot
教程项目与CircleCi 集成.
我的项目位于Github存储库内的子目录中,我从CircleCi得到以下错误.
目标需要执行项目,但此目录中没有POM(/ home/circleci/recipe).请验证您是否从正确的目录中调用了Maven.
我无法弄清楚如何告诉circle-ci我的项目在一个子目录中.我尝试了几件事,以及试图cd
进入"食谱",但它不起作用,甚至感觉不对.
这是我的项目的结构:
Spring-tutorials
|
+-- projectA
|
+-- recipe
| | +--pom.xml
Run Code Online (Sandbox Code Playgroud)
这是我的 config.yml
# Java Maven CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-java/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/openjdk:8-jdk
# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/postgres:9.4
working_directory: ~/recipe
environment:
# …
Run Code Online (Sandbox Code Playgroud) 在React-native 0.39中,
我经常遇到这个错误,但我真的不明白为什么(我知道我没有设置flexGrow ......).
这是控制台的错误
View was rendered with explicitly set width/height but with a 0 flexBasis. (This might be fixed by changing flex: to flexGrow:) View: <RCTShadowView: 0x6080005a02a0; viewName: RCTView; reactTag: 2608; frame: {{0, 0}, {nan, nan}}>
Run Code Online (Sandbox Code Playgroud)
有人可以向我解释为什么会触发此错误吗?
编辑:错误来自我在主视图中添加的这个样板代码:
flex: 1,
// remove width and height to override fixed static size
width: null,
height: null,
Run Code Online (Sandbox Code Playgroud)
但是,如果有人可以阐明反应原生的风格或引导我获得良好的资源,我将不胜感激:)
过了一会儿,使用WebStorm,当我尝试重命名文件夹或文件时,我在Rename
弹出窗口中收到此错误.
java.io.IOException : com.intellij.openapi.vcs.VcsException: No administrative area found under /Users/[Name]/..../[ProjectName]
要解决这个问题,我必须使用Invalidate Caches and restart...
选项,但不是很方便.
谁能解释一下发生了什么?
我正在尝试为我的项目设置命名约定。
我有一些变量snake_case
,我希望 ESLint 警告我,例如:
const { order_id } = req.params;
Run Code Online (Sandbox Code Playgroud)
我删除typescript-eslint/camelcase
了它,因为它已被弃用并尝试为布尔值设置naming-convention
和添加新error
规则。
'@typescript-eslint/naming-convention': [
'error',
{
selector: 'variable',
types: ['boolean'],
format: ['PascalCase'],
prefix: ['is', 'should', 'has', 'can', 'did', 'will'],
},
],
Run Code Online (Sandbox Code Playgroud)
如何为snake_case
变量添加警告?
我正在尝试使用Expo
和制作一些组件的演示应用程序react-native
。(或者我也可以使用常规React-Native
)
我的问题是我无法导入演示应用程序之外的文件
这是我的结构
|-- Components/
| |-- libs
| |-- node_modules
| |-- index.js
| |-- package.json
| |-- demo/
| | |-- node_modules
| | |-- App.js
| | |-- package.json
在的内部demo/App.js
,我试图从上层目录导入我的组件之一,但是没有运气。所有组件都在./index.js中导出
在的内部App.js
,我尝试了:
import {MyComponent} from 'Components'
,import {MyComponent} from '../index'
或,import {MyComponent} from '../../Components/'
但似乎没有任何作用。
我遇到以下类型的错误 Directory /Users/kevin/web/myprojects/Components/index doesn't exist
我究竟做错了什么 ?
我正在尝试与建立一个React-Native
项目lerna
。当我尝试运行时jest
,遇到以下错误。
The name `setupDevtools` was looked up in the Haste module map. It cannot be resolved, because there exists several different files, or packages, that provide a module for that particular name and platform. The platform is generic (no extension). You must delete or blacklist files until there remains only one of these:
* `/Users/kevin.amiranoff/project/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)
* `/Users/kevin.amiranoff/project/packages/App/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)
* `/Users/kevin.amiranoff/project/packages/App-exceptions/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)
* `/Users/kevin.amiranoff/project/packages/App-signin/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)
* `/Users/kevin.amiranoff/project/packages/App-ui/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)
* `/Users/kevin.amiranoff/project/packages/App-utils/node_modules/react-native/Libraries/Core/Devtools/setupDevtools.js` (module)
Run Code Online (Sandbox Code Playgroud)
这是jest
我的根目录下的配置 …
这里是 Java 初学者,
我正在尝试定义我的模型以使用 Spring 访问 Mongodb 数据库中的数据。
我想将性别定义为枚举,在数据库中,值存储为字符串:male
或female
但我收到以下错误:
No enum constant com.nemeantalestudios.mythology.models.Gender.male
这是我的POJO图:
@Getter
@Setter
@Document(collection = "figures")
public class Figure {
@Id
public String id;
public String name;
public String greekName;
public String romanName;
public String description;
public String category;
public String immortal;
public Gender gender;
}
Run Code Online (Sandbox Code Playgroud)
这是我的性别枚举:
public enum Gender {
MALE("male"),
FEMALE("female");
private final String text;
Gender(final String text) {
this.text = text;
}
@Override
public String toString() {
return text;
} …
Run Code Online (Sandbox Code Playgroud) 我想ToggleButton
在Android studio中添加一个设计模式.
我的目标是API级别28 targetSdkVersion 28
我的ToggleButton没有显示,我看到了这个错误:
java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed
这是xml
ToggleButton的内容
<ToggleButton
android:text="ToggleButton"
android:layout_width="100dp"
android:layout_height="100dp" tools:layout_editor_absoluteY="369dp"
tools:layout_editor_absoluteX="133dp" android:id="@+id/toggleButton5" android:textOff="OFF"
android:textOn="ON" android:textColor="@color/colorAccent" style="@style/AlertDialog.AppCompat"
tools:text="Hello" android:typeface="normal" android:textStyle="bold" android:textAlignment="center"
/>
Run Code Online (Sandbox Code Playgroud)
显然在API 26中不推荐使用clipRect(RectF rect,Region.Op op),但我不确定需要更改什么?
这是完整的堆栈跟踪:
java.lang.IllegalArgumentException: Invalid Region.Op - only INTERSECT and DIFFERENCE are allowed
at android.graphics.Canvas.checkValidClipOp(Canvas.java:779)
at android.graphics.Canvas.clipRect(Canvas.java:826)
at android.view.ViewGroup_Delegate.drawShadow(ViewGroup_Delegate.java:86)
at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:58)
at android.view.ViewGroup.drawChild(ViewGroup.java:4333)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4112)
at android.support.constraint.ConstraintLayout.dispatchDraw(ConstraintLayout.java:2023)
at android.view.View.draw_Original(View.java:20075)
at android.view.View_Delegate.draw(View_Delegate.java:68)
at android.view.View.draw(View.java:19849)
at android.view.ViewGroup.drawChild_Original(ViewGroup.java:4333)
at android.view.ViewGroup_Delegate.drawChild(ViewGroup_Delegate.java:63)
at android.view.ViewGroup.drawChild(ViewGroup.java:4333) …
Run Code Online (Sandbox Code Playgroud) react-native ×3
eslint ×2
android ×1
circleci ×1
import ×1
java ×1
javascript ×1
jestjs ×1
lerna ×1
mongodb ×1
node-modules ×1
reactjs ×1
spring-boot ×1
typescript ×1
webstorm ×1