Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
96 changes: 0 additions & 96 deletions demo/src/screens/DemoScreen.js

This file was deleted.

8 changes: 0 additions & 8 deletions demo/src/screens/MainScreen.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import _ from 'lodash';
import React, {Component} from 'react';
import PropTypes from 'prop-types';
import {StyleSheet, FlatList, SectionList, ScrollView} from 'react-native';
import {ViewPropTypes} from 'deprecated-react-native-prop-types';
import {Navigation} from 'react-native-navigation';
import {
Assets,
Expand All @@ -27,12 +25,6 @@ const chevronIcon = require('../assets/icons/chevronRight.png');
const FADER_SIZE = 50;

class MainScreen extends Component {
static propTypes = {
containerStyle: ViewPropTypes.style,
renderItem: PropTypes.func,
pageStyle: ViewPropTypes.style
};

settingsScreenName = 'unicorn.Settings';

static options() {
Expand Down
8 changes: 0 additions & 8 deletions demo/src/screens/componentScreens/ConversationListScreen.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import _ from 'lodash';
import PropTypes from 'prop-types';
import React, {Component, PureComponent} from 'react';
import {StyleSheet, Alert, FlatList} from 'react-native';
import {Colors, ListItem, Text, Avatar, AvatarHelper, Drawer, Button} from 'react-native-ui-lib'; //eslint-disable-line
Expand Down Expand Up @@ -121,13 +120,6 @@ class ConversationListScreen extends Component {
}

class ContactItem extends PureComponent {
static propTypes = {
item: PropTypes.object,
index: PropTypes.number,
addRef: PropTypes.func,
onSwipeableWillOpen: PropTypes.func
};

render() {
const {item, index, addRef, onSwipeableWillOpen} = this.props;

Expand Down
5 changes: 0 additions & 5 deletions demo/src/screens/foundationScreens/TypographyScreen.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import _ from 'lodash';
import PropTypes from 'prop-types';
import React, {Component} from 'react';
import {ScrollView} from 'react-native';
import {TabController, Colors, Typography, View, Text} from 'react-native-ui-lib';

const WEIGHTS = ['Thin', 'Light', 'Default', 'Regular', 'Medium', 'Bold', 'Heavy', 'Black'];

export default class TypographyScreen extends Component {
static propTypes = {
color: PropTypes.string
};

static defaultProps = {
color: Colors.grey10
};
Expand Down
6 changes: 0 additions & 6 deletions demo/src/screens/realExamples/ListActions/ActionsList.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import PropTypes from 'prop-types';
import React, {Component} from 'react';
import {Animated, LayoutAnimation, PanResponder, I18nManager} from 'react-native';
import {Constants, Assets, Colors, View, TouchableOpacity, Button, Text} from 'react-native-ui-lib'; //eslint-disable-line
Expand All @@ -17,11 +16,6 @@ const DIRECTIONS = {

export default class ActionsList extends Component {
static displayName = 'ActionsList';

static propTypes = {
item: PropTypes.object,
index: PropTypes.number
}

constructor(props) {
super(props);
Expand Down
3 changes: 2 additions & 1 deletion docs/getting-started/v8.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
---
sidebar_position: 5
sidebar_position: 6
sidebar_label: Migrating v7 -> v8
title: "Migrating v7 -> v8"
# path: "/getting-started/v8"
---
## `react-native-ui-lib@8.x.x`

## General
Now supports react-native 0.77
`uilib-native` (our native library) has been moved from `dependencies` to `peerDependencies`.
Make sure to `pod install` after updating.
We do plan on making this optional in the future.
Expand Down
21 changes: 21 additions & 0 deletions docs/getting-started/v9.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
sidebar_position: 7
sidebar_label: Migrating v8 -> v9
title: "Migrating v8 -> v9"
# path: "/getting-started/v9"
---
## `react-native-ui-lib@9.x.x`

## General
Now supports react-native 0.78 and React 19

## Components

### MaskedInput
Only the newer version is now available (the `migrate` prop is removed)

## Utils

### modifiers
extractOwnProps - removed
extractComponentProps - removed
2 changes: 1 addition & 1 deletion expoDemo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@
"@react-native-community/cli": "15.0.1",
"@react-native-community/cli-platform-android": "15.0.1",
"@react-native-community/cli-platform-ios": "15.0.1",
"@types/react": "~18.3.24",
"@types/react": "19.0.0",
"typescript": "^4.9.5"
},
"private": true
Expand Down
3 changes: 1 addition & 2 deletions lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,7 @@
"author": "Ethan Sharabi <ethan.shar@gmail.com>",
"license": "MIT",
"dependencies": {
"lodash": "^4.17.21",
"prop-types": "^15.5.10"
"lodash": "^4.17.21"
},
"devDependencies": {
"shell-utils": "^1.0.10"
Expand Down
8 changes: 4 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"ios": "yarn workspace react-native-ui-lib ios",
"android": "yarn workspace react-native-ui-lib android",
"iPad": "yarn workspace react-native-ui-lib iPad",
"test": "yarn lint && yarn workspace react-native-ui-lib test",
"test": "yarn workspace react-native-ui-lib test",
"pretest": "yarn lint",
"lint": "eslint packages -c .eslintrc.js --ext .tsx,.ts,.js",
"lint:fix": "eslint packages -c .eslintrc.js --fix",
"build:dev": "tsc --p tsconfig.dev.json",
Expand Down Expand Up @@ -40,11 +41,10 @@
"@react-native/metro-config": "0.78.3",
"@react-native/typescript-config": "0.78.3",
"@shopify/flash-list": "1.7.6",
"@testing-library/react-native": "^11.5.1",
"@types/hoist-non-react-statics": "^3.3.1",
"@testing-library/react-native": "^13.3.3",
"@types/hoist-non-react-statics": "^3.3.7",
"@types/jest": "^29.5.13",
"@types/lodash": "^4.0.0",
"@types/prop-types": "^15.5.3",
"@types/react": "19.0.0",
"@types/react-test-renderer": "^19.0.0",
"@types/tinycolor2": "^1.4.2",
Expand Down
7 changes: 2 additions & 5 deletions packages/react-native-ui-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,9 @@
"color": "^3.1.0",
"commons-validator-js": "^1.0.237",
"date-fns": "^2.29.3",
"deprecated-react-native-prop-types": "^2.3.0",
"hoist-non-react-statics": "^3.0.0",
"lodash": "^4.17.21",
"memoize-one": "^5.0.5",
"prop-types": "^15.5.10",
"react-freeze": "^1.0.0",
"react-native-redash": "^12.0.3",
"semver": "^5.5.0",
Expand Down Expand Up @@ -66,11 +64,10 @@
"@react-native/metro-config": "0.78.3",
"@react-native/typescript-config": "0.78.3",
"@shopify/flash-list": "1.7.6",
"@testing-library/react-native": "^11.5.1",
"@types/hoist-non-react-statics": "^3.3.1",
"@testing-library/react-native": "^13.3.3",
"@types/hoist-non-react-statics": "^3.3.7",
"@types/jest": "^29.5.13",
"@types/lodash": "^4.0.0",
"@types/prop-types": "^15.5.3",
"@types/react": "19.0.0",
"@types/react-test-renderer": "19.0.0",
"@types/tinycolor2": "^1.4.2",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
import PropTypes from 'prop-types';
import {ThemeManager, Colors, Typography, BorderRadiuses, Spacings} from '../../style';
import * as uut from '../modifiers';

describe('Modifiers', () => {
const SampleComponent = () => {};
SampleComponent.displayName = 'SampleComponent';
SampleComponent.propTypes = {
prop1: PropTypes.string,
prop2: PropTypes.number
};

describe('extractColorValue', () => {
it('should return color value according to modifier', () => {
Expand Down Expand Up @@ -287,24 +282,6 @@ describe('Modifiers', () => {
});
});

// describe('extractOwnProps', () => {
// it('should extract the component props from a props object', () => {
// const props = {color: 'red', topShadow: 1, bottomShadow: 2};
// expect(MultipleShadow.extractOwnProps(props)).toEqual({
// topShadow: 1,
// bottomShadow: 2,
// });
// });

// it('should omit props that were required to ignore', () => {
// const props = {color: 'red', topShadow: 1, bottomShadow: 2};
// expect(MultipleShadow.extractOwnProps(props, 'topShadow')).toEqual({
// bottomShadow: 2,
// });
// expect(MultipleShadow.extractOwnProps(props, ['topShadow', 'bottomShadow'])).toEqual({});
// });
// });

describe('extractModifiersProps', () => {
it('should return all modifiers props', () => {
expect(uut.extractModifierProps({
Expand Down Expand Up @@ -348,24 +325,6 @@ describe('Modifiers', () => {
});
});

describe('extractOwnProps', () => {
it('should extract the component props from a props object', () => {
const props = {color: 'red', prop1: 'text', prop2: 2};
expect(uut.extractOwnProps.bind(SampleComponent)(props)).toEqual({
prop1: 'text',
prop2: 2
});
});

it('should omit props that were required to ignore', () => {
const props = {color: 'red', prop1: 'text', prop2: 2};
expect(uut.extractOwnProps.bind(SampleComponent)(props, 'prop1')).toEqual({
prop2: 2
});
expect(uut.extractOwnProps.bind(SampleComponent)(props, ['prop1', 'prop2'])).toEqual({});
});
});

describe('getThemeProps', () => {
beforeEach(() => {
ThemeManager.setComponentTheme('SampleComponent', undefined);
Expand Down
3 changes: 2 additions & 1 deletion packages/react-native-ui-lib/src/commons/asBaseComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ function asBaseComponent<PROPS, STATICS = {}, RefInterface = any>(WrappedCompone
};

static getDerivedStateFromError(error: any) {
UIComponent.defaultProps?.onError?.(error, WrappedComponent.defaultProps);
UIComponent.defaultProps?.onError?.(error);
return {error: true};
}

Expand All @@ -80,6 +80,7 @@ function asBaseComponent<PROPS, STATICS = {}, RefInterface = any>(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) {
Expand Down
9 changes: 0 additions & 9 deletions packages/react-native-ui-lib/src/commons/baseComponent.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -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) {
Expand Down
3 changes: 0 additions & 3 deletions packages/react-native-ui-lib/src/commons/forwardRef.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,7 @@ export default function forwardRef<P, STATICS = {}, RefInterface = any>(WrappedC
const ForwardedComponent = React.forwardRef<RefInterface, P>(forwardRef);

hoistStatics(ForwardedComponent, WrappedComponent);
//@ts-ignore
ForwardedComponent.displayName = WrappedComponent.displayName;
//@ts-ignore
ForwardedComponent.defaultProps = WrappedComponent.defaultProps;

return ForwardedComponent as typeof ForwardedComponent & STATICS;
}
Loading