(WrappedCompone
hoistStatics(BaseComponent, WrappedComponent);
BaseComponent.displayName = WrappedComponent.displayName;
BaseComponent.propTypes = WrappedComponent.propTypes;
+ // @ts-expect-error class component have defaultProps and functions do not and so should not be affected by this
BaseComponent.defaultProps = WrappedComponent.defaultProps;
const ThemeContext = ThemeManager.getThemeContext();
if (ThemeContext) {
diff --git a/packages/react-native-ui-lib/src/commons/baseComponent.tsx b/packages/react-native-ui-lib/src/commons/baseComponent.tsx
index 180129297c..73bdad4672 100644
--- a/packages/react-native-ui-lib/src/commons/baseComponent.tsx
+++ b/packages/react-native-ui-lib/src/commons/baseComponent.tsx
@@ -1,5 +1,4 @@
import React, {ComponentType} from 'react';
-// import PropTypes from 'prop-types';
import {StyleSheet} from 'react-native';
import _ from 'lodash';
import {Colors} from '../style';
@@ -8,17 +7,9 @@ import * as Modifiers from './modifiers';
export default function baseComponent(usePure: boolean): ComponentType {
const parent = usePure ? React.PureComponent : React.Component;
class BaseComponent extends parent {
- // static propTypes = {
- // ..._.mapValues(Typography, () => PropTypes.bool),
- // ..._.mapValues(Colors, () => PropTypes.bool),
- // useNativeDriver: PropTypes.bool,
- // };
-
styles: any;
view: any;
- static extractOwnProps = Modifiers.extractOwnProps;
-
constructor(props: any) {
super(props);
if (!this.styles) {
diff --git a/packages/react-native-ui-lib/src/commons/forwardRef.tsx b/packages/react-native-ui-lib/src/commons/forwardRef.tsx
index 38b08d8bfa..526b7469c8 100644
--- a/packages/react-native-ui-lib/src/commons/forwardRef.tsx
+++ b/packages/react-native-ui-lib/src/commons/forwardRef.tsx
@@ -17,10 +17,7 @@ export default function forwardRef(WrappedC
const ForwardedComponent = React.forwardRef(forwardRef);
hoistStatics(ForwardedComponent, WrappedComponent);
- //@ts-ignore
ForwardedComponent.displayName = WrappedComponent.displayName;
- //@ts-ignore
- ForwardedComponent.defaultProps = WrappedComponent.defaultProps;
return ForwardedComponent as typeof ForwardedComponent & STATICS;
}
diff --git a/packages/react-native-ui-lib/src/commons/modifiers.ts b/packages/react-native-ui-lib/src/commons/modifiers.ts
index 1815b21305..7117654191 100644
--- a/packages/react-native-ui-lib/src/commons/modifiers.ts
+++ b/packages/react-native-ui-lib/src/commons/modifiers.ts
@@ -338,27 +338,6 @@ export function extractModifierProps(props: Dictionary) {
return modifierProps;
}
-/**
- * TODO:
- * @deprecated switch to Modifiers#extractComponentProps
- */
-export function extractOwnProps(props: Dictionary, ignoreProps: string[]) {
- //@ts-ignore
- const ownPropTypes = this.propTypes;
- const ownProps = _.flow((props: Dictionary) => _.pickBy(props, (_value, key) => _.includes(Object.keys(ownPropTypes), key)),
- props => _.omit(props, ignoreProps))(props);
-
- return ownProps;
-}
-
-export function extractComponentProps(component: any, props: Dictionary, ignoreProps: string[] = []) {
- const componentPropTypes = component.propTypes;
- const componentProps = _.flow((props: Dictionary) => _.pickBy(props, (_value, key) => _.includes(Object.keys(componentPropTypes), key)),
- props => _.omit(props, ignoreProps))(props);
-
- return componentProps;
-}
-
export function getComponentName(componentDisplayName: string) {
//@ts-ignore
return componentDisplayName || this.displayName || this.constructor.displayName || this.constructor.name;
diff --git a/packages/react-native-ui-lib/src/commons/withScrollEnabler.tsx b/packages/react-native-ui-lib/src/commons/withScrollEnabler.tsx
index 2bdc77ebdc..8cd4e34fbb 100644
--- a/packages/react-native-ui-lib/src/commons/withScrollEnabler.tsx
+++ b/packages/react-native-ui-lib/src/commons/withScrollEnabler.tsx
@@ -69,8 +69,6 @@ function withScrollEnabler(WrappedComponent: React.Componen
hoistStatics(ScrollEnabler, WrappedComponent);
ScrollEnabler.displayName = WrappedComponent.displayName;
- //@ts-ignore
- ScrollEnabler.defaultProps = WrappedComponent.defaultProps;
return forwardRef(ScrollEnabler) as any;
}
diff --git a/packages/react-native-ui-lib/src/commons/withScrollReached.tsx b/packages/react-native-ui-lib/src/commons/withScrollReached.tsx
index ea1da67579..56fde6f8ef 100644
--- a/packages/react-native-ui-lib/src/commons/withScrollReached.tsx
+++ b/packages/react-native-ui-lib/src/commons/withScrollReached.tsx
@@ -92,8 +92,6 @@ function withScrollReached(WrappedComponent: React.Componen
hoistStatics(ScrollReachedDetector, WrappedComponent);
ScrollReachedDetector.displayName = WrappedComponent.displayName;
- //@ts-ignore
- ScrollReachedDetector.defaultProps = WrappedComponent.defaultProps;
return forwardRef(ScrollReachedDetector) as any;
}
diff --git a/packages/react-native-ui-lib/src/components/KeyboardAwareScrollView/KeyboardAwareBase.js b/packages/react-native-ui-lib/src/components/KeyboardAwareScrollView/KeyboardAwareBase.js
index 0a456af5d1..5ecdb2e7d4 100644
--- a/packages/react-native-ui-lib/src/components/KeyboardAwareScrollView/KeyboardAwareBase.js
+++ b/packages/react-native-ui-lib/src/components/KeyboardAwareScrollView/KeyboardAwareBase.js
@@ -1,6 +1,5 @@
import _ from 'lodash';
import {Component} from 'react';
-import PropTypes from 'prop-types';
import ReactNative, {DeviceEventEmitter, Keyboard} from 'react-native';
export default class KeyboardAwareBase extends Component {
@@ -22,12 +21,6 @@ export default class KeyboardAwareBase extends Component {
this._addKeyboardEventListeners();
}
- static propTypes = {
- startScrolledToBottom: PropTypes.bool,
- scrollToBottomOnKBShow: PropTypes.bool,
- scrollToInputAdditionalOffset: PropTypes.number
- };
-
static defaultProps = {
startScrolledToBottom: false,
scrollToBottomOnKBShow: false,
diff --git a/packages/react-native-ui-lib/src/components/KeyboardAwareScrollView/KeyboardAwareFlatList.js b/packages/react-native-ui-lib/src/components/KeyboardAwareScrollView/KeyboardAwareFlatList.js
index 55b4bb6ed3..ca59e294c3 100644
--- a/packages/react-native-ui-lib/src/components/KeyboardAwareScrollView/KeyboardAwareFlatList.js
+++ b/packages/react-native-ui-lib/src/components/KeyboardAwareScrollView/KeyboardAwareFlatList.js
@@ -1,5 +1,4 @@
import React from 'react';
-import PropTypes from 'prop-types';
import {FlatList} from 'react-native';
import KeyboardAwareBase from './KeyboardAwareBase';
@@ -10,11 +9,6 @@ import KeyboardAwareBase from './KeyboardAwareBase';
export default class KeyboardAwareFlatList extends KeyboardAwareBase {
static displayName = 'KeyboardAwareFlatList';
- static PropTypes = {
- getTextInputRefs: PropTypes.func,
- onScroll: PropTypes.func
- };
-
static defaultProps = {
...KeyboardAwareBase.defaultProps,
getTextInputRefs: () => {
diff --git a/packages/react-native-ui-lib/src/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js b/packages/react-native-ui-lib/src/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js
index 5bfa0518b6..9dd8dbba1b 100644
--- a/packages/react-native-ui-lib/src/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js
+++ b/packages/react-native-ui-lib/src/components/KeyboardAwareScrollView/KeyboardAwareScrollView.js
@@ -1,5 +1,4 @@
import React from 'react';
-import PropTypes from 'prop-types';
import {ScrollView} from 'react-native';
import KeyboardAwareBase from './KeyboardAwareBase';
@@ -10,11 +9,6 @@ import KeyboardAwareBase from './KeyboardAwareBase';
export default class KeyboardAwareScrollView extends KeyboardAwareBase {
static displayName = 'KeyboardAwareScrollView';
- static PropTypes = {
- getTextInputRefs: PropTypes.func,
- onScroll: PropTypes.func
- };
-
static defaultProps = {
...KeyboardAwareBase.defaultProps,
getTextInputRefs: () => {
diff --git a/packages/react-native-ui-lib/src/components/animatedScanner/index.js b/packages/react-native-ui-lib/src/components/animatedScanner/index.js
index 3fc6291f7c..bf480c76ae 100644
--- a/packages/react-native-ui-lib/src/components/animatedScanner/index.js
+++ b/packages/react-native-ui-lib/src/components/animatedScanner/index.js
@@ -1,8 +1,6 @@
import _ from 'lodash';
-import PropTypes from 'prop-types';
import React from 'react';
import {StyleSheet, Animated} from 'react-native';
-import {ViewPropTypes} from 'deprecated-react-native-prop-types';
import {Colors} from '../../style';
import {BaseComponent} from '../../commons';
import View from '../../components/view';
@@ -16,41 +14,6 @@ import View from '../../components/view';
*/
export default class AnimatedScanner extends BaseComponent {
static displayName = 'AnimatedScanner';
- static propTypes = {
- /**
- * animated value between 0 and 100
- */
- // progress: PropTypes.object,
- progress: PropTypes.number,
- /**
- * Duration of current break (can be change between breaks)
- */
- duration: PropTypes.number,
- /**
- * scanner opacity
- */
- opacity: PropTypes.number,
- /**
- * scanner background color
- */
- backgroundColor: PropTypes.string,
- /**
- * breakpoint callback - ({progress, isDone}) => {}
- */
- onBreakpoint: PropTypes.func,
- /**
- * should hide the scanner line
- */
- hideScannerLine: PropTypes.bool,
- /**
- * the container style
- */
- containerStyle: ViewPropTypes.style,
- /**
- * Used as a testing identifier
- */
- testID: PropTypes.string
- };
static defaultProps = {
progress: 0,
diff --git a/packages/react-native-ui-lib/src/components/button/__tests__/index.spec.js b/packages/react-native-ui-lib/src/components/button/__tests__/index.spec.js
index 722978bfa2..61b6820f48 100644
--- a/packages/react-native-ui-lib/src/components/button/__tests__/index.spec.js
+++ b/packages/react-native-ui-lib/src/components/button/__tests__/index.spec.js
@@ -1,5 +1,5 @@
import React from 'react';
-import renderer from 'react-test-renderer';
+import {render} from '@testing-library/react-native';
import Button from '../index';
import View from '../../view';
import {Colors, ThemeManager} from '../../../style';
@@ -12,54 +12,54 @@ describe('Button', () => {
});
it('should render default button', () => {
- const tree = renderer.create().toJSON();
+ const tree = render().toJSON();
expect(tree).toMatchSnapshot();
});
describe('outline', () => {
it('should render button with an outline', () => {
- const tree = renderer.create().toJSON();
+ const tree = render().toJSON();
expect(tree).toMatchSnapshot();
});
it('should render button with an outlineColor', () => {
- const tree = renderer.create(