小编Dav*_*olz的帖子

元素类型无效:在 React Native 项目中需要一个字符串(对于内置组件)或一个类/函数(对于复合组件)

我正在构建一个反应本机项目,我收到以下错误:

错误:元素类型无效:需要一个字符串(对于内置组件)或一个类/函数(对于复合组件),但得到:对象。您可能忘记从定义它的文件中导出组件,或者您可能混淆了默认导入和命名导入。

检查 的渲染方法SignInScreen

这是我的代码。

import React from 'react';

import { View,Image,StyleSheet,useWindowDimensions } from 'react-native';

import Logo from'../../../assetss/images/logo.png';

import CustomInput from '../../components/CustomInput';

const SignInScreen =  () => {


     const {height} = useWindowDimensions();

    return (
        <View style= {styles.root}>
          <Image source={Logo} style ={[styles.logo, {height: height * 0.3}]}
           resizeMode="contain" /> 
          <CustomInput />
       </View>
 );
};

const styles = StyleSheet.create({
   root: {
        alignItems: 'center',
        padding: 20,
    },

   logo:{
    width: 1000,
    maxWidth: 1100,
    maxHeight: 200 ,
   }
})


export default SignInScreen 
Run Code Online (Sandbox Code Playgroud)

react-native

43
推荐指数
3
解决办法
23万
查看次数

2022年世博会推送通知图标如何处理?

根据文档,您需要做的就是在 app.json 中设置一些键

在托管工作流程中,在 app.json 中设置 notification.icon 和 notification.color 键,重建您的应用程序,然后就可以开始了!

对于裸工作流程和 EAS Build 用户,您需要配置插件部分:

"plugins": [
      [
        "expo-notifications",
        {
          "icon": "./local/assets/notification-icon.png",
          "color": "#ffffff",
          "sounds": [
            "./local/assets/notification-sound.wav",
            "./local/assets/notification-sound-other.wav"
          ]
        }
      ]
    ]
Run Code Online (Sandbox Code Playgroud)

唯一的问题是这些解决方案都不起作用,我认为问题可能出在图标上,因为文档还说:

对于您的通知图标,请确保遵循 Google 的设计指南(图标必须为全白色且背景透明),否则可能无法按预期显示。

因此,我尝试使用资产文件夹中的标准 expo Adaptive-icon.png,它与推送通知中显示为图标的 expo 徽标不同,但它不起作用。有人可以告诉我该怎么做吗?这是我的 app.json

