Skip to content

IconButton, Appbar.Action, TextInput.Icon and FAB crash on a removed 5.x prop value instead of warning #5309

Backlog

Description

@Doberjohn

Current behaviour

A prop value that 6.x removed, passed from JavaScript or cast past the types, crashes the render with an error that names neither the prop nor the value that replaces it:

  • IconButton mode="contained" or "contained-tonal": TypeError: Cannot read properties of undefined (reading 'default').
  • A numeric size on IconButton, Appbar.Action or TextInput.Icon: TypeError: Cannot read properties of undefined (reading 'widths'), from IconButton/utils.ts.
  • FAB variant="tonalPrimary" or "surface": TypeError: Cannot read properties of undefined (reading 'container').

TypeScript reports each of these values. #5250 is the same problem for Button's removed modes.

Expected behaviour

An unknown mode, size or variant falls back to the default and warns in development, naming the prop and the value that replaces it.

How to reproduce?

  1. Inside PaperProvider, render one of these (JavaScript, or TypeScript with the value cast):
    • <IconButton icon="plus" mode="contained-tonal" onPress={() => {}} aria-label="Add" />
    • <Appbar><Appbar.Action icon="magnify" size={24} onPress={() => {}} aria-label="Search" /></Appbar>
    • <TextInput label="Search" startAccessory={(p) => <TextInput.Icon {...p} icon="magnify" size={20} />} />
    • <FAB icon="plus" variant="tonalPrimary" onPress={() => {}} aria-label="Add" />

Your Environment

software version
android, ios, web all
react-native 0.88.0
react-native-paper 6.0.0-alpha.4 (main at 7ab2640)
expo sdk 58
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions