路由“ActivityFeed”的组件必须是 React 组件

2024-01-01

我在这里查看了关于类似问题的各种类似帖子,但没有一个答案为我解决了这个问题。

这是完整的错误:

所以在我的src/navigation/feed/stack.js它的定义如下:

import React from 'react';
import {StackNavigator} from 'react-navigation';
import ActivityFeed from 'activity-feed/session-user/screens/Main';
import HamburgerButton from 'navigation-components/HamburgerButton';
import HeaderTitle from 'navigation-components/HeaderTitle';
import ActionAlertIndicator from 'navigation-components/ActionAlertIndicator';
import * as navConfig from '../config';
import * as cache from 'utils/cache';

const stack = StackNavigator(
  {
    ActivityFeed: {
      screen: ActivityFeed,
      navigationOptions: ({navigation}) => ({
        header: (
          <HeaderTitle
            headerLeft={() => (
              <HamburgerButton
                onPress={() => navigation.navigate('DrawerOpen')}
              />
            )}
            headerRight={() => (
              <ActionAlertIndicator
                onPress={() => {
                  cache.setRouteStarter('MainDrawer');
                  navigation.navigate('ActionAlertsStack');
                }}
              />
            )}
          />
        ),
      }),
    },
  },
  {
    navigationOptions: {
      ...navConfig.defaultStackConfig,
    },
  }
);

export default stack;

实际的组件或屏幕是这样定义的src/activity-feed/session-user/screens/Main.js:


import React, {PureComponent} from 'react';
import {
  FlatList,
  StyleSheet,
  AppState,
  Platform,
  Dimensions,
  View,
  Alert,
} from 'react-native';
import PropTypes from 'prop-types';
import OneSignal from 'react-native-onesignal';
import {Loading, SwippableCard, BottomAlert} from 'common-components';
import EmptyState from 'activity-feed/session-user/components/EmptyState';
import EventFeedCard from 'events/components/EventFeedCard';
import SurveyBallotFeedCard from 'surveys-ballots/components/FeedCard';
import MicroSurvey from 'surveys-ballots/components/MicroSurvey';
import ActionAlertFeedCard from 'action-alerts/components/ActionAlertFeedCard';
import MissingAddressCard from 'action-alerts/components/MissingAddressCard';
import ArticleFeedCard from 'articles/components/ArticleFeedCard';
import GetInvolvedFeedCard from 'account-settings/components/GetInvolvedFeedCard';
import {connect} from 'react-redux';
import {
  fetchFeed,
  handleContentSwipe,
  undoSwipeAction,
  hideUndoAlert,
} from 'activity-feed/actions';
import {setSelectedEvent} from 'events/actions';
import {setSelectedSurvey} from 'surveys-ballots/actions';
import {setSelectedAlert, getCampaignDetails} from 'action-alerts/actions';
import * as cache from 'utils/cache';
import {setSelectedArticle} from 'articles/actions';
import {
  handleUpdateTopics,
  handleUpdateGetInvoved,
} from 'account-settings/preferencesActions';
import {scale} from 'react-native-size-matters';
import {emptyStateStyles} from 'theme';

const {height} = Dimensions.get('window');

export class ActivityFeed extends PureComponent {
  static propTypes = {
    displayAlert: PropTypes.bool,
    feed: PropTypes.array,
    fetchFeed: PropTypes.func,
    getCampaignDetails: PropTypes.func,
    handleContentSwipe: PropTypes.func,
    handleUpdateGetInvoved: PropTypes.func,
    handleUpdateTopics: PropTypes.func,
    hideUndoAlert: PropTypes.func,
    lastSwippedElement: PropTypes.object,
    loading: PropTypes.bool,
    navigation: PropTypes.object,
    setSelectedAlert: PropTypes.func,
    setSelectedArticle: PropTypes.func,
    setSelectedEvent: PropTypes.func,
    setSelectedSurvey: PropTypes.func.isRequired,
    undoSwipeAction: PropTypes.func,
    userEmailIsValidForVoterVoice: PropTypes.bool,
  };

  constructor(props) {
    super(props);
    this.prompted = false;

    this.state = {
      refreshing: false,
      appState: AppState.currentState,
    };
  }

