Library to detect if the device is in silent mode
npm install react-native-silent
import Silent from "react-native-silent";
// ...Inside your functional component
const getIsEnabled = () => {
Silent.isEnabled().then((value) => {
console.log('isEnabledValue changed', value);
setIsEnabledValue(value);
});
};
React.useEffect(() => {
getIsEnabled();
const listener = Silent.addListener((status) => {
console.log('silentStatus changed', status);
setSilentStatus(status);
});
() => {
if (listener) {
Silent.removeListener(listener);
}
};
}, []);
See the contributing guide to learn how to contribute to the repository and the development workflow.
MIT