Giter VIP home page Giter VIP logo

Comments (10)

tonyxiao avatar tonyxiao commented on June 9, 2024 5

Actually nvm that did not fix it. Adding useWebKit to the webview created by react-native-plaid-link did however.

from react-native-plaid-link.

nikolal avatar nikolal commented on June 9, 2024 4

@catalinmiron
I created pull request to fix this.

#20

Thanks again @tonyxiao

from react-native-plaid-link.

corbt avatar corbt commented on June 9, 2024 1

I wasn't able to get things working on the latest version of React Native, even with this fix. After many hours of troubleshooting, I ended up mostly rewriting the component and finally getting it working. I'm going to leave my work here just in case it's useful for anyone else in the same situation!

import React from "react";
import { WebView, WebViewIOSLoadRequestEvent, WebViewProperties } from "react-native";
import parse from "url-parse";

const encodeParams = (params: Object) =>
  Object.entries(params)
    .filter(([k, v]) => v != null)
    .map(([k, v]) => `${k}=${encodeURIComponent(v)}`)
    .join("&");

interface Props extends WebViewProperties {
  publicKey: string;
  env: "development" | "sandbox" | "production";
  product: string;
  clientName?: string;
  webhook?: string;
  selectAccount?: boolean;
  onSuccess?: (e: any) => void;
  onExit?: (e: any) => void;
}

export default class PlaidAuthenticator extends React.Component<Props> {
  static defaultProps = {
    selectAccount: false
  };

  handleLoadRequest = (e: WebViewIOSLoadRequestEvent) => {
    if (e.url.includes("postMessage")) {
      return false;
    }
    if (e.url.startsWith("plaidlink")) {
      const parsed = parse(e.url, true);

      if (parsed.host === "connected") {
        this.props.onSuccess && this.props.onSuccess(parsed.query);
      } else if (parsed.query && parsed.query.event_name === "EXIT") {
        this.props.onExit && this.props.onExit(parsed.query);
      }
      return false;
    }
    return true;
  };

  render() {
    const {
      publicKey,
      selectAccount,
      env,
      product,
      clientName,
      style,
      webhook,
      onSuccess,
      onExit,
      ...rest
    } = this.props;

    const params = {
      key: publicKey,
      apiVersion: "v2",
      env,
      product,
      clientName,
      isWebview: true,
      isMobile: true,
      selectAccount,
      webhook
    };

    const uri = `https://cdn.plaid.com/link/v2/stable/link.html?${encodeParams(params)}`;

    return (
      <WebView
        {...rest}
        source={{ uri }}
        onShouldStartLoadWithRequest={this.handleLoadRequest}
        originWhitelist={["plaidlink://", "https://"]}
      />
    );
  }
}

from react-native-plaid-link.

tonyxiao avatar tonyxiao commented on June 9, 2024

Seeing the same issue over here as well :(

from react-native-plaid-link.

tonyxiao avatar tonyxiao commented on June 9, 2024

@nikolal I was able to fix it by passing additional param selectAccount={false}

from react-native-plaid-link.

nikolal avatar nikolal commented on June 9, 2024

@tonyxiao

This doesn't fix the issue for me.

I just copy pasted code from this lib and set useWebKit to webView.

Do you maybe have some example I could use?

from react-native-plaid-link.

nikolal avatar nikolal commented on June 9, 2024

@tonyxiao

It works.
I forgot to change import from the installed lib to the copied code.

Thanks a lot.

from react-native-plaid-link.

bfine9618 avatar bfine9618 commented on June 9, 2024

Has this fix been published to NPM yet?

from react-native-plaid-link.

nikolal avatar nikolal commented on June 9, 2024

@bfine9618

Not merged yet.

You can just download this lib to your project ( only 2 files ), add useWebKit until it's merged.

from react-native-plaid-link.

catalinmiron avatar catalinmiron commented on June 9, 2024

@nikolal @bfine9618 the PR was merged and I've published a new version 1.3.8 🎉. Thanks everyone!

from react-native-plaid-link.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.