  async componentDidMount() {
    AppState.addEventListener('change', this._handleAppStateChange);
    if (!this.props.loading) {
      const doRefresh = await cache.shouldRefresh('feed');
      if (this.props.feed.length === 0 || doRefresh) {
        this.props.fetchFeed();
      }
      cache.incrementAppViews();
    }
  }

  componentWillUnmount() {
    AppState.removeEventListener('change', this._handleAppStateChange);
  }

  _handleAppStateChange = async appState => {
    if (
      this.state.appState.match(/inactive|background/) &&
      appState === 'active'
    ) {
      cache.incrementAppViews();
      const doRefresh = await cache.shouldRefresh('feed');
      if (doRefresh) {
        this.props.fetchFeed();
      }
    }
    this.setState({appState});
  };

  _keyExtractor = ({Entity}) =>
    (Entity.Key || Entity.Id || Entity.CampaignId || Entity.Code).toString();

  _gotoEvent = event => {
    cache.setRouteStarter('MainDrawer');
    this.props.setSelectedEvent(event);
    const title = `${event.LegislatureType} Event`;
    this.props.navigation.navigate('EventDetails', {title});
  };

  _gotoSurveyBallot = survey => {
    cache.setRouteStarter('MainDrawer');
    this.props.setSelectedSurvey(survey);
    this.props.navigation.navigate('SurveyDetails');
  };

  _gotoArticle = article => {
    cache.setRouteStarter('MainDrawer');
    this.props.setSelectedArticle(article);
    this.props.navigation.navigate('ArticleDetails');
  };

  _onAlertActionButtonPress = async item => {
    cache.setRouteStarter('MainDrawer');
    await this.props.setSelectedAlert(item.Entity);
    this.props.getCampaignDetails();
    if (this.props.userEmailIsValidForVoterVoice) {
      this.props.navigation.navigate('Questionnaire');
    } else {
      this.props.navigation.navigate('UnconfirmedEmail');
    }
  };

  _onSwipedOut = (swippedItem, index) => {
    this.props.handleContentSwipe(this.props, {swippedItem, index});
  };

  _handleGetInvolved = (response, entity) => {
    if (response !== entity.IsSelected) {
      const isTopic = entity.Category !== 'GetInvolved';
      const items = [
        {
          ...entity,
          IsSelected: response,
        },
      ];
      if (isTopic) {
        this.props.handleUpdateTopics({topics: items});
      } else {
        this.props.handleUpdateGetInvoved({involved: items});
      }
    }
  };

  renderItem = ({item, index}) => {
    const {Type, Entity} = item;
    if (Type === 'EVENT') {
      return (
        <SwippableCard onSwipedOut={() => this._onSwipedOut(item, index)}>
          <EventFeedCard
            style={styles.push}
            mainActionButtonPress={() => this._gotoEvent(Entity)}
            event={Entity}
          />
        </SwippableCard>
      );
    }

    if (['SURVEY_SURVEY', 'SURVEY_BALLOT'].includes(Type)) {
      return (
        <SwippableCard onSwipedOut={() => this._onSwipedOut(item, index)}>
          <SurveyBallotFeedCard
            style={styles.push}
            survey={Entity}
            handleViewDetails={() => this._gotoSurveyBallot(Entity)}
          />
        </SwippableCard>
      );
    }

    if (Type === 'SURVEY_MICRO') {
      return (
        <SwippableCard onSwipedOut={() => this._onSwipedOut(item, index)}>
          <MicroSurvey style={styles.push} selectedSurvey={Entity} />
        </SwippableCard>
      );
    }

    if (Type === 'ALERT') {
      return (
        <SwippableCard onSwipedOut={() => this._onSwipedOut(item, index)}>
          <ActionAlertFeedCard
            datePosted={Entity.StartDateUtc}
            style={styles.push}
            title={Entity.Headline}
            content={Entity.Alert}
            mainActionButtonPress={() => this._onAlertActionButtonPress(item)}
            secondaryActionButtonPress={() => {
              this.props.setSelectedAlert(Entity);
              // eslint-disable-next-line
              this.props.navigation.navigate("ActionAlertDetails", {
                content: Entity.Alert,
                id: Entity.CampaignId,
                title: Entity.Headline,
              });
            }}
          />
        </SwippableCard>
      );
    }

    if (Type === 'ARTICLE') {
      return (
        <SwippableCard onSwipedOut={() => this._onSwipedOut(item, index)}>
          <ArticleFeedCard
            content={Entity}
            style={styles.push}
            mainActionButtonPress={() => this._gotoArticle(Entity)}
          />
        </SwippableCard>
      );
    }

    //prettier-ignore
    if (Type === 'NOTIFICATION' && Entity.Code === 'INDIVIDUAL_ADDRESS_HOME_MISSING') {
      return (
        <MissingAddressCard
          style={styles.push}
          navigate={() => this.props.navigation.navigate('HomeAddress')}
        />
      );
    }

    if (['PREFERENCE_TOPIC', 'PREFERENCE_INVOLVEMENT'].includes(Type)) {
      return (
        <SwippableCard onSwipedOut={() => this._onSwipedOut(item, index)}>
          <GetInvolvedFeedCard
            style={styles.push}
            title={Entity.DisplayText}
            onPress={response => this._handleGetInvolved(response, Entity)}
          />
        </SwippableCard>
      );
    }

    return null;
  };

