Skip to content

Commit 2c4b579

Browse files
authored
chore(example): update to expo 51
* chore(example): update to expo sdk 51 * chore(example): fix typescript issue * chore(example): fix jest config bug on lib * chore(example): fix jest config bug on example * chore(example): better transformIgnorePatterns on jest.config.js * chore(example): find real cause of tests bug: add react-native-tvos to jest transformIgnorePatterns * chore(example): adapt tveventhanler usage to react native tvos 0.74
1 parent d0a53b8 commit 2c4b579

7 files changed

Lines changed: 3257 additions & 5666 deletions

File tree

package.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
"@babel/preset-typescript": "^7.22.5",
1313
"@react-native-community/eslint-config": "^3.2.0",
1414
"@testing-library/react-native": "^12.4.3",
15-
"@types/react": "^18.2.14",
16-
"@types/react-dom": "^18.2.6",
15+
"@types/react": "~18.2.79",
16+
"@types/react-dom": "~18.2.25",
1717
"@typescript-eslint/eslint-plugin": "^5.60.1",
1818
"@typescript-eslint/parser": "^5.60.1",
1919
"@typescript-eslint/typescript-estree": "^5.61.0",
@@ -34,16 +34,16 @@
3434
"prettier": "^2.8.8",
3535
"style-loader": "^3.3.3",
3636
"ts-loader": "^9.4.4",
37-
"typescript": "^5.1.6",
37+
"typescript": "~5.3.3",
3838
"webpack": "^5.88.1",
3939
"webpack-cli": "^5.1.4",
4040
"webpack-dev-server": "^4.15.1"
4141
},
4242
"dependencies": {
4343
"@react-native-tvos/config-tv": "^0.0.4",
4444
"@react-navigation/bottom-tabs": "^6.5.11",
45-
"react": "^18.2.0",
46-
"react-dom": "^18.2.0",
45+
"react": "18.2.0",
46+
"react-dom": "18.2.0",
4747
"react-native-modal": "^13.0.1",
4848
"react-native-web": "^0.19.6"
4949
},

packages/example/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const packagesToTransform = [
1616
'react-native-(.*)',
1717
'@react-native',
1818
'@react-native-community',
19+
'@react-native-tvos',
1920
'@react-navigation',
2021
];
2122

packages/example/package.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -11,31 +11,31 @@
1111
"prebuild": "EXPO_TV=1 expo prebuild --clean"
1212
},
1313
"dependencies": {
14-
"@bam.tech/react-native-keyevent-expo-config-plugin": "^1.0.50",
14+
"@bam.tech/react-native-keyevent-expo-config-plugin": "^1.0.52",
1515
"@emotion/native": "^11.11.0",
1616
"@emotion/react": "^11.11.3",
17-
"@expo/metro-runtime": "~3.1.1",
17+
"@expo/metro-runtime": "~3.2.1",
1818
"@react-navigation/native": "^6.1.9",
1919
"@react-navigation/native-stack": "^6.9.17",
2020
"@types/jest": "^29.5.12",
2121
"@types/react-test-renderer": "^18.0.7",
2222
"babel-jest": "^29.7.0",
23-
"expo": "~50.0.3",
24-
"expo-status-bar": "~1.11.1",
23+
"expo": "~51.0.9",
24+
"expo-status-bar": "~1.12.1",
2525
"jest": "^29.7.0",
2626
"jest-environment-jsdom": "^29.7.0",
2727
"jest-watch-typeahead": "^2.2.2",
2828
"lucide-react-native": "^0.335.0",
2929
"react": "18.2.0",
30-
"react-native": "npm:react-native-tvos@0.73.2-0",
30+
"react-native": "npm:react-native-tvos@0.74.1-0",
3131
"react-native-keyevent": "^0.3.2",
32-
"react-native-safe-area-context": "^4.8.2",
33-
"react-native-screens": "^3.29.0",
34-
"react-native-svg": "^14.1.0",
32+
"react-native-safe-area-context": "4.10.1",
33+
"react-native-screens": "3.31.1",
34+
"react-native-svg": "15.2.0",
3535
"react-test-renderer": "^18.2.0"
3636
},
3737
"devDependencies": {
38-
"@babel/core": "^7.20.0",
38+
"@babel/core": "^7.24.0",
3939
"babel-plugin-module-resolver": "^5.0.0"
4040
},
4141
"private": true,

packages/example/src/components/remote-control/RemoteControlManager.ios.ts

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,12 @@ import { RemoteControlManagerInterface } from './RemoteControlManager.interface'
55

66
class RemoteControlManager implements RemoteControlManagerInterface {
77
constructor() {
8-
const _tvEventHandler = new TVEventHandler();
9-
_tvEventHandler.enable(undefined, this.handleKeyDown);
8+
TVEventHandler.addListener(this.handleKeyDown);
109
}
1110

1211
private eventEmitter = mitt<{ keyDown: SupportedKeys }>();
1312

14-
private handleKeyDown = (_: unknown, evt: HWEvent) => {
13+
private handleKeyDown = (evt: HWEvent) => {
1514
if (!evt) return;
1615

1716
const mappedKey = {

packages/lib/jest.config.js

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ const packagesToTransform = [
1616
'react-native-(.*)',
1717
'@react-native',
1818
'@react-native-community',
19+
'@react-native-tvos',
1920
'@react-navigation',
2021
];
2122

packages/lib/src/spatial-navigation/context/DeviceContext.tsx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ interface DeviceContextProps {
1717
/** Use `deviceTypeRef` for user events or if you don't need render, otherwise use `deviceType` */
1818
deviceTypeRef: React.MutableRefObject<Device>;
1919
setDeviceType: (deviceType: Device) => void;
20-
getScrollingIntervalId: () => NodeJS.Timer | null;
21-
setScrollingIntervalId: (scrollingId: NodeJS.Timer | null) => void;
20+
getScrollingIntervalId: () => NodeJS.Timeout | null;
21+
setScrollingIntervalId: (scrollingId: NodeJS.Timeout | null) => void;
2222
}
2323

2424
export const DeviceContext = createContext<DeviceContextProps>({
@@ -37,14 +37,14 @@ export const SpatialNavigationDeviceTypeProvider = ({ children }: DeviceProvider
3737
const [deviceType, setDeviceTypeWithoutRef] = useState<Device>('remoteKeys');
3838

3939
const deviceTypeRef = useRef<Device>(deviceType);
40-
const scrollingId = useRef<NodeJS.Timer | null>(null);
40+
const scrollingId = useRef<NodeJS.Timeout | null>(null);
4141

4242
const setDeviceType = useCallback((deviceType: Device) => {
4343
deviceTypeRef.current = deviceType;
4444
setDeviceTypeWithoutRef(deviceType);
4545
}, []);
4646

47-
const setScrollingIntervalId = useCallback((id: NodeJS.Timer | null) => {
47+
const setScrollingIntervalId = useCallback((id: NodeJS.Timeout | null) => {
4848
if (scrollingId.current) {
4949
clearInterval(scrollingId.current);
5050
}

0 commit comments

Comments
 (0)