Javascript getTheme()本机基类型

Javascript getTheme()本机基类型,javascript,reactjs,typescript,react-native,native-base,Javascript,Reactjs,Typescript,React Native,Native Base,我正在使用此链接中描述的自定义本机基样式主题 进口: 要快速解决此问题,您只需使用any类型,如下所示: 为了正确地解决这个问题,您必须研究这两个文件 native-base-theme/variables/platform.js native-base-theme/variables/commonColor.js getTheme中的参数类型(颜色)是从platform.js中的默认导出变量推断出来的。您得到的错误意味着这两个文件中的默认导出变量不匹配。错误非常详细,以至于在我们进

我正在使用此链接中描述的自定义
本机基
样式主题

进口:

  • 要快速解决此问题,您只需使用
    any
    类型,如下所示:

  • 为了正确地解决这个问题,您必须研究这两个文件

    • native-base-theme/variables/platform.js
    • native-base-theme/variables/commonColor.js

    getTheme
    中的参数类型(颜色)是从
    platform.js
    中的默认导出变量推断出来的。您得到的错误意味着这两个文件中的默认导出变量不匹配。

    错误非常详细,以至于在我们进入重要部分之前,它就被切断了,这是缺少的属性是什么?我可以看到,您提供的变量还有151个属性,而它期望的变量有180个属性,因此可能缺少29个属性,但它们可能不是全部必需的。你能发布一个演示吗?根据您提供的内容,我不知道
    getTheme
    函数期望的是什么。我试图在零食博览会上创建一个演示,但由于它没有终端,因此无法运行以下命令
    node\u modules/native base/ejectTheme.js
    。这是创建此函数所遵循的链接。我自己没有修改任何重要内容@LindaPaiste
    import material from './native-base-theme/variables/material';
    import getTheme from './native-base-theme/components';
    
    return (
        <Suspense fallback="loading">
          <Provider store={store}>
            <StyleProvider style={getTheme(material)}>
    
    import color from 'color';
    import { Platform, Dimensions, PixelRatio } from 'react-native';
    
    import { PLATFORM } from './commonColor';
    
    const deviceHeight = Dimensions.get('window').height;
    const deviceWidth = Dimensions.get('window').width;
    const platform = Platform.OS;
    const platformStyle = PLATFORM.MATERIAL;
    const isIphoneX =
      platform === PLATFORM.IOS &&
      (deviceHeight === 812 ||
        deviceWidth === 812 ||
        deviceHeight === 896 ||
        deviceWidth === 896);
    
    export default {
      platformStyle,
      platform,
    
      // Android
      androidRipple: true,
      androidRippleColor: 'rgba(256, 256, 256, 0.3)',
      androidRippleColorDark: 'rgba(0, 0, 0, 0.15)',
      buttonUppercaseAndroidText: true,
      // Button
      buttonFontFamily: 'Roboto',
      get buttonPrimaryBg() {
        return this.brandPrimary;
      },
      get buttonTextSizeLarge() {
        return this.fontSizeBase * 1.5;
      },
    
      // Header
      toolbarBtnColor: '#fff',
      toolbarDefaultBg: '#3F51B5',
      toolbarHeight: 56,
      toolbarSearchIconSize: 23,
      toolbarInputColor: '#fff',
      searchBarHeight: platform === PLATFORM.IOS ? 30 : 40,
      searchBarInputHeight: platform === PLATFORM.IOS ? 40 : 50,
      toolbarBtnTextColor: '#fff',
      toolbarDefaultBorder: '#3F51B5',
      iosStatusbar: 'light-content',
      get statusBarColor() {
        return color(this.toolbarDefaultBg)
          .darken(0.2)
          .hex();
      },
      get darkenHeader() {
        return color(this.tabBgColor)
          .darken(0.03)
          .hex();
      },
    
      // Text
      textColor: '#000',
      inverseTextColor: '#fff',
      noteFontSize: 14,
      get defaultTextColor() {
        return this.textColor;
      },
    
      // iPhoneX SafeArea
      Inset: {
        portrait: {
          topInset: 24,
          leftInset: 0,
          rightInset: 0,
          bottomInset: 34,
        },
        landscape: {
          topInset: 0,
          leftInset: 44,
          rightInset: 44,
          bottomInset: 21,
        },
      },
    };