  _onRefresh = async () => {
    try {
      this.setState({refreshing: true});
      this.props
        .fetchFeed()
        .then(() => {
          this.setState({refreshing: false});
        })
        .catch(() => {
          this.setState({refreshing: false});
        });
    } catch (e) {
      this.setState({refreshing: false});
    }
  };

  _trackScroll = async event => {
    try {
      if (this.prompted) {
        return;
      }

      const y = event.nativeEvent.contentOffset.y;
      const scrollHeight = height * 0.8;
      const page = Math.round(Math.floor(y) / scrollHeight);
      const alert = await cache.shouldPromtpPushNotificationPermissions();
      const iOS = Platform.OS === 'ios';

      if (alert && iOS && page > 1) {
        this.prompted = true;
        this._openPromptAlert();
      }
    } catch (e) {
      return false;
    }
  };

  _openPromptAlert = () => {
    Alert.alert(
      'Push Notifications Access',
      'Stay engaged with NFIB on the issues and activities you care about by allowing us to notify you using push notifications',
      [
        {
          text: 'Deny',
          onPress: () => {
            cache.pushNotificationsPrompted();
          },
          style: 'cancel',
        },
        {
          text: 'Allow',
          onPress: () => {
            OneSignal.registerForPushNotifications();
            cache.pushNotificationsPrompted();
          },
        },
      ],
      {cancelable: false}
    );
  };

  _getAlertTitle = () => {
    const {lastSwippedElement} = this.props;
    const {Type} = lastSwippedElement.swippedItem;

    if (Type.startsWith('PREFERENCE')) {
      return 'Preference Dismissed';
    }

    switch (Type) {
      case 'EVENT':
        return 'Event Dismissed';
      case 'SURVEY_BALLOT':
        return 'Ballot Dismissed';
      case 'SURVEY_SURVEY':
        return 'Survey Dismissed';
      case 'SURVEY_MICRO':
        return 'Micro Survey Dismissed';
      case 'ARTICLE':
        return 'Article Dismissed';
      case 'ALERT':
        return 'Action Alert Dismissed';
      default:
        return 'Dismissed';
    }
  };

  render() {
    if (this.props.loading && !this.state.refreshing) {
      return <Loading />;
    }

    const contentStyles =
      this.props.feed.length > 0 ? styles.content : emptyStateStyles.container;

    return (
      <View style={styles.container}>
        <FlatList
          contentContainerStyle={contentStyles}
          showsVerticalScrollIndicator={false}
          data={this.props.feed}
          renderItem={this.renderItem}
          keyExtractor={this._keyExtractor}
          removeClippedSubviews={false}
          onRefresh={this._onRefresh}
          refreshing={this.state.refreshing}
          ListEmptyComponent={() => (
            <EmptyState navigation={this.props.navigation} />
          )}
          scrollEventThrottle={100}
          onScroll={this._trackScroll}
        />
        {this.props.displayAlert && (
          <BottomAlert
            title={this._getAlertTitle()}
            onPress={this.props.undoSwipeAction}
            hideAlert={this.props.hideUndoAlert}
          />
        )}
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
  },
  content: {
    paddingHorizontal: scale(8),
    paddingTop: scale(16),
    paddingBottom: scale(20),
  },
  push: {
    marginBottom: 16,
  },
});

