Skip to content
Draft
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
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
5 changes: 3 additions & 2 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,7 +41,7 @@
"@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",
"@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",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-native-ui-lib/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@
"@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",
"@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",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -282,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 @@ -343,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
2 changes: 0 additions & 2 deletions packages/react-native-ui-lib/src/commons/baseComponent.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,6 @@ export default function baseComponent(usePure: boolean): ComponentType {
styles: any;
view: any;

static extractOwnProps = Modifiers.extractOwnProps;

constructor(props: any) {
super(props);
if (!this.styles) {
Expand Down
21 changes: 0 additions & 21 deletions packages/react-native-ui-lib/src/commons/modifiers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -338,27 +338,6 @@ export function extractModifierProps(props: Dictionary<any>) {
return modifierProps;
}

/**
* TODO:
* @deprecated switch to Modifiers#extractComponentProps
*/
export function extractOwnProps(props: Dictionary<any>, ignoreProps: string[]) {
//@ts-ignore
const ownPropTypes = this.propTypes;
const ownProps = _.flow((props: Dictionary<any>) => _.pickBy(props, (_value, key) => _.includes(Object.keys(ownPropTypes), key)),
props => _.omit(props, ignoreProps))(props);

return ownProps;
}

export function extractComponentProps(component: any, props: Dictionary<any>, ignoreProps: string[] = []) {
const componentPropTypes = component.propTypes;
const componentProps = _.flow((props: Dictionary<any>) => _.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;
Expand Down
Loading