Reputation: 628
My react-native-paper
component textInput
doesn't pull the fonts I set it.
<View style={styles.inputCon}>
<TextInput
multiline={true}
label="Ime aktivnosti"
mode="outlined"
value={ime}
onChangeText={(value) => {
setIme(value);
}}
/>
</View>
I've followed the official documentation on how to change the fonts for RN Paper components https://callstack.github.io/react-native-paper/fonts.html
const fontConfig = {
default: {
regular:{
fontFamily: "Poppins_400Regular",
fontWeight:'normal'
},
medium: {
fontFamily: "Poppins_500Medium",
fontWeight:'normal'
},
light: {
fontFamily: "Poppins_300Light",
fontWeight:'normal'
},
thin: {
fontFamily: "Poppins_200ExtraLight",
fontWeight:'normal'
},
bold: {
fontFamily: "Poppins_700Bold",
fontWeight:'normal'
}
},
};
const theme = {
...DefaultTheme,
fonts: configureFonts(fontConfig),
};
The other component, also from react native paper
pulls the font properly
<Searchbar
placeholder="Type here..."
onChangeText={text => this.searchItems(text)}
value={this.state.value}
/>
Upvotes: 0
Views: 2602
Reputation: 71
import { configureFonts, DefaultTheme, Provider as PaperProvider } from 'react-native-paper';
const theme = {
...DefaultTheme,
fontFamily: {...DefaultTheme.fonts.regular.fontFamily = 'fontName'}
};
export default class App extends Component {
render() {
const RootStack = createStackNavigator();
return (
<PaperProvider theme={theme}>
<SafeAreaProvider>
</SafeAreaProvider>
</PaperProvider>
);
}
react-native-cli: 2.0.1 react-native: 0.63.4
Upvotes: 1