一般问题.我正在使用React Native开发一个应用程序,并且某些操作会将我的应用程序带到大约500MB的RAM,通常会被杀死.
我在网上搜索了关于RN内存分析的好材料,但没有找到任何结果.我已经尝试过使用Instruments,但它的输出并没有让我对我的内存消耗过程有什么了解.
TL; DR:你有一个很好的方法来分析React Native中的内存使用情况吗?
PS目前专注于iOS.
提前致谢!
乌里
问题:当使用我的应用程序进行类型检查时,tsc
我收到npm link
ed 模块错误。
这是我的类型检查命令:
"type-check": "tsc --noEmit -p tsconfig.json"
这是我的tsconfig.json
:
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": false,
"allowJs": true,
"module": "commonjs",
"target": "es6",
"jsx": "react",
"esModuleInterop": true,
"experimentalDecorators": true,
"skipLibCheck": true
//"importsNotUsedAsValues": "error"
},
"exclude": ["./node_modules/*"] // I've also tried node_modules, /node_modules, node_modules/
}
Run Code Online (Sandbox Code Playgroud)
由于通过 npm 链接连接的我的 node_modules 之一中的类型错误,该命令将失败。
任何从类型检查中排除此模块的方法
编辑:
我也尝试过使用双 globstar ( **
) 例如
{
"compilerOptions": {
"outDir": "./dist/",
"sourceMap": true,
"noImplicitAny": false,
"allowJs": true,
"module": "commonjs",
"target": …
Run Code Online (Sandbox Code Playgroud) 我在用着@storybook/react v6.1.21
。我希望可以选择使用state
和setState
道具将状态传递给我的故事。
这就是我定义装饰器的方式:
//preview.js
export const decorators = [
Story => {
const [state, setState] = useState();
return <Story state={state} setState={setState} />;
}
];
// mycomponent.stories.tsx
export const TwoButtons = ({ state, setState }) => (
<ButtonGroup
buttons={[
{ label: 'One',value: 'one'},
{ label: 'Two', value: 'two' }
]}
selectedButton={state}
onClick={val => setState(val)}
/>
);
Run Code Online (Sandbox Code Playgroud)
但由于某种原因,state 和 setState 在故事中没有定义。我在 Storybook v5 中也有类似的设置。
知道我缺少什么吗?
复制应用程序:https://github.com/uriklar/turborepo-lib-dep-lib-repro
我正在使用 Turborepo 的基本示例(nextjs 应用程序 + ui 库)
我想添加一个额外的 ui 库并让我的 ui 库依赖它。
// packages/ui/Button.tsx
import * as React from "react";
import { Button as AnotherButton} from "anotherui"
export const Button = () => {
return <><button>Boop</button><AnotherButton/></>;
};
Run Code Online (Sandbox Code Playgroud)
我anotherui
在包目录中创建了库并将其添加为依赖项,ui
如下所示:
{
"name": "ui",
"version": "0.0.0",
"main": "./index.tsx",
"types": "./index.tsx",
"license": "MIT",
"dependencies": {
"anotherui": "workspace:*"
},
"devDependencies": {
"@types/react": "^17.0.37",
"@types/react-dom": "^17.0.11",
"tsconfig": "workspace:*",
"config": "workspace:*",
"typescript": "^4.5.3"
}
}
Run Code Online (Sandbox Code Playgroud)
当我尝试构建应用程序(从web
消耗)时,我收到以下错误:Button
ui
web:build: …
Run Code Online (Sandbox Code Playgroud) 我datatable
在c#中运行LINQ查询.
我想选择特定的列而不是整行,并将结果输入a datatable
.我怎样才能做到这一点??
我的代码:
public DataTable getConversions(string c_to, string p_to)
{
var query = from r in matrix.AsEnumerable()
where r.Field<string>("c_to") == c_to &&
r.Field<string>("p_to") == p_to
select r;
DataTable conversions = query.CopyToDataTable();
Run Code Online (Sandbox Code Playgroud) 我正在使用Cloudfront发行版作为我的Heroku服务器的代理.为什么?出于这些目的.
无论如何,我的应用程序有一个强制ssl规则.当我转到我的cloudfront网址时,原点是我的heroku app url,我得到301重定向到原点,而不是作为别名.
我做过的一些事情:
起初我有一个错误说"request could not be satisfied"
,所以我将原始协议策略更改为仅HTTP.
然后,我有一个重定向循环,所以在研究后我发现它是由主机头传入引起的,所以我删除了转发头.
现在我得到301重定向.我怎么能阻止它?我应该看什么配置?
Appreaciate任何想法.很高兴提供任何其他信息.
我正在尝试根据react-native-code-push文档的这一部分配置我的RN android项目
我的build.gradle文件具有以下配置:
buildTypes {
debug {
}
releaseStaging {
buildConfigField "String", "CODEPUSH_KEY", CODEPUSH_KEY_STAGING
}
release {
buildConfigField "String", "CODEPUSH_KEY", CODEPUSH_KEY_PRODUCTION
minifyEnabled enableProguardInReleaseBuilds
proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
signingConfig signingConfigs.release
}
}
Run Code Online (Sandbox Code Playgroud)
但当我跑: react-native run-android --variant releaseStaging
我收到错误: Task 'installReleaseStagingDebug' not found in root project 'MyAppName'.
也试过跑 react-native run-android --configuration releaseStaging
这给了我一个稍好的错误:
Task 'installReleaseStaging' not found in root project 'MyAppName'. Some candidates are: 'uninstallReleaseStaging'.
Run Code Online (Sandbox Code Playgroud)
知道我错过了什么吗?
谢谢!
乌里
android staging react-native code-push react-native-code-push
我正在尝试创建一个带有白色背景的圆形反应原生,我有一个问题,在边框的轮廓上可以看到圆圈的背景颜色.
看看这个游乐场应用程序:https: //rnplay.org/apps/TsQ-CA
如果你仔细观察,你会发现圆圈周围有一条细黑线.这就像边界不覆盖整个背景.
这是圆圈样式:
circle: {
borderRadius: 40,
width: 80,
height: 80,
borderWidth: 5,
borderColor: 'white',
backgroundColor: 'black'
}
PS这只发生在iOS上
有任何想法吗??谢谢!
我有一个要为其创建别名的节点模块。
我有以下配置:
// tsconfig.json
{
"compilerOptions": {
...
"allowJs": true,
"module": "commonjs",
"target": "es6",
"jsx": "react",
"esModuleInterop": true,
"experimentalDecorators": true,
"baseUrl": "./",
"moduleResolution": "node",
"paths": {
"@my-lib/*": [
"node_modules/my-lib/src/Components/*"
]
}
},
"exclude": ["node_modules"]
}
// webpack.config.js
resolve: {
extensions: ['.js', '.jsx', '.tsx', '.ts'],
alias: {
'@my-lib': path.resolve(
'./node_modules/my-lib/src/Components'
),
}
},
// eslintrc.json
"settings": {
"import/parsers": {
"@typescript-eslint/parser": [".ts", ".tsx"]
},
"import/resolver": {
"typescript": {},
"alias": {
"map": [
[
"@my-lib",
"./node_modules/my-lib/src/Components"
]
],
"extensions": [".js", ".jsx", ".ts", ".tsx"] …
Run Code Online (Sandbox Code Playgroud) 在 sanity.io 的富文本编辑器(便携式文本)中,是否可以选择将文本(以及图像)与中心对齐?在文档中找不到任何内容