我想使用 flatlist 在 React Native 中添加一些间距,但目前看来比应有的更困难。
事实证明,React Native 不支持gap属性,这使得事情变得非常复杂。
我通过使项目变宽来解决水平间距,49.5%这意味着我有1%水平空间,现在我如何对垂直间距做同样的事情?
最重要的是,我如何确保水平和垂直“间隙”相等。
const renderItem = ({ item }) => (
<Pressable onPress={() => alert(item.name)} style={{
aspectRatio: 1,
width: "49.5%",
position: "relative",
}}>
<Image
style={{
width: "100%",
height: "100%"
}}
source={{
uri: item.url,
}}
/>
<View
style={{
position: "absolute",
zIndex: 3,
bottom: 0,
paddingHorizontal: 2,
paddingVertical: 8,
flexDirection: "row",
// justifyContent: "center",
alignItems: "center",
}}
>
<Text style={{ color: "white", fontSize: 16 }}>{item.name}</Text>
</View>
</Pressable> …Run Code Online (Sandbox Code Playgroud) 我正在努力找出如何设置每个用户可以上传到我的应用程序存储的存储限制。
我找到了在线方法Storage.storageLimitInBytes,但我在 Firebase 文档中甚至没有看到此方法,更不用说如何设置它的说明了。
一般来说,初创公司如何监控用户上传图像的次数,他们在用户文档中是否有一个字段,例如amountOfImagesUploaded:每次用户上传图像时我都会增加该计数,这样我就可以看到谁以这种方式滥用存储。
或者我是否需要类似的文档来跟踪用户每天上传的内容,当计数达到 100 或其他值时,然后对该用户采取行动。
对于我面临的这个问题,我非常感谢您的帮助。
升级到最新版本的 MUI 后,我注意到当我将变量设置为 时,MUI 按钮无法正常工作contained。
<div className="flex">
<Button variant="contained" color="primary" fullWidth>
Add
</Button>
<Button variant="contained" color="secondary" fullWidth>
remove
</Button>
<Button variant="outlined" color="secondary" fullWidth>
remove
</Button>
</div>
Run Code Online (Sandbox Code Playgroud)
正如您在示例中看到的,我的主题颜色没有任何问题,因为outlined按钮按预期工作。
我也在使用 tailwindcss,但我认为这根本不应该与它相关。
编辑:
检查按钮元素后,我发现这@tailwind base导致了此问题。
在这种情况下,我认为我需要@tailwind base顺风公用事业,我该怎么办?
我已经按照官方的firebase应用程序检查安装教程进行操作:
https://firebase.google.com/docs/app-check/web/recaptcha-enterprise-provider
我只收到错误。
const appCheck = initializeAppCheck(firebaseApp, {
provider: new ReCaptchaEnterpriseProvider(
"my_recaptcha_key_here"
),
isTokenAutoRefreshEnabled: true, // Set to true to allow auto-refresh.
});
Run Code Online (Sandbox Code Playgroud)
根据教程,这就是您需要做的。
结果:
无法从 firestore 访问任何内容,我得到:
@firebase/app-check: FirebaseError: AppCheck: ReCAPTCHA error. (appCheck/recaptcha-error).
Run Code Online (Sandbox Code Playgroud)
上传到存储时,我得到:
@firebase/app-check: FirebaseError: AppCheck: Fetch server returned an HTTP error status. HTTP status: 403. (appCheck/fetch-status-error).
Run Code Online (Sandbox Code Playgroud)
为什么会出现这种情况,我已经完成了教程中的所有步骤?
javascript recaptcha google-cloud-storage google-cloud-firestore firebase-app-check
我在下一个 js 应用程序上遇到此错误,我什至不知道它的原因或来源,因为引发错误的代码甚至不是我编写的。
error - file:///Users/cheq/Desktop/cheqo/node_modules/framer-motion/dist/es/components/AnimatePresence/use-presence.mjs:1
import { useContext, useId, useEffect } from 'react';
^^^^^
SyntaxError: Named export 'useId' not found. The requested module 'react' is a CommonJS module, which may not support all module.exports as named exports.
CommonJS modules can always be imported via the default export, for example using:
import pkg from 'react';
const { useContext, useId, useEffect } = pkg;
Run Code Online (Sandbox Code Playgroud)
当我从成帧器运动导入任何内容时,出现此错误,这是我的完整代码:
import React from 'react';
import { motion } from 'framer-motion';
function motionpage() {
return (
<> …Run Code Online (Sandbox Code Playgroud) 可以使用 firebase firestore 进行测试吗?我一直在遵循测试教程,并且测试对其他人有用但对我不起作用。
\n我的组件代码在客户端中工作,所以我很困惑为什么会收到此错误。
\n我只找到了有关在 firebase 中测试安全规则的信息,但没有找到有关 firestore 的信息,这是否意味着它是我们唯一可以测试的东西?
\n这是我得到的错误:
\n FIRESTORE (9.6.1) INTERNAL ASSERTION FAILED: Unexpected state\n\n at fail (node_modules/@firebase/firestore/src/util/assert.ts:40:9)\n at hardAssert (node_modules/@firebase/firestore/src/util/assert.ts:54:5)\n at fromBytes (node_modules/@firebase/firestore/src/remote/serializer.ts:252:5)\n at fromWatchChange (node_modules/@firebase/firestore/src/remote/serializer.ts:475:25)\n at PersistentListenStream.onMessage (node_modules/@firebase/firestore/src/remote/persistent_stream.ts:642:25)\n at node_modules/@firebase/firestore/src/remote/persistent_stream.ts:517:21\n at node_modules/@firebase/firestore/src/remote/persistent_stream.ts:570:18\n at node_modules/@firebase/firestore/src/util/async_queue_impl.ts:135:7\n at node_modules/@firebase/firestore/src/util/async_queue_impl.ts:186:14\n\n\xe2\x97\x8f if the user is fetched, the name is shown\n\n Unable to find an element with the text: /James/i. This could be because the text is broken up by multiple elements. In this case, …Run Code Online (Sandbox Code Playgroud) 我迷失了,因为我不知道为什么我被要求创建一个本地开发构建来在 ios 模拟器中运行我的 expo 应用程序,因为我从来不需要构建来运行它。
我只是简单地运行命令npm start,然后按i打开我的 ios 模拟器,而没有遇到任何问题,但由于某种原因,现在我被要求首先在设备上安装开发版本。
这是错误:
Opening on iOS...
CommandError: No development build (com.checka.myappnative) for this project is installed. Please make and install a development build on the device first.
Run Code Online (Sandbox Code Playgroud)
我的问题是为什么我不能像往常一样简单地运行我的 ios 模拟器,发生了什么变化?
reactjs ×3
firebase ×2
javascript ×2
react-native ×2
css ×1
expo ×1
flexbox ×1
jestjs ×1
material-ui ×1
next.js ×1
recaptcha ×1
security ×1
tailwind-css ×1
unit-testing ×1