const mapState2Props = ({
  activityFeed,
  auth: {userEmailIsValidForVoterVoice},
  navigation,
}) => {
  return {
    ...activityFeed,
    userEmailIsValidForVoterVoice,
    loading: activityFeed.loading || navigation.deepLinkLoading,
  };
};

export default connect(mapState2Props, {
  fetchFeed,
  getCampaignDetails,
  handleUpdateGetInvoved,
  handleUpdateTopics,
  setSelectedAlert,
  setSelectedArticle,
  setSelectedEvent,
  setSelectedSurvey,
  handleContentSwipe,
  undoSwipeAction,
  hideUndoAlert,
})(ActivityFeed);

我没有看到我的代码有任何明显的变化,我想知道是否有一些变化react-navigation团队做到了。

我在用react-navigation版本 1.5.11 与react-native版本0.60.4。

这是RN版本的兼容性问题吗?我除了升级之外别无选择吗?

这个问题在我的申请中似乎很普遍。我在这里也收到错误:

这是src/auth/screens/ResetLinkConfirmationAlert.js file:

import React from 'react';
import {connect} from 'react-redux';
import ResetPasswordLinkConfirmationAlert from 'auth/components/ResetPasswordLinkConfirmationAlert';
import PropTypes from 'prop-types';

const ResetLinkConfirmationAlert = ({resetEmail, navigation}) => {
  const {params} = navigation.state;
  return <ResetPasswordLinkConfirmationAlert email={resetEmail} {...params} />;
};

ResetLinkConfirmationAlert.propTypes = {
  navigation: PropTypes.object,
  resetEmail: PropTypes.string,
};

const mapStateToProps = ({registrations}) => {
  const {resetEmail} = registrations.resetPasswordData;
  const email = resetEmail || registrations.verificationEmail;
  return {resetEmail: email};
};

export default connect(mapStateToProps)(ResetLinkConfirmationAlert);

它正在被进口到这里src/navigation/auth/stack.js:

import React from "react";
import { StackNavigator, NavigationActions } from "react-navigation";
import { Intro } from "auth/screens/Intro";
import { Login } from "auth/screens/Login";
import { PasswordReset } from "auth/screens/PasswordReset";
import { RegisterNoEmail } from "auth/screens/RegisterNoEmail";
import AskForMembership from "auth/screens/AskForMembership";
import { CompleteAccount } from "auth/screens/CompleteAccount";
import { ConfirmMemberAccount } from "auth/screens/ConfirmMemberAccount";
import { Register } from "auth/screens/Register";
import SetNewPassword from "auth/screens/SetNewPassword";
import { RegisterEmailPassword } from "auth/screens/RegisterEmailPassword";
import ResetLinkConfirmationAlert from "auth/screens/ResetLinkConfirmationAlert";
import DetailsConfirmation from "auth/screens/DetailsConfirmation";
import AccountCreated from "auth/screens/AccountCreated";

import BackButton from "navigation-components/BackButton";
import CustomHeader from "navigation-components/CustomHeader";
import HeaderTitle from "navigation-components/HeaderTitle";
import { v2Colors } from "theme";
import { defaultStackConfig, defaultHeaderStyles } from "../config";

const leftRegiterNavOptions = {
  title: "Register",
  headerStyle: defaultStackConfig.authHeaderStyle
};