{
  "expo": {
    "name": "my-app",
    "slug": "my-app",
    "version": "1.0.0",
    "orientation": "portrait",
    "privacy": "unlisted",
    "icon": "./assets/adaptive-icon.png",
    "userInterfaceStyle": "light",
    "splash": {
      "image": "./assets/splash.png",
      "resizeMode": "contain",
      "backgroundColor": "#C3F458"
    },
    "updates": {
      "fallbackToCacheTimeout": 0
    },
    "assetBundlePatterns": ["**/*"],
    "ios": {
      "supportsTablet": true,
      "config": { …
Run Code Online (Sandbox Code Playgroud)

android push-notification ios react-native expo

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

Pandas 分析导入错误:无法从“markupsafe”导入名称“soft_unicode”

我在开始进行 pandas 分析时遇到问题。

我尝试加载 pandas 分析,但安装时弹出此错误:

错误:pip 的依赖项解析器当前未考虑所有已安装的软件包。此行为是以下依赖性冲突的根源。anaconda-project 0.9.1 需要 ruamel-yaml,但未安装。sphinx 4.0.1 需要 MarkupSafe<2.0,但您有 markupsafe 2.1.1,这是不兼容的。

我尝试通过安装早期版本来修复它。但是,如果我按照指示安装低于 2.0 的 MarkupSafe 版本,则会收到以下错误:

pandas-profiling 3.2.0 需要 markupsafe~=2.1.1,但你有 markupsafe 2.0.1,这是不兼容的

现在,如果我只是尝试使用 pandas 分析,我会收到错误:

无法从“markupsafe”导入名称“soft_unicode”

这是我使用的代码:

from pandas_profiling import ProfileReport
import pandas as pd

df = pd.read_excel("WBNAME", sheetname = None)
prof = ProfileReport(df)
prof.to_file(output_file='output.html') 
Run Code Online (Sandbox Code Playgroud)

我到底应该做什么才能使用 pandas 分析?

python profiling pandas

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

[Vue Router warn]:推送/替换状态类型错误错误:历史记录[(中间值)(中间值)(中间值)]不是函数

我正在尝试设置 vue 路由器(Vue 3 + Vue 路由器 4),但我不断收到以下错误:

[Vue Router warn]: Error with push/replace State TypeError: history[(intermediate value)(intermediate value)(intermediate value)] is not a function

[Vue Router warn]: Unexpected error when starting the router: TypeError: Cannot read properties of null (reading 'back')

Uncaught TypeError: Cannot read properties of null (reading 'back')
Run Code Online (Sandbox Code Playgroud)

这是我的 main.ts:

import { createApp } from "vue";
import App from "./App.vue";
import store, { storeKey } from "./store/index";

// styling
import "./scss/base.scss";
import router from "./router";

createApp(App).use(router).use(store, storeKey).mount("#app");
Run Code Online (Sandbox Code Playgroud)

这是我的 …

typescript vue.js vue-router

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

selenium.common.exceptions.WebDriverException:消息:未知错误:net::ERR_CONNECTION_REFUSED

我正在使用硒。我的应用程序显示错误页面。它抛出以下错误:

    raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.WebDriverException: Message: unknown error: net::ERR_CONNECTION_REFUSED
  (Session info: chrome=104.0.5112.102)
Stacktrace:
Run Code Online (Sandbox Code Playgroud)

这是我的代码

    from selenium import webdriver 

driver = webdriver.Chrome('C:path/in/the/pc/chromedriver_win32/chromedriver.exe')    ## to initialize the webdriver to the Selenium 
driver.get('http://127.0.0.1:5000/base')
Run Code Online (Sandbox Code Playgroud)

我该如何解决上述错误?

selenium selenium-webdriver

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

无法预编译 StatsPlots.jl

这可能与thisthis相关。但是,建议的解决方案都不适合我。

\n

我正在使用带有 Julia 扩展的 VSCode,并且在 Jupyter 笔记本中运行所有内容。我的第一个单元格如下所示。

\n
using Distributions\nusing StatsBase\nusing CSV\nusing DataFrames\nusing HypothesisTests\nusing Plots\nusing GLM\nusing StatsPlots\n
Run Code Online (Sandbox Code Playgroud)\n

执行单元会产生以下错误。

\n
ailed to precompile StatsPlots [f3b207a7-027a-5e70-b257-86293d7955fd] to /home/david/.julia/compiled/v1.7/StatsPlots/jl_27z7QU.\n\nStacktrace:\n  [1] compilecache(pkg::Base.PkgId, path::String, internal_stderr::IO, internal_stdout::IO, ignore_loaded_modules::Bool)\n    @ Base ./loading.jl:1466\n  [2] compilecache(pkg::Base.PkgId, path::String)\n    @ Base ./loading.jl:1410\n  [3] _require(pkg::Base.PkgId)\n    @ Base ./loading.jl:1120\n  [4] require(uuidkey::Base.PkgId)\n    @ Base ./loading.jl:1013\n  [5] require(into::Module, mod::Symbol)\n    @ Base ./loading.jl:997\n  [6] eval\n    @ ./boot.jl:373 [inlined]\n  [7] include_string(mapexpr::typeof(REPL.softscope), mod::Module, code::String, filename::String)\n    @ Base ./loading.jl:1196\n  [8] #invokelatest#2\n    @ ./essentials.jl:716 [inlined]\n …
Run Code Online (Sandbox Code Playgroud)

julia julia-plots

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

来自 Pressable TypeScript 错误的自定义 TouchableOpacity

有这个自定义 TouchableOpacity 函数组件,但对于 style prop 我收到了 TS 错误

\n
import { StyleSheet, Pressable, PressableProps, GestureResponderEvent } from 'react-native';\n\nexport default function TouchableOpacity(props: PressableProps) {\n  const { style, onPress, children } = props;\n\n  return (\n    <Pressable\n      onPress={(event: GestureResponderEvent) => {\n        onPress?.(event);\n      }}\n      style={({ pressed }) => [style, pressed ? styles.buttonPressedOpacity : null]}>\n      {children}\n    </Pressable>\n  );\n}\n\nconst styles = StyleSheet.create({\n  buttonPressedOpacity: {\n    opacity: 0.5,\n  },\n});\n
Run Code Online (Sandbox Code Playgroud)\n

以下是完整的 TS 投诉:

\n
\n

TS2322: 类型 '({ pressable}: PressableStateCallbackType) =>\n(StyleProp | ((state: PressableStateCallbackType) =>\nStyleProp<...>) | { ...; …

typescript react-native touchableopacity pressable

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