-
Notifications
You must be signed in to change notification settings - Fork 112
React Native Example: prompt user to enable voice isolation #207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
twitchard
merged 7 commits into
main
from
twitchard/react-native-voice-isolation-prompt
Sep 23, 2025
Merged
Changes from 2 commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
49bcb76
wip
twitchard 210ce4b
Update deps
twitchard f8a4b95
do not proceed until user answers
twitchard 1635932
fix url
twitchard 3ed6990
wip
twitchard 01aecd3
wip
twitchard 31b6956
remove unused dep
twitchard File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import React from 'react'; | ||
import { | ||
View, | ||
Text, | ||
Button, | ||
Linking, | ||
Platform, | ||
} from 'react-native'; | ||
import Modal from 'react-native-modal'; | ||
import NativeAudio from './modules/audio'; | ||
|
||
interface VoiceIsolationModePromptProps { | ||
isVisible: boolean; | ||
currentMode: string; | ||
onDismiss: () => void; | ||
} | ||
|
||
const VoiceIsolationModePrompt: React.FC<VoiceIsolationModePromptProps> = ({ | ||
isVisible, | ||
currentMode, | ||
onDismiss, | ||
}) => { | ||
const handleOpenSettings = async () => { | ||
if (Platform.OS === 'ios') { | ||
try { | ||
await NativeAudio.showMicrophoneModes(); | ||
} catch (error) { | ||
// Fallback to general settings if the API is not available | ||
Linking.openSettings(); | ||
} | ||
} else { | ||
Linking.openSettings(); | ||
} | ||
onDismiss(); | ||
}; | ||
|
||
const handleShowMeHow = () => { | ||
const supportUrl = 'https://support.apple.com/guide/iphone/aside/iph45075b5b2/ios'; | ||
Linking.openURL(supportUrl); | ||
}; | ||
|
||
return ( | ||
<Modal | ||
isVisible={isVisible} | ||
onBackdropPress={onDismiss} | ||
> | ||
<View style={{ backgroundColor: 'white', padding: 20 }}> | ||
<Text>Enable voice isolation for the best experience</Text> | ||
|
||
<Text> | ||
Your device is currently using a {currentMode} microphone mode. | ||
Enabling voice isolation will provide the best audio experience | ||
in a noisy setting. | ||
</Text> | ||
|
||
<Button title="Open settings" onPress={handleOpenSettings} /> | ||
<Button title="Show me how" onPress={handleShowMeHow} /> | ||
<Button title="I'll do this later" onPress={onDismiss} /> | ||
</View> | ||
</Modal> | ||
); | ||
}; | ||
|
||
export default VoiceIsolationModePrompt; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.