Invariant Violation: requireNativeComponent: "ViewManagerAdapter_ExpoLinearGradient" was not found in the UIManager.
This is because some of the packages (peer dependencies of 3rd parties) use a different version of expo-linear-gradient
. You can solve this by adding the version you want to use in the resolutions
section of package.json
"resolutions": {
"expo-linear-gradient": "~11.4.0"
}
There is a new react-native-tvos
package that was created on top of react-native
package. So the releases also will be based on a public release of react-native
. To fix the actual issue on TVs you should change your package.json
imports to import react-native
as follows, so that this package is used instead of the core react-native
package.
"react-native": "npm:react-native-tvos@latest"
Details at https://github.com/react-native-tvos/react-native-tvos
You solved the onFocus
and onBlur
issues on Expo Go but now it doesn't work on TVs with generated/published/development APKs
Because expo
is reverting your react-native
import in package.json
back to the original package while it's extracting the android
folder to build the app. This will cause the following error:
> Task :app:compileDebugJavaWithJavac FAILED
PROJECT_PATH/android/app/src/main/java/com/abdullahceylan/project_name/newarchitecture/MainApplicationReactNativeHost.java:109: error: cannot find symbol
ReactNativeConfig.DEFAULT_CONFIG,
^
symbol: variable DEFAULT_CONFIG
location: interface ReactNativeConfig
PROJECT_PATH/android/app/src/main/java/com/abdullahceylan/project_name/MainActivity.java:76: error: method does not override or implement a method from a supertype
@Override
^
Note: PROJECT_PATH/android/app/src/debug/java/com/abdullahceylan/project_name/ReactNativeFlipper.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
2 errors
FAILURE: Build failed with an exception.
To fix this issue, you need to run the android build with --template
arg to use the tvOS template.
So instead of expo run:android
use expo prebuild --template https://github.com/abdullahceylan/expo-template-bare-minimum-tvos
first.
This will use the tvOS compatible template to build your app.
You also need to update your eas.json
file to modify your prebuild
command for EAS Builds:
"prebuildCommand": "prebuild --template https://github.com/abdullahceylan/expo-template-bare-minimum-tvos --no-install"
This is due to the react-native-reanimated
package. Confirm that you have added react-native-reanimated
into resolutions
section of package.json
file and make sure that the dependencies
and resolution
section versions are matching:
"dependencies": {
.... other packages
"react-native-reanimated": "2.10.0",
.... other packages
},
"resolutions": {
"react-native-reanimated": "2.10.0",
}
If you are seeing a blank screen when you use React Navigation, probably you have wrapped the Navigation
with a View
. Try to remove that to solve the issue.
Before
<View>
<Navigation />
</View>
After
<Navigation />
If you are getting this error when you try to run on Android, check with the service whose TCP is listening on 5554 + 1 = 5555. This service probably causing the automatic start of the Android emulator.
sudo lsof -i -P | grep LISTEN
Identify the process and kill that process with PID by running:
sudo kill -9 PID_NUMBER
Then everything should be fine.
Run:
rm -vfr ~/.android/avd/[AVD name].avd/*.lock
Invariant Violation: requireNativeComponent: "ViewManagerAdapter_ExpoLinearGradient" was not found in the UIManager.
Faced some issues with iOS build, then resolved by fixing incorrect place of
expo_patch_react_imports
onProfile.lock
. See correct place there (Expo docs).