You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, simply by inspection, the failure mode should be clear. There's an async call that sets state on completion - this is a classic React error if done within a component.
The text was updated successfully, but these errors were encountered:
I acknowledge that it's possible that one should not use useFonts in anything but the highest level component, but if that's the case, the docs should probably be updated to emphasize this.
Thank you for filing this issue!
This comment acknowledges we believe this may be a bug and there’s enough information to investigate it.
However, we can’t promise any sort of timeline for resolution. We prioritize issues based on severity, breadth of impact, and alignment with our roadmap. If you’d like to help move it more quickly, you can continue to investigate it more deeply and/or you can open a pull request that fixes the cause.
Summary
The
useFont
hook uses auseEffect
hook to load fonts asynchronously.Once they are loaded, it calls a
useState
modifier.Since this is an async call, attempting to modify the hook state can occur after the containing component has been unmounted, resulting in a warning.
The desired behaviour should be that the hook does not attempt to modify state when it is unmounted.
What platform(s) does this occur on?
Web
Environment
expo-env-info 1.0.5 environment info:
System:
OS: macOS 13.0.1
Shell: 5.8.1 - /bin/zsh
Binaries:
Node: 16.13.0 - ~/.nvm/versions/node/v16.13.0/bin/node
Yarn: 1.22.19 - ~/.yarn/bin/yarn
npm: 8.1.0 - ~/.nvm/versions/node/v16.13.0/bin/npm
Watchman: 2022.11.28.00 - /opt/homebrew/bin/watchman
Managers:
CocoaPods: 1.11.3 - /opt/homebrew/bin/pod
SDKs:
iOS SDK:
Platforms: DriverKit 22.2, iOS 16.2, macOS 13.1, tvOS 16.1, watchOS 9.1
IDEs:
Xcode: 14.2/14C18 - /usr/bin/xcodebuild
npmGlobalPackages:
eas-cli: 2.9.0
expo-cli: 6.0.8
Expo Workflow: managed
Minimal reproducible example
This is a hard issue to reproduce since it's timing based.
This Snack shows the issue in principle:
https://snack.expo.dev/6OBRLWb9h
However, simply by inspection, the failure mode should be clear. There's an async call that sets state on completion - this is a classic React error if done within a component.
The text was updated successfully, but these errors were encountered: