(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 f300e1a712..526b7469c8 100644
--- a/packages/react-native-ui-lib/src/commons/forwardRef.tsx
+++ b/packages/react-native-ui-lib/src/commons/forwardRef.tsx
@@ -17,12 +17,7 @@ export default function forwardRef(WrappedC
const ForwardedComponent = React.forwardRef(forwardRef);
hoistStatics(ForwardedComponent, WrappedComponent);
- //@ts-ignore
ForwardedComponent.displayName = WrappedComponent.displayName;
- //@ts-ignore
- ForwardedComponent.propTypes = WrappedComponent.propTypes;
- //@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 251f6adbb9..8cd4e34fbb 100644
--- a/packages/react-native-ui-lib/src/commons/withScrollEnabler.tsx
+++ b/packages/react-native-ui-lib/src/commons/withScrollEnabler.tsx
@@ -69,10 +69,6 @@ function withScrollEnabler(WrappedComponent: React.Componen
hoistStatics(ScrollEnabler, WrappedComponent);
ScrollEnabler.displayName = WrappedComponent.displayName;
- //@ts-ignore
- ScrollEnabler.propTypes = WrappedComponent.propTypes;
- //@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 393e67d638..56fde6f8ef 100644
--- a/packages/react-native-ui-lib/src/commons/withScrollReached.tsx
+++ b/packages/react-native-ui-lib/src/commons/withScrollReached.tsx
@@ -92,10 +92,6 @@ function withScrollReached(WrappedComponent: React.Componen
hoistStatics(ScrollReachedDetector, WrappedComponent);
ScrollReachedDetector.displayName = WrappedComponent.displayName;
- //@ts-ignore
- ScrollReachedDetector.propTypes = WrappedComponent.propTypes;
- //@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/WheelPicker/index.tsx b/packages/react-native-ui-lib/src/components/WheelPicker/index.tsx
index 6f59f607c2..17828cf33f 100644
--- a/packages/react-native-ui-lib/src/components/WheelPicker/index.tsx
+++ b/packages/react-native-ui-lib/src/components/WheelPicker/index.tsx
@@ -1,6 +1,6 @@
// TODO: Support style customization
import {isFunction, isUndefined} from 'lodash';
-import React, {useCallback, useRef, useMemo, useEffect, useState} from 'react';
+import React, {useCallback, useRef, useMemo, useEffect, useState, type JSX} from 'react';
import {
TextStyle,
ViewStyle,
@@ -126,7 +126,7 @@ const WheelPicker = (props: WheelPickerProps)
faderProps,
flatListProps
} = themeProps;
- const scrollView = useRef();
+ const scrollView = useRef(undefined);
const offset = useSharedValue(0);
const scrollHandler = useAnimatedScrollHandler(e => {
offset.value = e.contentOffset.y;
diff --git a/packages/react-native-ui-lib/src/components/WheelPicker/usePresenter.ts b/packages/react-native-ui-lib/src/components/WheelPicker/usePresenter.ts
index ad520b0947..65449ee558 100644
--- a/packages/react-native-ui-lib/src/components/WheelPicker/usePresenter.ts
+++ b/packages/react-native-ui-lib/src/components/WheelPicker/usePresenter.ts
@@ -1,5 +1,5 @@
import _ from 'lodash';
-import React from 'react';
+import React, {type JSX} from 'react';
import {LogService} from '../../services';
import useMiddleIndex from './helpers/useListMiddleIndex';
import {WheelPickerItemValue} from './types';
diff --git a/packages/react-native-ui-lib/src/components/actionSheet/index.tsx b/packages/react-native-ui-lib/src/components/actionSheet/index.tsx
index 283d0779e0..98d5d3bdf3 100644
--- a/packages/react-native-ui-lib/src/components/actionSheet/index.tsx
+++ b/packages/react-native-ui-lib/src/components/actionSheet/index.tsx
@@ -1,5 +1,5 @@
import _ from 'lodash';
-import React, {Component} from 'react';
+import React, {Component, type JSX} from 'react';
import {ActionSheetIOS, StyleSheet, StyleProp, ViewStyle, ImageProps, ImageSourcePropType} from 'react-native';
import {Colors} from '../../style';
import {asBaseComponent, Constants} from '../../commons/new';
diff --git a/packages/react-native-ui-lib/src/components/animatedImage/index.tsx b/packages/react-native-ui-lib/src/components/animatedImage/index.tsx
index 6e9a4f7bf1..e452739903 100644
--- a/packages/react-native-ui-lib/src/components/animatedImage/index.tsx
+++ b/packages/react-native-ui-lib/src/components/animatedImage/index.tsx
@@ -21,7 +21,7 @@ export interface AnimatedImageProps extends ImageProps {
/**
* A component to render while the image is loading
*/
- loader?: React.ReactElement;
+ loader?: React.ReactElement;
}
/**
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/avatar/index.tsx b/packages/react-native-ui-lib/src/components/avatar/index.tsx
index e29924f03c..f222ff43a2 100644
--- a/packages/react-native-ui-lib/src/components/avatar/index.tsx
+++ b/packages/react-native-ui-lib/src/components/avatar/index.tsx
@@ -1,5 +1,5 @@
import _ from 'lodash';
-import React, {PropsWithChildren, useMemo, forwardRef} from 'react';
+import React, {PropsWithChildren, useMemo, forwardRef, type JSX} from 'react';
import {
StyleSheet,
StyleProp,
diff --git a/packages/react-native-ui-lib/src/components/badge/index.tsx b/packages/react-native-ui-lib/src/components/badge/index.tsx
index 74ece732ed..2ac691592f 100644
--- a/packages/react-native-ui-lib/src/components/badge/index.tsx
+++ b/packages/react-native-ui-lib/src/components/badge/index.tsx
@@ -1,5 +1,5 @@
import _ from 'lodash';
-import React, {PureComponent} from 'react';
+import React, {PureComponent, type JSX} from 'react';
import {
ImageSourcePropType,
ImageStyle,
diff --git a/packages/react-native-ui-lib/src/components/baseInput/index.tsx b/packages/react-native-ui-lib/src/components/baseInput/index.tsx
index 166a1e0bbe..7c99815bb2 100644
--- a/packages/react-native-ui-lib/src/components/baseInput/index.tsx
+++ b/packages/react-native-ui-lib/src/components/baseInput/index.tsx
@@ -1,8 +1,6 @@
// @ts-nocheck
import _ from 'lodash';
-import PropTypes from 'prop-types';
import 'react';
-import {ViewPropTypes, TextInputPropTypes} from 'deprecated-react-native-prop-types';
import {Colors, Typography} from '../../style';
import {BaseComponent} from '../../commons';
import Validators from './Validators';
@@ -18,51 +16,6 @@ const VALIDATORS = {
export default class BaseInput extends BaseComponent {
static displayName = 'BaseInput';
- static propTypes = {
- ...TextInputPropTypes,
- // ...BaseComponent.propTypes,
- /**
- * text color
- */
- color: PropTypes.string,
- /**
- * text input container style
- */
- containerStyle: ViewPropTypes.style,
- /**
- * validator type or custom validator function
- */
- validate: PropTypes.oneOfType([
- PropTypes.oneOf(_.values(VALIDATORS)), // enum
- PropTypes.func, // custom
- PropTypes.arrayOf(PropTypes.oneOfType([PropTypes.oneOf(_.values(VALIDATORS)), PropTypes.func])) // array of validators
- ]),
- /**
- * Whether to mark required field with an asterisk
- */
- markRequired: PropTypes.bool,
- /**
- * the message to be displayed when the validation fails
- */
- errorMessage: PropTypes.oneOfType([PropTypes.string, PropTypes.arrayOf(PropTypes.string)]),
- /**
- * whether to run the validation on mount
- */
- validateOnStart: PropTypes.bool,
- /**
- * whether to run the validation on text changed
- */
- validateOnChange: PropTypes.bool,
- /**
- * whether to run the validation on blur
- */
- validateOnBlur: PropTypes.bool,
- /**
- * callback for validity change
- */
- onChangeValidity: PropTypes.func
- };
-
static defaultProps = {
validateOnBlur: true
};
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(