andreyvital / react-native-android-sms-listener

Allows you to listen for incoming SMS messages using React Native
MIT License
358 stars 99 forks source link

Not working with latest react native version #61

Open 1mehdifaraji opened 2 years ago

1mehdifaraji commented 2 years ago

"react": "17.0.2", "react-native": "0.66.1", "react-native-android-sms-listener": "^0.8.0",

mouhsnimohamed commented 2 years ago

didn't work for me either "react-native": "0.67.4", "react-native-android-sms-listener": "^0.8.0"

rafaelgp87 commented 2 years ago

Add the next lines in this path: src/types/declarations.d.ts

declare module 'react-native-android-sms-listener' {
  interface SmsListener {
    addListener: (handler: (value: string) => any) => import("react-native").EmitterSubscription;
    remove: () => void;
  }

  const SmsListener: SmsListener;
  export default SmsListener;
}

Remember, Google Play no longer allows you to use the READ_SMS and RECEIVE_SMS permissions (easily), so I recommend using another library if you're uploading your app to Google Play.

mouhsnimohamed commented 2 years ago

Thank you for your answer but I think this is not a Typescript problem! I already used sms-retriever without any permission and it worked but my client doesn't want to change the content of the SMS by adding the hash string as mentioned in the official doc.

mouhsnimohamed commented 2 years ago

Add the next lines in this path: src/types/declarations.d.ts

declare module 'react-native-android-sms-listener' {
  interface SmsListener {
    addListener: (handler: (value: string) => any) => import("react-native").EmitterSubscription;
    remove: () => void;
  }

  const SmsListener: SmsListener;
  export default SmsListener;
}

Remember, Google Play no longer allows you to use the READ_SMS and RECEIVE_SMS permissions (easily), so I recommend using another library if you're uploading your app to Google Play.

Thank you for your answer but I think this is not a Typescript problem! I already used sms-retriever without any permission and it worked but my client doesn't want to change the content of the SMS by adding the hash string as mentioned in the official doc.