Skip to content

callstack/react-native-paper-codemod

Repository files navigation

react-native-paper-codemod

Build Status MIT License PRs Welcome Chat

Setup & Run

  1. yarn global add jscodeshift
  2. git clone https://github.com/callstack/react-native-paper-codemod.git or download a zip file from https://github.com/callstack/react-native-paper-codemod/archive/master.zip
  3. Run yarn install in the react-native-paper-codemod directory
  4. jscodeshift -t <codemod-script> <path>
    • codemod-script - path to the transform file, see available scripts below;
    • path - files or directory to transform;
    • use the -d option for a dry-run and use -p to print the output for comparison;
    • use the --extensions option if your files have different extensions than .js (for example, --extensions js,jsx);
    • if you use flowtype, you might also need to use --parser=flow;
    • see all available jscodeshift options.

Included scripts

material-next

Migrate codebase using react-native-paper v1.0 to v2.0. The full list of breaking changes can be found here.

jscodeshift -t react-native-paper-codemod/transforms/material-next.js <path>

material-next script supports following transforms:

It will rename imports and jsx tags:

  • ToolbarAppbar.Header
  • ToolbarBackActionAppbar.BackAction
  • ToolbarContentAppbar.Content
  • CardActionsCard.Actions
  • CardContentCard.Content
  • CardCoverCard.Cover
  • DialogActionsDialog.Actions
  • DialogContentDialog.Content
  • DialogScrollAreaDialog.ScrollArea
  • DialogTitleDialog.Title
  • DrawerItemDrawer.Item
  • DrawerSectionDrawer.Section
  • FABGroupFAB.Group
  • ListAccordionList.Accordion
  • ListItemList.Item
  • ListSectionList.Section
  • RadioButtonGroupRadioButton.Group
  • PaperSurface
  • SearchBarSearchbar

It will wrap in Portal components that are no longer wrapped in Portal by default.

It will remove color prop from DrawerItem component and set the proper color via theme prop.

Contributing

Read the contribution guidelines before contributing.

About

No description, website, or topics provided.

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published