Skip to content

Commit

Permalink
feat(example): copy to clipboard for logs
Browse files Browse the repository at this point in the history
  • Loading branch information
jhen0409 committed Nov 7, 2024
1 parent b2d5f52 commit 089e57f
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions example/src/Bench.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import {
Pressable,
} from 'react-native'
import RNFS from 'react-native-fs'
import Clipboard from '@react-native-clipboard/clipboard'
import { initWhisper } from '../../src' // whisper.rn
import contextOpts from './context-opts'

Check failure on line 13 in example/src/Bench.tsx

View workflow job for this annotation

GitHub Actions / test-android

'contextOpts' is defined but never used

Check failure on line 13 in example/src/Bench.tsx

View workflow job for this annotation

GitHub Actions / test-android

'contextOpts' is defined but never used

Expand Down Expand Up @@ -345,13 +346,19 @@ export default function Bench() {
>
<Text style={styles.buttonText}>Run benchmark</Text>
</Pressable>
<View style={styles.logContainer}>
<Pressable
style={({ pressed }: { pressed: boolean }) => [
styles.logContainer,
{ backgroundColor: pressed ? '#ccc' : 'lightgray', opacity: pressed ? 0.75 : 1 },
]}
onPress={() => Clipboard.setString(logs.join('\n'))}
>
{logs.map((msg, index) => (
<Text key={index} style={styles.logText}>
{msg}
</Text>
))}
</View>
</Pressable>
<View style={styles.buttonContainer}>
<Pressable style={styles.button} onPress={() => setLogs([])}>
<Text style={styles.buttonText}>Clear Logs</Text>
Expand Down

0 comments on commit 089e57f

Please sign in to comment.