React Native/74/Remove Deprecated Proptypes

1.0.1Last update Jul 16, 2024
by@manishjha-04

This codemod removes deprecated PropTypes from React Native components (e.g., Image, Text, TextInput), reducing app size and memory overhead, and preparing the codebase for modern type-checking solutions.

Example

Before

const MyComponent = ({ imageSource, labelText, placeholderText }) => (
<View>
<Image source={imageSource} />
<Text>{labelText}</Text>
<TextInput placeholder={placeholderText} />
</View>
);
MyComponent.propTypes = {
imageSource: Image.propTypes.source,
labelText: PropTypes.string,
placeholderText: PropTypes.string,
};
export default MyComponent;

After

const MyComponent = ({ imageSource, labelText, placeholderText }) => (
<View>
<Image source={imageSource} />
<Text>{labelText}</Text>
<TextInput placeholder={placeholderText} />
</View>
);
export default MyComponent;

Build custom codemods

Use AI-powered codemod studio and automate undifferentiated tasks for yourself, colleagues or the community

background illustrationGet Started Now