0
votes

When I log in to my React Native application and it goes through the process of loading up data from all the endpoints, it eventually crashes with the error of:

Invariant Violation: requireNativeComponent: "SwipeView" was not found in the UIManager

{
  "message": "Invariant Violation: requireNativeComponent: \"SwipeView\" was not found in the UIManager.\n\nThis error is located at:\n    in SwipeView (at SwipeView.js:14)\n    in SwipeView (at SwippableCard.js:6)\n    in SwippableCard (at Main.js:173)\n    in RCTView (at View.js:35)\n    in View (at VirtualizedList.js:1770)\n    in CellRenderer (at VirtualizedList.js:688)\n    in RCTScrollContentView (at ScrollView.js:1007)\n    in RCTScrollView (at ScrollView.js:1120)\n    in ScrollView (at VirtualizedList.js:1064)\n    in VirtualizedList (at FlatList.js:634)\n    in FlatList (at Main.js:348)\n    in RCTView (at View.js:35)\n    in View (at Main.js:347)\n    in ActivityFeed (created by Connect(ActivityFeed))\n    in Connect(ActivityFeed) (at SceneView.js:17)\n    in SceneView (at CardStack.js:466)\n    in RCTView (at View.js:35)\n    in View (at createAnimatedComponent.js:151)\n    in AnimatedComponent (at Card.js:12)\n    in Card (at PointerEventsContainer.js:39)\n    in Container (at CardStack.js:498)\n    in RCTView (at View.js:35)\n    in View (at CardStack.js:414)\n    in RCTView (at View.js:35)\n    in View (at CardStack.js:413)\n    in CardStack (at CardStackTransitioner.js:67)\n    in RCTView (at View.js:35)\n    in View (at Transitioner.js:142)\n    in Transitioner (at CardStackTransitioner.js:19)\n    in CardStackTransitioner (at StackNavigator.js:41)\n    in Unknown (at createNavigator.js:13)\n    in Navigator (at createNavigationContainer.js:226)\n    in NavigationContainer (at SceneView.js:17)\n    in SceneView (at DrawerScreen.js:21)\n    in DrawerScreen (at withCachedChildNavigation.js:69)\n    in withCachedChildNavigation(DrawerScreen) (at DrawerNavigator.js:71)\n    in Unknown (at createNavigator.js:13)\n    in Navigator (at DrawerView.js:178)\n    in RCTView (at View.js:35)\n    in View (at createAnimatedComponent.js:151)\n    in AnimatedComponent (created by DrawerLayout)\n    in RCTView (at View.js:35)\n    in View (created by DrawerLayout)\n    in DrawerLayout (at DrawerView.js:158)\n    in DrawerView (at DrawerNavigator.js:88)\n    in Unknown (at createNavigator.js:13)\n    in Navigator (at createNavigationContainer.js:226)\n    in NavigationContainer (at SceneView.js:17)\n    in SceneView (at CardStack.js:466)\n    in RCTView (at View.js:35)\n    in View (at createAnimatedComponent.js:151)\n    in AnimatedComponent (at Card.js:12)\n    in Card (at PointerEventsContainer.js:39)\n    in Container (at CardStack.js:498)\n    in RCTView (at View.js:35)\n    in View (at CardStack.js:414)\n    in RCTView (at View.js:35)\n    in View (at CardStack.js:413)\n    in CardStack (at CardStackTransitioner.js:67)\n    in RCTView (at View.js:35)\n    in View (at Transitioner.js:142)\n    in Transitioner (at CardStackTransitioner.js:19)\n    in CardStackTransitioner (at StackNavigator.js:41)\n    in Unknown (at createNavigator.js:13)\n    in Navigator (at createNavigationContainer.js:226)\n    in NavigationContainer (at RootNavigation.js:207)\n    in RootNavigation (created by Connect(RootNavigation))\n    in Connect(RootNavigation) (at App.js:249)\n    in RCTView (at View.js:35)\n    in View (at App.js:247)\n    in Provider (at App.js:246)\n    in NFIBEngage (at renderApplication.js:40)\n    in RCTView (at View.js:35)\n    in View (at AppContainer.js:98)\n    in RCTView (at View.js:35)\n    in View (at AppContainer.js:115)\n    in AppContainer (at renderApplication.js:39)",
  "stack": []
}

I tried running a pod install and I get this warning:

[!] use_native_modules! skipped the react-native dependency 'react-native-swipe-view'. No podspec file was found.
    - Check to see if there is an updated version that contains the necessary podspec file
    - Contact the library maintainers or send them a PR to add a podspec. The react-native-webview podspec is a good example of a package.json driven podspec.
    See https://github.com/react-native-community/react-native-webview/blob/master/react-native-webview.podspec
    - If necessary, you can disable autolinking for the dependency and link it manually. See
    https://github.com/react-native-community/cli/blob/master/docs/autolinking.md#how-can-i-disable-autolinking-for-unsupported-library

I tried applying what I saw in the last point by creating the react-native.config.js file.

I then manually linked the library via react-native link react-native-swipe-view, but that did not work.

This library is being utilized in SwippableCard.js:

import React from "react";
import PropTypes from "prop-types";
import { SwipeView } from "react-native-swipe-view";

const SwippableCard = props => (
  <SwipeView
    changeOpacity={true}
    removeViewOnSwipedOut={true}
    onSwipedOut={props.onSwipedOut}
  >
    {props.children}
  </SwipeView>
);

SwippableCard.propTypes = {
  children: PropTypes.any.isRequired,
  onSwipedOut: PropTypes.func
};

export { SwippableCard };

In Reactotron, it throws the above error about nine times which I believe its the SwippableCard component trying to re render with the state that comes back from:

api/1.0/activities?depth=full&types=BALLOT,SURVEY,MICRO,ARTICLE,EVENT,NOTIFICATION,TOPIC,INVOLVEMENT

I was able to get this working on android, but I do not know why this is not working on ios. I need some assistance from someone that knows XCode configurations very well and what the problem could be.

I have a working react-native-swipe-view in Android platform now, but I continue to get the same error for ios on the application level.

I don't believe its an issue of podspec, because on an XCode vanilla setup it works just fine.

1
In Xcode, drag the SwipeView.xcodeproj from your node modules to the libraries list in the Project Navigator. Then add libSwipeView to your app target "Linked Frameworks and Libraries" - hong developer
Did you run this description? - hong developer
@hongdevelop, I did that part of dragging SwipeView.xcodeproj and I still got that error message just the same. - Daniel
@hongdevelop, its definitely something about my XCode setup because react-native-swipe-view works just fine in android. - Daniel
@hongdevelop, check out the current developments for this OP. - Daniel

1 Answers

0
votes
react-native link react-native-swipe-view

This will solve the prob. This is because the specified package is not linked.