I am using ReactNativePaper and their fonts/typography unfortunately is not playing along well with custom named text variants.
I thought I would try to extend or override the MD3TypescaleKey by making a new react-native-paper.d.ts
file in the root of my project:
import 'react-native-paper';
declare module 'react-native-paper' {
export const enum MD3TypescaleKey {
default = 'default',
bodyXS = 'bodyXS',
bodySmall = 'bodySmall',
bodyMedium = 'bodyMedium',
bodyLarge = 'bodyLarge',
bodyXSBold = 'bodyXSBold',
bodySmallBold = 'bodySmallBold',
bodyMediumBold = 'bodyMediumBold',
bodyLargeBold = 'bodyLargeBold',
titleXS = 'titleXS',
titleSmall = 'titleSmall',
titleMedium = 'titleMedium',
titlelarge = 'titlelarge',
headlineXS = 'headlineXS',
headlineSmall = 'headlineSmall',
headlineMedium = 'headlineMedium',
headlineLarge = 'headlineLarge',
headlineXL = 'headlineXL',
displaySmall = 'displaySmall',
displayMedium = 'displayMedium',
displayLarge = 'displayLarge',
button = 'button',
inputLabel = 'inputLabel',
}
}
I am not sure if because an enum, but now all other references to the library, such as import { Card } from 'react-native-paper'
are failing due to Card
not being exported:
Module '"react-native-paper"' has no exported member 'Card'.ts(2305)
I have solved this before from react-native-elements, but it was an interface, not an enum.
Any ideas?