I am writing app that uses react-native-immediate-phone-call and by pressing Pressable component I need to call function from that module.
import RNImmediatePhoneCall from 'react-native-immediate-phone-call';
export default function App() {
const [getNumber, setNumber] = useState('');
function makeCall() {
console.log('dialing');
return () => RNImmediatePhoneCall.immediatePhoneCall(getNumber);
}
...
return (
...
<Pressable onPress={()=>makeCall()}>
<Image source={require('./assets/phone-call.png')}/>
</Pressable>
...
);
}
Console log is displayed into terminal with Metro Bunler but return does not execute somehow. I am newbie into js and react. How function and function call should like?
At that moment
getNumber == ''So, I think
RNImmediatePhoneCall.immediatePhoneCall('')do nothing.Also, try with this (will be work when
getNumberhas a value)EDIT:
Still, nothing happens, I find a solution from their issues
First, check your phone permission for call: In the AndroidManifest.xml Then add the following lines
If still not working, do follow the steps
In settings.gradle after
rootProject.name = 'YOUR_PROJ_NAME'add the following lineIn build.gradle Inside the dependencies section insert the following line
In AndroidManifest.xml add the following line with all other user-permissions
In MainActivity.java import this
inside the class, MainActivity add the following override (include the "@override" for some reason it's not in the same block with the rest of the code)