Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ViewPropTypes will be removed from React Native #1186

Closed
SmileYang966 opened this issue Oct 27, 2022 · 2 comments
Closed

ViewPropTypes will be removed from React Native #1186

SmileYang966 opened this issue Oct 27, 2022 · 2 comments

Comments

@SmileYang966
Copy link

Issue1 :
ViewPropTypes will be removed from React Native. Migrate to ViewPropTypes exported from 'deprecated-react-native-prop-types

solution:

  1. yarn add deprecated-react-native-prop-types
  2. We have to modify the source code, open every js source file, and do the following replacment
    import {ViewPropTypes} from 'deprecated-react-native-prop-types';
    or not
    const { ViewPropTypes } = ReactNative = require('react-native');

Issue2:
TypeError: undefined is not an object (evaluating '_reactNative.Text.propTypes.style')
const ScrollableTabBar = createReactClass({
propTypes: {
goToPage: PropTypes.func,
activeTab: PropTypes.number,
tabs: PropTypes.array,
backgroundColor: PropTypes.string,
activeTextColor: PropTypes.string,
inactiveTextColor: PropTypes.string,
scrollOffset: PropTypes.number,
style: ViewPropTypes.style,
tabStyle: ViewPropTypes.style,
tabsContainerStyle: ViewPropTypes.style,
textStyle: Text.propTypes.style,
renderTab: PropTypes.func,
underlineStyle: ViewPropTypes.style,
onScroll: PropTypes.func,
},

textStyle: Text.propTypes.style ,I just choose to replace it by 'textStyle: ViewPropTypes.style', it work and the error was gone
You might need to change this in many source files.

Issue3:
ScrollView.getNode is undefined

We need to find the source code in react-native-scrollable-tab-view folder,
this.scrollView.getNode().scrollTo change to this.scrollView.scrollTo,
just remove the getNode() , error was gone.

Hope it can help you.

@biaji
Copy link

biaji commented Oct 27, 2022

Text.propTypes.style,

should be replaced by:

const { TextPropTypes } = require('deprecated-react-native-prop-types');

@ptomasroos
Copy link
Owner

This has been resolved with #1185

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants