miyabi / react-native-passkit-wallet

React Native module to handle PassKit.
MIT License
49 stars 37 forks source link

“Native module cannot be null” #7

Open labadze opened 5 years ago

labadze commented 5 years ago

Hello, I'm trying to implement PassKit wallet to my app. I'm using expo, so. where is no iOS Android folders, so I'm getting this error “Native module cannot be null”, This error is located in PassKit.ios.js on line 10. After this I detached app and implemented everything like in. manual but getting same error.

ikas commented 5 years ago

Having the same problem, in simulator works fine, but on real iOS device throws "Native module cannot be null."

VamshiKyra commented 5 years ago

pod 'react-native-passkit-wallet', :path => '../node_modules/react-native-passkit-wallet' in Pod file => pod install

labadze commented 5 years ago

Wrote native wallet implementation and implemented it.

alvarosilvac commented 5 years ago

Still having issues after linking it directly in the Pod file. Any other solution?

miyabi commented 5 years ago

I couldn't reproduce the error.

This is how I tested:

$ react-native init RNPW
$ cd RNPW
$ npm i --save react-native-passkit-wallet@git://github.com/miyabi/react-native-passkit-wallet.git
$ cd ios
$ pod init
# Follow this instruction: https://github.com/miyabi/react-native-passkit-wallet#cocoapods
# Remove RNPW-tvOSTests block from the target 'RNPW'
$ pod install

App.js would be like this:

import React, {Component} from 'react';
import {Platform, StyleSheet, Text, View} from 'react-native';
import PassKit, { AddPassButton } from 'react-native-passkit-wallet'

type Props = {};
export default class App extends Component<Props> {
  componentDidMount() {
    PassKit.canAddPasses()
      .then((result) => {
        console.log(result)
      });
  }

  render() {
    return (
      <View style={styles.container}>
        <AddPassButton
          style={styles.addPassButton}
          addPassButtonStyle={PassKit.AddPassButtonStyle.black}
          onPress={() => { console.log('onPress') }}
        />
      </View>
    );
  }
}

const styles = StyleSheet.create({
  container: {
    flex: 1,
    justifyContent: 'center',
    alignItems: 'center',
    backgroundColor: '#F5FCFF',
  },
  addPassButton: {
    width: PassKit.AddPassButtonWidth,
    height: PassKit.AddPassButtonHeight,
  },
});

Could you provide more details?

liuxiaofeng1981 commented 4 years ago

Hello all, I'm having the same error 'Native module cannot be null'. And I'm new to RN and I'm using Expo. Is there a way to use this package in an Expo app without ejecting?

liuxiaofeng1981 commented 4 years ago

Hi @labadze , could you share how you got around this issue pls?

luluhoc commented 1 year ago

having the same problem with expo

ottosamatori commented 7 months ago

news about this problems ?