Skip to content

Commit

Permalink
[react-x] Export all components from the main react-x object (#59)
Browse files Browse the repository at this point in the history
* Remove the react-x-components package and move exports to react-x

* Remove the Components export from react-x tests
  • Loading branch information
negativetwelve committed Mar 2, 2018
1 parent 6fa19c3 commit 5da4352
Show file tree
Hide file tree
Showing 9 changed files with 46 additions and 122 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,17 +50,13 @@ API | Version | Description

## Components

See the [`react-x-components`](/packages/react-x-components) for a full list of cross-platform components built with `react-x`.

Component | Version | Description
----------|---------|------------
[`react-x-components`](/packages/react-x-components) | [![npm](https://img.shields.io/npm/v/react-x-components.svg)][npm-components] | All cross-platform components developed for react-x.
[`react-x-primitives`](/packages/react-x-primitives) | [![npm](https://img.shields.io/npm/v/react-x-primitives.svg)][npm-primitives] | Set of primitive components to render across targets.
[`react-x-render`](/packages/react-x-render) | [![npm](https://img.shields.io/npm/v/react-x-render.svg)][npm-render] | Conditional rendering based on if/unless conditions.
[`react-x-svg`](/packages/react-x-svg) | [![npm](https://img.shields.io/npm/v/react-x-svg.svg)][npm-svg] | Cross-platform SVG support for ReactDOM and React Native.
[`react-x-switch`](/packages/react-x-switch) | [![npm](https://img.shields.io/npm/v/react-x-switch.svg)][npm-switch] | Switch component for toggling on/off.

[npm-components]: https://www.npmjs.com/package/react-x-components
[npm-primitives]: https://www.npmjs.com/package/react-x-primitives
[npm-render]: https://www.npmjs.com/package/react-x-render
[npm-svg]: https://www.npmjs.com/package/react-x-svg
Expand Down
32 changes: 0 additions & 32 deletions packages/react-x-components/README.md

This file was deleted.

35 changes: 0 additions & 35 deletions packages/react-x-components/package.json

This file was deleted.

9 changes: 0 additions & 9 deletions packages/react-x-components/src/Components.js

This file was deleted.

27 changes: 0 additions & 27 deletions packages/react-x-components/src/__tests__/Components.spec.js

This file was deleted.

1 change: 0 additions & 1 deletion packages/react-x/components.js

This file was deleted.

6 changes: 4 additions & 2 deletions packages/react-x/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,12 @@
],
"dependencies": {
"react-x-clipboard": "^1.3.0",
"react-x-components": "^1.3.0",
"react-x-keychain": "^1.3.0",
"react-x-primitives": "^1.3.0",
"react-x-styled": "^1.3.0"
"react-x-render": "^1.3.0",
"react-x-styled": "^1.3.0",
"react-x-svg": "^1.3.0",
"react-x-switch": "^1.3.0"
},
"peerDependencies": {
"react": "*"
Expand Down
44 changes: 33 additions & 11 deletions packages/react-x/src/__tests__/react-x.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,40 @@ import ReactX from '../react-x';

/* eslint-disable no-undef */
describe('ReactX', () => {
const names = [
'Animated',
'Clipboard',
'Components',
'Keychain',
'Styled',
'StyleSheet',
];
context('APIs', () => {
const apis = [
'Animated',
'Clipboard',
'Keychain',
'Styled',
'StyleSheet',
];

forEach({name: names}, () => {
it('should exist', () => {
expect(ReactX[name]).toBeDefined();
forEach({api: apis}, () => {
it('should exist', () => {
expect(ReactX[api]).toBeDefined();
});
});
});

context('Components', () => {
const components = [
// TODO(mark): Can't test SVG because it is a set of components.
'Image',
'Render',
'Switch',
'Text',
'View',
];

forEach({component: components}, () => {
it('should exist', () => {
expect(ReactX[component]).toBeDefined();
});

it('should be a component', () => {
expect(ReactX[component]).toBeInstanceOf(Function);
});
});
});
});
10 changes: 9 additions & 1 deletion packages/react-x/src/react-x.js
Original file line number Diff line number Diff line change
@@ -1,9 +1,17 @@
/* eslint-disable brace-style */
module.exports = {
// APIs
get Animated() { return require('react-x-primitives').Animated; },
get Clipboard() { return require('react-x-clipboard').default; },
get Components() { return require('react-x-components'); },
get Keychain() { return require('react-x-keychain').default; },
get Styled() { return require('react-x-styled').default; },
get StyleSheet() { return require('react-x-primitives').StyleSheet; },

// Components
get Image() { return require('react-x-primitives').Image; },
get Render() { return require('react-x-render').default; },
get SVG() { return require('react-x-svg').default; },
get Switch() { return require('react-x-switch').default; },
get Text() { return require('react-x-primitives').Text; },
get View() { return require('react-x-primitives').View; },
};

0 comments on commit 5da4352

Please sign in to comment.