continued error reference to Expo SDK 33 version

I changed some things up a bit, added more logic, but still get this error citing the HeaderButton.

TypeError: TypeError: (0, _native.useTheme) is not a function. (In '(0, _native.useTheme)()', '(0, _native.useTheme)' is undefined)
- node_modules\react-navigation-header-buttons\src\HeaderButton.js:41:27 in HeaderButton
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:9473:27 in renderWithHooks
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:11994:6 in mountIndeterminateComponent
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:17276:21 in performUnitOfWork
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:17316:41 in workLoop
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:17417:15 in renderRoot
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:18423:17 in performWorkOnRoot
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:18324:24 in performWork
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:18285:14 in performSyncWork
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:18169:19 in requestWork
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:17969:16 in scheduleWork
- node_modules\react-native\Libraries\Renderer\oss\ReactNativeRenderer-dev.js:10221:17 in dispatchAction
* App.js:35:24 in onFinish

It looks like maybe an import statement is wrong somewhere, which could imply that a version of one of the packages is wrong. I suggest double checking the package versions :neutral_face:

Thanks. Let me take a look at that. Do you think that import statement is in the App.js file or just another one referencing the Header component?

In looking at the HeaderButton in the node mods imported in ‘’
I see this set of statements:

import * as React from 'react';
import { StyleSheet, View, TouchableWithoutFeedback, Platform } from 'react-native';
import TouchableItem from './TouchableItem';
import type { ViewStyleProp } from 'react-native/Libraries/StyleSheet/StyleSheet';
import { useTheme } from '@react-navigation/native';

that ViewStyleProp has a red squiggly line in it in VSCode and says it can only be used in TypeScript files. Any way to alter the js file in the Node mod and rebuild?

if you see an error that refers to expo sdk 33 please update to the latest version of expo-cli: 4.4.6

1 Like

Will that still allow me to run an old React Native 4 app on SDK33?

sure, although i’d recommnd upgrading

Definitely the plan, and not just the plan, it will happen. I’m learning on an RN4 build first.

Thanks, Brent!

The “SDK 33” issue in this case was actually because the app.json contained a reference to that version while package.json referred to SDK 34. The problem has moved on from there. I suppose a new thread should ideally have been opened to discuss the other issues.

You should generally not need to worry about what’s in node_modules. You might rarely need to patch something there, but you shouldn’t need to in this case.

At this point I think it might be best to work on upgrading to React Navigation 5, because I’m really not sure what’s causing the current issue with the HeaderButton. Then maybe start a new thread if you run into issues.

1 Like

ah gotcha, sorry

1 Like

Thanks, wodin. We are/I am getting closer to converting the app in question to RN5. Some really good news. I’ll refrain from posting all of the code and solutions do to what you mentioned about starting a new thread on the matter. I managed to successfully download the instructor’s final version, then I did the following:
ran a plain npm install with the thought of getting the dependencies.
Not all came through, so I then ran separate expo install cmds on a few pkgs missing, Much to my pleasant surprise, the app NOW WORKS! I could not believe it. Didn’t think I’d ever get it to work, at all. What I plan to do now is individually delete the node mods that I have in my ver that seem superfluous, then see if it works. I’ll also compare all of his redux code with mine to ensure it will work. Feeling more encouraged about this now, and perhaps now, we can close the thread for the time being, and I’ll later start a new one as events warrant.
Thanks, guys!

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.