Skip to content

Warning: Error: Variant titleLarge was not provided properly. Valid variants are regular, medium, light, thin.Β #4589

@ACDC5

Description

@ACDC5

Current behaviour

After yarn react-native run-android is run, the following error occurs:
Image

Preview

index.js

import { AppRegistry } from 'react-native';
import { PaperProvider } from 'react-native-paper';
import App from './App';
....
export default function Main() {
    return (
        <PaperProvider theme={appTheme}>
            <App />
        </PaperProvider>
    );
}
AppRegistry.registerComponent(appName, () => Main)

App.js

import { View, StyleSheet, TouchableOpacity } from 'react-native';
import { Appbar, Text, useTheme } from 'react-native-paper';
...
const createStyles = (theme) => StyleSheet.create({
    container: {
        flex: 1,
        justifyContent: 'flex-start',
        backgroundColor: theme.colors.background,
    },
});

const App = () => {
    const theme = useTheme();

    const styles = createStyles(theme);

    const [klineData, setKlineData] = useState([]);
    ...
    useEffect(() => {
        const fetchKlineData = async () => {
            try {
                const response = await api.get('/lines', {
                });
                setKlineData(response);
            } catch (error) {
                setError(error);
            }
        };

        fetchKlineData();
    }, []);

    const handleTitlePress = () => { };

    return (
        <View style={styles.container}>
            <Appbar.Header >
                <TouchableOpacity onPress={handleTitlePress}>
                    <Appbar.Content title={tradingPair} />
                </TouchableOpacity>
            </Appbar.Header>
            <Text style={{ color: theme.colors.primary }}>show data</Text>
        </View>
    );
};
export default App

My attempt

I tried changing the <Appbar.Content title={tradingPair} /> in app.js to the following:
<Appbar.Content title={tradingPair} titleVariant="'titleMedium'" />
But the error still exists

Environment

software version
OS windows 11
ios x
android 9
react-native 0.76.5
react-native-paper ^5.12.5
node v18.20.5
yarn 1.22.22
expo sdk x.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions