小编sam*_*uel的帖子

警报安全 Github - 修复 yarn.lock/package-lock.json 中漏洞的正确方法是什么

如您所知, Dependabot 在yarn.lock或的依赖项中为我们提供了潜在的安全漏洞package-lock.json

实际上问题是,学习如何解决这个问题没有好处。如果我们搜索如何做,有很多不同的方法可以做到,有时有效,有时无效。我找到了很多关于此的主题,因为很多像我这样的人并不真正了解如何修复漏洞。

我们是否必须用正确的版本手动替换所有文件?比如npm audit fix升级包,有时候不行。如果我们确实npm install packageName出现了新的软件包版本但旧的没有消失,那么 gitHub 上的警报仍然存在。

那么yarn呢?

在这个 Github 项目https://github.com/samuel3105/react-native-animated-tabBar 中,我有这个:

在此处输入图片说明

感谢您的回答。

security github npm yarnpkg

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

世博删除权限位置

我尝试将我的应用发布到 google play 商店,但他们说我不能,因为我使用位置,但我从不使用它..

如果我制作了一个应用程序包并使用 Android Studio 打开它,我会在 Manifest 上找到它:

[...]
<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
<uses-permission android:name="android.permission.ACCESS_FINE_LOCATION" />
[...]
<uses-permission android:name="android.permission.ACCESS_BACKGROUND_LOCATION" />
[...]
Run Code Online (Sandbox Code Playgroud)

我想怎么删?以及如何知道这是在哪里使用?

我的 package.json :

"dependencies": {
    "@react-native-community/masked-view": "0.1.10",
    "@react-native-community/netinfo": "5.9.2",
    "@react-navigation/drawer": "^5.9.0",
    "@react-navigation/material-bottom-tabs": "^5.2.16",
    "@react-navigation/native": "^5.7.3",
    "@react-navigation/stack": "^5.9.0",
    "@types/react-native-snap-carousel": "^3.8.2",
    "expo": "~38.0.8",
    "expo-barcode-scanner": "~8.2.1",
    "firebase": "7.9.0",
    "react": "~16.11.0",
    "react-dom": "~16.11.0",
    "react-native": "https://github.com/expo/react-native/archive/sdk-38.0.2.tar.gz",
    "react-native-barcode-builder": "^2.0.0",
    "react-native-circular-progress": "^1.3.6",
    "react-native-gesture-handler": "~1.6.0",
    "react-native-paper": "^4.1.0",
    "react-native-reanimated": "~1.9.0",
    "react-native-safe-area-context": "~3.0.7",
    "react-native-screens": "~2.9.0",
    "react-native-snap-carousel": "^3.9.1",
    "react-native-svg": "^12.1.0"
  },
  "devDependencies": {
    "@babel/core": "^7.8.6",
    "@types/react": "~16.9.41",
    "@types/react-native": …
Run Code Online (Sandbox Code Playgroud)

permissions android typescript expo

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

在本机反应中制作滑块导航的最佳方法

我尝试在react-native中重新创建此应用程序:

在此输入图像描述

但我没有任何制作红色组件的线索。我在互联网上搜索,发现了react-navigation V5,但它看起来很复杂。

我还想创建一个水平的ScrollView,每次单击新的“页面”时,都会重新渲染所有当前视图。但这是个好办法吗?

感谢您的回答。

navigation android react-native expo

3
推荐指数
1
解决办法
6574
查看次数

在参考滚动视图上反应本机错误,但可以工作

我需要滚动到平面列表的底部,所以我使用:

const scrollViewRef = useRef();


//my scroll view
<ScrollView
    ref={scrollViewRef}
    onContentSizeChange={() => {
        scrollViewRef.current.scrollToEnd({ animated: true });
    }}

Run Code Online (Sandbox Code Playgroud)

但我得到了这些错误:

在此输入图像描述

第一个是:

No overload matches this call.
  Overload 1 of 2, '(props: Readonly<ScrollViewProps>): ScrollView', gave the following error.
    Type 'MutableRefObject<undefined>' is not assignable to type 'string | ((instance: ScrollView | null) => void) | RefObject<ScrollView> | null | undefined'.
      Type 'MutableRefObject<undefined>' is not assignable to type 'RefObject<ScrollView>'.
        Types of property 'current' are incompatible.
          Type 'undefined' is not assignable to type 'ScrollView | …
Run Code Online (Sandbox Code Playgroud)

javascript syntax-error typescript reactjs react-native

3
推荐指数
1
解决办法
4773
查看次数

React Native,全局 useState?

我有一个 Fire 类,uid如果用户未连接,则返回未定义,如果用户已连接,则返回字符串(他的 uid)。

有时我的渲染取决于此。

例如 :

const [auth, setAuth] = useState<undefined|string>(Fire.shared.uid);

[...]

<Text>{(auth == undefined) ? "not authentificated" : "great")}</Text>
Run Code Online (Sandbox Code Playgroud)

我们可以想象用户没有连接,因此文本将是not authentificated。现在他将在其他页面登录或注册,因此Fire类中的 uid 变量将发生变化。那么我应该如何改变状态值呢?

没有 useState 全局或类似的东西吗?

谢谢。

components state reactjs react-native expo

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