Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use ReactNativeStyleAttributes to process fontFamily #823

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/native-stack/views/FontProcessor.expo.tsx

This file was deleted.

9 changes: 8 additions & 1 deletion src/native-stack/views/FontProcessor.tsx
@@ -1,6 +1,13 @@
// do nothing outside of expo
// @ts-ignore: No declaration available
import ReactNativeStyleAttributes from 'react-native/Libraries/Components/View/ReactNativeStyleAttributes';

export function processFonts(
fontFamilies: (string | undefined)[]
): (string | undefined)[] {
// @ts-ignore: React Native types are incorrect here and don't consider fontFamily a style value
const fontFamilyProcessor = ReactNativeStyleAttributes.fontFamily?.process;
if (typeof fontFamilyProcessor === 'function') {
return fontFamilies.map(fontFamilyProcessor);
}
return fontFamilies;
}