const stack = StackNavigator(
  {
    Intro: {
      screen: Intro,
      navigationOptions: {
        header: null
      }
    },
    Register: {
      screen: Register,
      navigationOptions: ({ navigation }) => ({
        header: <CustomHeader onPress={() => navigation.goBack(null)} />,
        headerStyle: defaultStackConfig.authHeaderStyle
      })
    },
    RegisterNoEmail: {
      screen: RegisterNoEmail,
      navigationOptions: leftRegiterNavOptions
    },
    RegisterEmailPassword: {
      screen: RegisterEmailPassword,
      navigationOptions: leftRegiterNavOptions
    },
    AskForMembership: {
      screen: AskForMembership,
      navigationOptions: {
        header: <HeaderTitle />,
        headerStyle: defaultStackConfig.authHeaderStyle
      }
    },
    ConfirmMemberAccount: {
      screen: ConfirmMemberAccount,
      navigationOptions: ({ navigation }) => ({
        header: (
          <HeaderTitle
            headerLeft={() => (
              <BackButton onPress={() => navigation.goBack(null)} />
            )}
          />
        ),
        headerStyle: defaultStackConfig.authHeaderStyle
      })
    },
    CompleteAccount: {
      screen: CompleteAccount,
      navigationOptions: {
        header: <HeaderTitle />,
        headerStyle: defaultStackConfig.authHeaderStyle
      }
    },
    Login: {
      screen: Login,
      navigationOptions: ({ navigation }) => ({
        title: "Log In",
        headerLeft: <BackButton onPress={() => navigation.goBack(null)} />,
        headerStyle: defaultStackConfig.authHeaderStyle
      })
    },
    PasswordReset: {
      screen: PasswordReset,
      navigationOptions: ({ navigation }) => ({
        title: "Password Reset",
        headerLeft: <BackButton onPress={() => navigation.goBack(null)} />,
        headerStyle: defaultStackConfig.authHeaderStyle
      })
    },
    ResetLinkConfirmationAlert: {
      screen: ResetLinkConfirmationAlert,
      navigationOptions: ({ navigation }) => ({
        title: "Password Reset",
        headerLeft: (
          <BackButton
            onPress={() => {
              const resetNavAction = NavigationActions.reset({
                index: 0,
                key: null,
                actions: [NavigationActions.navigate({ routeName: "Intro" })]
              });
              navigation.dispatch(resetNavAction);
            }}
          />
        ),
        headerStyle: defaultStackConfig.authHeaderStyle
      })
    },

升级至react-navigation2.0.0 不是答案,因为我已经尝试过,如果您建议升级到 3.x,请解释如何解决此问题。

有人建议在react-redux 7.1.0的变更日志中他们提到了一条注释:PropTypes.func必须改为PropTypes.elementType如果一个元素作为 prop 传递

github.com/reduxjs/react-redux/releases/tag/v7.0.1

所以在我收到错误的情况下SetNewPassword,我像这样重构了它:

export class CompleteAccount extends PureComponent {
  static propTypes = {
    loading: PropTypes.bool,
    newConfirmResetPassword: PropTypes.string,
    newResetPassword: PropTypes.string,
    resetUserPassword: PropTypes.elementType.isRequired,
    setConfirnResetPassword: PropTypes.elementType.isRequired,
    setNewResetPassword: PropTypes.elementType.isRequired,
    validationErrors: PropTypes.object
  };

然后在navigation/auth/stack.js我在 import 语句中添加了大括号,如下所示:

import { SetNewPassword } from "auth/screens/SetNewPassword";

但我仍然收到该错误消息,尽管我不确定我是否正确应用了该消息。同时我也注意到SetNewPassword.js文件仅具有命名导出CompleteAccount:

export class CompleteAccount extends PureComponent {
  static propTypes = {
    loading: PropTypes.bool,
    newConfirmResetPassword: PropTypes.string,
    newResetPassword: PropTypes.string,
    resetUserPassword: PropTypes.elementType.isRequired,
    setConfirnResetPassword: PropTypes.elementType.isRequired,
    setNewResetPassword: PropTypes.elementType.isRequired,
    validationErrors: PropTypes.object
  };
.......

export default connect(
  mapStateToProps,
  {
    resetUserPassword,
    setNewResetPassword,
    setConfirnResetPassword
  }
)(CompleteAccount);

不确定这个文件以前是如何以这种方式工作的。我通常将文件命名为与类或功能屏幕相同的名称,并使用相同的名称导入它。

经过进一步检查,我发现有两个屏幕具有相同的类名功能。

CompleteAccount.js:

export class CompleteAccount extends PureComponent {
  static propTypes = {
    cellPhone: PropTypes.string,
    cellPhoneChanged: PropTypes.func.isRequired,
    city: PropTypes.string,
    cityChanged: PropTypes.func.isRequired,
    errors: PropTypes.object,
    firstName: PropTypes.string.isRequired,
    homeAddress: PropTypes.string,
    homeAddressChanged: PropTypes.func.isRequired,
    homePhone: PropTypes.string,
    homePhoneChanged: PropTypes.func.isRequired,
    registeredUser: PropTypes.object,
    registerUser: PropTypes.func.isRequired,
    state: PropTypes.string,
    stateChanged: PropTypes.func.isRequired,
    zipCode: PropTypes.string.isRequired,
    zipCodeChanged: PropTypes.func.isRequired,
  };

导出为:

export default connect(mapStateToProps, {
  cityChanged,
  homeAddressChanged,
  homePhoneChanged,
  cellPhoneChanged,
  stateChanged,
  zipCodeChanged,
  registerUser,
})(CompleteAccount);

然后有SetNewPassword.js:

它也被命名为:

export class CompleteAccount extends PureComponent {
  static propTypes = {
    loading: PropTypes.bool,
    newConfirmResetPassword: PropTypes.string,
    newResetPassword: PropTypes.string,
    resetUserPassword: PropTypes.func.isRequired,
    setConfirnResetPassword: PropTypes.func.isRequired,
    setNewResetPassword: PropTypes.func.isRequired,
    validationErrors: PropTypes.object
  };
.....

export default connect(
  mapStateToProps,
  {
    resetUserPassword,
    setNewResetPassword,
    setConfirnResetPassword
  }
)(CompleteAccount);

即使文件名完全不同。这很令人困惑,为什么他们不直接给第二个类名SetNewPassword?


眼前的问题看起来像是组件文件中的多个导出。尝试删除export在类定义之前并且只保留export default在最后。

关于有关的困惑SetNewPassword.js and CompleteAccount.js具有相同的导出,只要导入就不会引起问题default exported成分。

简而言之,

如果将组件导出为default,然后您可以导入它而无需{}大括号,例如

import CompleteAccount from '.../CompleteAccount.js'

在这里您可以为导入命名任何您想要的名称。

如果您使用花括号,则会导入named export, like

import {CompleteAccount} from '.../CompleteAccount.js'
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)

路由“ActivityFeed”的组件必须是 React 组件 的相关文章

  • 无法立即更新状态?

    我有两个功能 第一个功能是我收到所有订单 第二个功能是我收到所有被拒绝的订单 所以在第一个函数中 我根据第二个函数状态更新状态 效果很好 但是当我从 Firebase 控制台删除项目时 尽管我使用on value gt 那么我该如何处理呢
  • React Native Flatlist 不会在自定义动画底部表内滚动

    我创建了一张自定义动画底部表 用户可以上下移动底部滚动条 在我的底部工作表中 我使用了 flatList 来获取数据并将项目呈现为卡片 到目前为止 一切都按预期工作 但我遇到了平面列表滚动问题 在底部工作表内 平面列表不会滚动 我已经硬编码
  • 如何将变量传递给函数引用?

    在 React Native 中 当你有需要在渲染时运行并且必须传递变量的函数时 大多数人建议应该使用 onPress gt this functionName variable 然而 当处理大型列表和复杂组件时 您必须优化代码 为每个 r
  • React Native + Redux:最好和首选的导航是什么?

    我想将 Redux 用于 React Native 目前我没有设置数据管理 所以index ios js有以下内容 renderScene route navigator this navigator navigator return
  • React Native Tab 视图的高度始终等于最高选项卡的高度

    介绍 我有一个 FlatList 它在页脚中呈现一个选项卡视图 此选项卡视图允许用户在一个 FlatList 或另一个 FlatList 之间切换 所以 最后这些是同级 FlatList Problem 第一个 FlatList A 的高度
  • 使用 Fetch 发生超时错误 - React Native

    我有一个正在运行的用户登录功能 但是 我想在获取时加入超时错误 有没有办法设置一个 5 秒左右的计时器 这样在这个时间之后就会停止尝试获取 否则 一段时间后我就会出现红屏 提示网络错误 userLogin var value this re
  • 用笑话测试实现react-leaflet映射的react组件的问题

    当我尝试测试实现react leaflet库的react组件时 遇到以下问题 C digital booking ui node modules react leaflet lib index js 1 Object
  • 如何在 Firebase 上随机获取相同的数据?

    我有用户表和这段代码 getOnline 代码和连接按钮 var onlineStatus firebase database ref users firebase auth currentUser uid online onlineSta
  • 打包器无法启动

    我想我在某个时候升级了节点 现在当我尝试使用以下命令运行打包程序时npm start它抱怨 npm start react native start Looks like you installed react native globall
  • 如何在 React-Native 项目中实施和测试 Firebase Analytics?

    通过阅读我了解到Firebase官方支持react native https firebase googleblog com 2016 01 the beginners guide to react native and 84 html h
  • 如何在React Native的MapView中设置标记

    我想在React Native中的MapView上设置一个标记 但是通过官方文档找不到任何信息MapView https facebook github io react native docs mapview html content 如
  • ListView无法滚动

    正如你在所附的 GIF 中看到的 我无法滚动浏览ListView 一旦我释放鼠标 视图就会恢复到原始位置 我已经阅读了文档 似乎滚动应该只是工作 这是执行render render function return
  • 如何在 TypeScript 中使用 navigation.replace ?

    我试图在我的代码中使用它 const navigation useNavigation navigation replace AllFriends 但我不断收到错误消息 Property replace does not exist on
  • 如何在重新加载或向后/向前重定向时保存 React 页面的状态?

    下面是我的代码 我正在使用 API 并获取当前页面上的一些数据 现在 我想在重新加载页面或再次返回或前进时保存此页面的状态 在这里 我从上一页 api 获取 featureGroupID 并将其存储在全局变量 customerID 中 我知
  • 某些设备上的启动画面扭曲

    我在修复 Android 上的启动画面扭曲问题时遇到问题 我正在使用 React Native 请注意 这种情况仅发生在某些设备上 例如 我有一台 Android 版本为 4 2 2 的三星 启动画面不扭曲 而 Android 版本为 8
  • Expo eas-cli iOS 构建失败

    我已经使用 React Native 创建了一个应用程序 并尝试通过 Expo 的 eas cli 创建一个 iOS 应用程序商店 跑步时eas build platform ios the Fastlane build failed wi
  • VirtualizedList:您有一个很大的列表,更新速度很慢

    我使用 FlatList 来处理大量项目 我收到来自 Expo XDE 的以下警报 VirtualizedList 您有一个更新速度很慢的大列表 make 确保你的 renderItem 函数渲染遵循 React 的组件 性能最佳实践 例如
  • react-native-screens:compileDebugKotlin 错误

    失败 构建失败并出现异常 什么地方出了错 任务 react native screens compileDebugKotlin 执行失败 评估任务 react native screens compileDebugKotlin 的属性 fi
  • onLoadEnd 未在本机反应中触发

    我正在尝试在 React Native 上显示来自 giphy api 的 GIF Gif 需要一些时间才能在屏幕上显示 因此我想在中间显示一个微调器 onLoadEnd 事件似乎永远不会在 Image 标签上触发 因此微调器实际上会无休止
  • 在一个react-native项目中使用谷歌地图和FCM

    I want to use google map and FCM in one react native project first I added FCM in project everything was okay but when I

随机推荐

  • Javadoc:package.html 或 package-info.java

    当尝试创建包级 Javadoc 注释时 首选方法是什么 你做什么工作 包信息 java Pros Newer Cons 滥用类 类用于代码 而不仅仅是注释 包 html Pros HTML 扩展意味着它不是代码 IDE 文本编辑器中的语法突
  • angularjs 一个元素上有两个指令

    我有两个指令 Generated by CoffeeScript 1 6 3 app directive focusMe function return scope focus focusMe link function scope ele
  • 获取 JPanel 上单击位置的颜色?

    我只想要一种在单击的像素为白色时激活的方法 我将如何实施这个 试图寻找一种返回坐标颜色的方法 但我找不到 依靠 如果你有一个缓冲图像 http java sun com j2se 1 4 2 docs api java awt image
  • 在 MVC 中上传文件时,字符串或二进制数据会被截断

    该文件只有 14kb 14 000 字节 我读过varbinary max 列类型 这就是我正在使用的 仅支持 8 000 字节 那是对的吗 如何将我的文件上传到数据库 if file ContentLength lt 3 1048576
  • 如何从非英语值创建一个 slug?

    我有模型Author有字段名字 姓氏 我想添加另一个字段 slug 它将包含字段串联的段 但是 这些字段包含非英语字符 我需要一个英语符号来创建链接模板 本地主机 作者 str slug 我该如何实施 要解决这个问题 您可以使用unidec
  • Docker - 无法在卷内的容器之间共享数据(docker-compose 3)

    我现在有一些用于 Web 应用程序的容器 nginx gunicorn postgres 和节点 用于从源代码构建静态文件和 React 服务器端渲染 在节点容器的 Dockerfile 中 我有两个步骤 构建和运行 Dockerfile
  • 使用 Rails 导入 gmail/yahoo/hotmail/aol 地址簿

    我想从 gmail hotmail yahoo 和 aol 地址簿中导入用户的地址簿 我正在 Rails 中寻找可以帮助我做到这一点的 gem 插件 任何帮助表示赞赏 Thanks 我一直在努力Contacts http github co
  • 从 Firebase 获取数据

    我正在尝试从 Firebase 获取数据 我尝试过这样的操作 FIREBASE REF childByAppendingPath tasks observeEventType Value withBlock snapshot gt Void
  • 如何让表头透明?

    我花了很多时间来解决这个问题 但仍然不明白我做错了什么 我需要我的标题是透明的 没有背景 举个例子 但我不明白透明度是如何工作的 我已经尝试了一切 但它总是白色的 透明度仅适用于文本 帮帮忙 我真的很期待 body margin 0 fon
  • 弹性容器内的居中元素正在增长并溢出到顶部之外[重复]

    这个问题在这里已经有答案了 我一定忘记了垂直和水平居中弹性盒的一些基本知识 容器位于具有垂直滚动的父级内 当容器变得太高时 它会超出父级顶部 从而剪切内容 底部保持原状 尝试调整视图的高度或添加更多线条以查看其实际效果 body html
  • 无法从 Microsoft Dynamics CRM WebAPI 调用 BulkDelete 操作

    我正在尝试致电批量删除 操作 https learn microsoft com en us previous versions dynamicscrm 2016 developers guide mt491158 v 3Dcrm 8 本地
  • 更改分支点

    我有一个分支叫feature它有一些提交 分支及其提交仍然位于我的机器本地 还没有push编辑到公共存储库 该图看起来像 A B C D E F G master P Q R feature 现在我意识到我应该建立分支feature脱离先前
  • 在测试中覆盖调试模块

    我有一个 Gradle 应用程序 其项目结构类似于杰克 沃顿的 u2020 https github com jakewharton u2020 src androidTest debug main release 在我的应用程序类中 我构
  • Alamofire 使用 PUT 上传图像

    我目前正在尝试使用预先签名的网址将图像上传到亚马逊 它的工作方式是 我发出 GET 请求来获取预签名的 URL 然后发出 PUT 请求以使用 GET 请求返回的 url 上传图像 这两条规则是 Content Type 必须是 image
  • 用于压缩的 WCF 自定义绑定

    遵循样本压缩 http msdn microsoft com en us library ms751458 aspx由微软 我已将编码器 编码器工厂和绑定元素添加到我的解决方案中 与他们的示例的不同之处在于 我们不通过配置文件 要求 注册端
  • 将 MVC3 应用程序发布到 IIS 错误 - Web 服务器配置为不列出此目录的内容

    我将网站发布到 C inetpub wwwroot Sem App 并创建了一个物理路径为 C inetpub wwwroot Sem App 和端口 84 的网站 当我在http localhost 84 我收到以下错误 HTTP Err
  • 隐藏 MasterDetailPage 上的导航栏

    我有一个 MasterDetailPage 包含以下构造函数 public MainPage NavigationPage SetHasNavigationBar this false NavigationPage SetHasBackBu
  • Firebase - 在 Node.js 服务器上创建用户

    我们有一个使用 Firebase v2 的大型 SPA 我们想升级到新的 API 但遇到以下问题 由于应用程序相当大 我们开发了许多集成测试 对于这些测试 我们总是需要重置数据库并将其初始化为某些用户存在的状态 然而 我们发现确实不再有在服
  • 如何使用 python 和 openssl 验证 webhook 签名

    我正在尝试验证传入的 webhook 但到目前为止生成的哈希值与 api 生成的测试哈希值不匹配 文档列出了以下 Ruby 示例 但我使用的是 Python Django 因此任何 转换 此函数的帮助将不胜感激 红宝石函数 request
  • 路由“ActivityFeed”的组件必须是 React 组件

    我在这里查看了关于类似问题的各种类似帖子 但没有一个答案为我解决了这个问题 这是完整的错误 所以在我的src navigation feed stack js它的定义如下 import React from react import Sta