Skip to content

Commit

Permalink
Merge pull request #80 from d4rky-pl/79_allow_other_blessed_libraries
Browse files Browse the repository at this point in the history
Add createBlessedRenderer function
  • Loading branch information
Yomguithereal authored Sep 4, 2018
2 parents bcbcae3 + 3129138 commit 29dd2dc
Show file tree
Hide file tree
Showing 7 changed files with 224 additions and 167 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
*.log
node_modules
dist
.idea
13 changes: 13 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ This renderer should currently be considered as experimental, is subject to chan
* [Refs](#refs)
* [Events](#events)
* [Classes](#classes)
* [Using blessed forks](#using-blessed-forks)
* [Roadmap](#roadmap)
* [FAQ](#faq)
* [Contribution](#contribution)
Expand Down Expand Up @@ -236,6 +237,18 @@ class App extends Component {
}
```

### Using blessed forks

Because [blessed](https://github.com/chjj/blessed) is not actively maintained in quite a while, you might want to use one of it's forks. To do that, import `createBlessedRenderer` function instead:

```
import React, {Component} from 'react';
import blessed from 'neo-blessed';
import {createBlessedRenderer} from 'react-blessed';
const render = createBlessedRenderer(blessed);
```

## Roadmap

* Full support (meaning every tags and options should be handled by the renderer).
Expand Down
29 changes: 29 additions & 0 deletions examples/neo-blessed.jsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import React, {Component} from 'react';
import blessed from 'neo-blessed';
import {createBlessedRenderer} from '../src';

const render = createBlessedRenderer(blessed);

class App extends Component {
render() {
return (
<box label="react-blessed demo"
border={{type: 'line'}}
style={{border: {fg: 'cyan'}}}>
This example uses neo-blessed fork of blessed library.
</box>
);
}
}

const screen = blessed.screen({
autoPadding: true,
smartCSR: true,
title: 'react-blessed demo app'
});

screen.key(['escape', 'q', 'C-c'], function(ch, key) {
return process.exit(0);
});

const component = render(<App />, screen);
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
"babel-preset-stage-0": "^6.22.0",
"babel-register": "^6.22.0",
"blessed": "^0.1.81",
"neo-blessed": "^0.2.0",
"mocha": "^4.0.1",
"react": "^16.2.0"
},
Expand Down
1 change: 1 addition & 0 deletions run.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ const examples = [
'demo',
'form',
'framer',
'neo-blessed',
'progressbar',
'remove',
];
Expand Down
Loading

0 comments on commit 29dd2dc

Please sign in to comment.