Skip to content

Commit 782474c

Browse files
authored
Fix typescript errors before release (#42)
1 parent 0f96782 commit 782474c

File tree

5 files changed

+15
-20
lines changed

5 files changed

+15
-20
lines changed

example/src/AudioPlayer.tsx

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
import React, { useEffect, useState, useRef } from 'react';
2-
import { View, Button, Text } from 'react-native';
3-
import Video from 'react-native-video';
2+
import { View, Button, Text, StyleSheet } from 'react-native';
3+
import Video, { type VideoRef } from 'react-native-video';
44
import { monitorFileTransfers } from 'react-native-wear-connectivity';
55

66
const AudioPlayer = () => {
77
const [isPlaying, setIsPlaying] = useState(false);
8-
const playerRef = useRef<Video>(null);
8+
const playerRef = useRef<VideoRef>(null);
99
const [fileUri, setFileUri] = useState<string | null>(null);
1010
useEffect(() => {
1111
const cancel = monitorFileTransfers((transferInfo) => {
@@ -30,7 +30,7 @@ const AudioPlayer = () => {
3030
paused={!isPlaying}
3131
onEnd={() => setIsPlaying(false)}
3232
onError={(e) => console.log('Audio error:', e)}
33-
style={{ height: 0 }} // Hide video UI
33+
style={styles.videoStyle} // Hide video UI
3434
/>
3535
<Button
3636
title={isPlaying ? 'Pause' : 'Play'}
@@ -42,4 +42,10 @@ const AudioPlayer = () => {
4242
);
4343
};
4444

45+
const styles = StyleSheet.create({
46+
videoStyle: {
47+
height: 0,
48+
},
49+
});
50+
4551
export default AudioPlayer;

example/src/CounterScreen/index.android.tsx

Lines changed: 2 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,7 @@
1-
import React, { useEffect, useState } from 'react';
2-
import {
3-
View,
4-
StyleSheet,
5-
Text,
6-
Button,
7-
DeviceEventEmitter,
8-
} from 'react-native';
1+
import React, { useEffect } from 'react';
2+
import { View, StyleSheet, Text, Button } from 'react-native';
93
import { launchImageLibrary } from 'react-native-image-picker';
104
import {
11-
monitorFileTransfers,
125
startFileTransfer,
136
sendMessage,
147
watchEvents,

example/src/components/ImagePicker.tsx

Whitespace-only changes.

src/index.tsx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@ const WearConnectivity = WearConnectivityModule
3333
}
3434
);
3535

36-
const startFileTransfer: SendFile = (file, metadata) => {
37-
return WearConnectivity.sendFile(file);
36+
const startFileTransfer: SendFile = (file, _metadata) => {
37+
return WearConnectivity.sendFile(file, _metadata);
3838
};
3939

4040
export { startFileTransfer, sendMessage, watchEvents, WearConnectivity };

src/subscriptions.ts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,14 @@ import { NativeModules, NativeEventEmitter, Platform } from 'react-native';
22
import type { AddListener, WatchEvents } from './types';
33
import { LIBRARY_NAME, IOS_NOT_SUPPORTED_WARNING } from './constants';
44

5-
const _addListener: AddListener = (event, cb, reply) => {
5+
const _addListener: AddListener = (event, cb) => {
66
const nativeWatchEventEmitter = new NativeEventEmitter(
77
NativeModules.AndroidWearCommunication
88
);
99
if (!event) {
1010
throw new Error('Must pass event');
1111
}
1212

13-
if (reply != null) {
14-
console.log('watchEvents.on does not support reply on Android');
15-
}
16-
1713
switch (event) {
1814
case 'message':
1915
break;

0 commit comments

Comments
 (0)