Quantcast
Channel: Active questions tagged react-native+ios - Stack Overflow
Viewing all articles
Browse latest Browse all 16552

Mapping object to dictionary using React Native iOS Module

$
0
0

I'm trying to call in my native iOS code (in swift) from React Native JavaScript.

Here's my JS snippet:

const identity = {
                  customerEmail: user.email,
                  customerName: `${user.firstName} ${user.lastName}`,
                };

                ChatModule.setupIdentity(identity);

Here's my native implementation:

@objc
func setupIdentity(customer: Dictionary<String, String>) {
    let identity = Identity.createAnonymous(name: customer["name"], email: customer["email"])
    Zendesk.instance?.setIdentity(identity)
}

While both implementations specific to their platforms are right and compile, I can't call into the native module and I'm sure it's related to the method signature being different between react native side and iOS native code.

I was wondering how do I send the correct type over? So it calls into the method properly. Otherwise, right now I'm getting ChatModule.setupIdentity is not a method.


Viewing all articles
Browse latest Browse all 16552

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>