Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot read property 'showFlow' of null #84

Open
coolheaded1 opened this issue May 14, 2024 · 11 comments
Open

Cannot read property 'showFlow' of null #84

coolheaded1 opened this issue May 14, 2024 · 11 comments

Comments

@coolheaded1
Copy link

After following the official documentation, I got Cannot read property 'showFlow' of null when I click the button.

my code:
import React, {Component, useEffect} from 'react';
import {
NativeModules,
NativeEventEmitter,
Button,
View
} from 'react-native';

import {
MetaMapRNSdk,
} from 'react-native-expo-metamap-sdk';

function App() {

useEffect(() => {
 	const MetaMapVerifyResult = new NativeEventEmitter(NativeModules.MetaMapRNSdk)
 	MetaMapVerifyResult.addListener('verificationSuccess', (data) => console.log(data))
 	MetaMapVerifyResult.addListener('verificationCanceled', (data) => console.log(data))
})
const handleMetaMapClickButton = () => {
   	 MetaMapRNSdk.showFlow("610b96fb7cc893001b135505", "611101668083a1001b13cc80", {:});
  }

return (
      <View
        style={{
          flex: 1,
          justifyContent: 'center',
          alignItems: 'center',
          backgroundColor: 'powderblue',
        }}>
        <Button onPress = {() => handleMetaMapClickButton()}  title="Click here"/>
      </View>
    );

}
export default App;

@AvoSukiasyan
Copy link
Collaborator

hi @coolheaded1 . let me check it on my side and get back to you

@AvoSukiasyan
Copy link
Collaborator

hi @coolheaded1 . this happens because you are using the react-native plugin in place of react-native.
please use this plugin https://www.npmjs.com/package/react-native-metamap-sdk

import {
MetaMapRNSdk,
} from 'react-native-metamap-sdk';

@josephKredi
Copy link

hi @AvoSukiasyan, I just tried this and got the same thing.

import React, { useEffect } from "react";
import { NativeModules, NativeEventEmitter, Button, View } from "react-native";

import { MetaMapRNSdk } from "react-native-metamap-sdk";

export const FaceRecognition = () => {
useEffect(() => {
const MetaMapVerifyResult = new NativeEventEmitter(NativeModules.MetaMapRNSdk);
MetaMapVerifyResult.addListener("verificationSuccess", (data) => console.log(data));
MetaMapVerifyResult.addListener("verificationCanceled", (data) => console.log(data));
}, []);

const handleMetaMapClickButton = () => {
MetaMapRNSdk.showFlow("610b96fb7cc893001b135505", "611101668083a1001b13cc80", {});
};

return (
<View
style={{
flex: 1,
justifyContent: "center",
alignItems: "center",
backgroundColor: "powderblue",
}}
>
<Button onPress={() => handleMetaMapClickButton()} title="Click here" />

);
};

What am I doing wrong?
I'm running the app via expo go.

@AvoSukiasyan
Copy link
Collaborator

@josephKredi for expo you should use this implementation https://www.npmjs.com/package/react-native-expo-metamap-sdk
and if it's expo you was using correct plugin. react-native-expo-metamap-sdk.
you can ping our support team about problem and they will schedule meeting and we'll look together

@michaelmiracle018
Copy link

cannot read property 'showFlow' of null

import fetchUserFromStorage from '#/shared/fetchUserFromStorage'
import {useEffect} from 'react'
import {NativeModules, NativeEventEmitter, Button, View} from 'react-native'

import {MetaMapRNSdk} from 'react-native-expo-metamap-sdk'

const UserVerification = () => {

useEffect(() => {
const MetaMapVerifyResult = new NativeEventEmitter(
NativeModules.MetaMapRNSdk,
)
MetaMapVerifyResult.addListener('verificationSuccess', data =>
console.log('hey', data),
)
MetaMapVerifyResult.addListener('verificationCanceled', data =>
console.log('judjj', data),
)
})
const handleMetaMapClickButton = props => {
MetaMapRNSdk.showFlow(
'610b96fb7cc893001b135505',
'611101668083a1001b13cc80',
)
}

// Add button to view graph
return (
<View
style={{
flex: 1,
justifyContent: 'center',
alignItems: 'center',
backgroundColor: 'powderblue',
}}>
<Button onPress={() => handleMetaMapClickButton()} title="Verify Here" />

)
}

export default UserVerification

i have even downgraded but still same error

@teampazi
Copy link

teampazi commented Jun 14, 2024

I have the same issue as well for over 2 weeks and it's blocking my project. Basically it doesn't export the right files from the module.

@AvoSukiasyan I am using expo and NativeModules.MetaMapRNSdk seems to be null all the time hence causing this new NativeEventEmitter(NativeModules.MetaMapRNSdk) to throw error of calling it with a null value

@AvoSukiasyan
Copy link
Collaborator

Hi @teampazi . Will look it today and get back to you as soon as posible

@AvoSukiasyan
Copy link
Collaborator

HI @teampazi .
The issue is fixed please use latest version of plugin 2.4.0

@teampazi
Copy link

HI @teampazi . The issue is fixed please use latest version of plugin 2.4.0

This issue is not fixed see screenshot

Screenshot 2024-06-21 at 12 17 29 PM Screenshot 2024-06-21 at 12 18 02 PM

image

@teampazi
Copy link

Has anyone been able to find solution to this problem because I have not for some reason this package isn't still recognized by my project. I am still unable to import the package because it doesn't seem to be installed even though i did

@Fran-Merce
Copy link

Fran-Merce commented Oct 17, 2024

Any updates on this? I have the same problem @AvoSukiasyan

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants