question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Proposal: <screen /> root component

See original GitHub issue

This is just a quick proposal to change the current render/mount syntax.

The motivation is to remove the need to require both react-blessed and blessed and let react-blessed manage both.

import {Screen, render} from 'react-blessed';

const App = () => (
  <Screen
    autoPadding={true}
    smartCSR={true}
    title="react-blessed hello world"
  >
    <box top="center"
         left="center"
         width="50%"
         height="50%"
         border={{type: 'line'}}
         style={{border: {fg: 'blue'}}}>
      Hello World!
    </box>
  </Screen>
);

render(<App />);

Issue Analytics

  • State:open
  • Created 8 years ago
  • Comments:7 (7 by maintainers)

github_iconTop GitHub Comments

2reactions
Yomguitherealcommented, Dec 19, 2015

The initial point was not to bind react-blessed to a specific version of blessed so I don’t have to upgrade the dependencies along with blessed each time a minor/patch is released. Plus the idea was to let people mount an app on an already existing blessed app the same way you would with react-dom. I don’t particularly see what we win by creating a screen component in react-blessed.

0reactions
davidmarkclementscommented, Dec 19, 2015

alternatively return both screen and component?


import {Screen, render} from 'react-blessed';

const App = () => (
  <Screen
    autoPadding={true}
    smartCSR={true}
    title="react-blessed hello world"
  >
    <box top="center"
         left="center"
         width="50%"
         height="50%"
         border={{type: 'line'}}
         style={{border: {fg: 'blue'}}}>
      Hello World!
    </box>
  </Screen>
);

const {screen, component} = render(<App />);

could attach screen and component to component e.g.

//..snip..
component.component = component
component.screen = screen
return component
//..snip..

then we support both:

const component = render(<App/>)

and

const {component, screen} = render(<App/>)

or maybe better to do it vv.

//..snip..
screen.component = component
screen.screen = screen
return screen
//..snip..
const screen = render(<App/>)

and

const {component, screen} = render(<App/>)

doesn’t mean you can’t support mount points as well

Read more comments on GitHub >

github_iconTop Results From Across the Web

Proposal: Ability to get navigation screens state · Issue #6853
State will allow to understand from any part of the code how the screen is opened. Root, Modal, Overlay, and call corresponding method...
Read more >
Root Component - IBM
The root component is typically an element appearing on the first screen displayed when SDF is started. In Figure 1, the CHI01 system...
Read more >
React Navigation
Each Screen component defines a route in our app. If we want nested navigators, e.g. a tab navigator within a stack navigator, we...
Read more >
Build an Angular 2 App: The Root Component - Atmosera
Run your apps in the environment best suited for their requirements. Build an Angular 2 App: The Root Component. By Rachel Snowbeck.
Read more >
Feature Proposal: Conversational Components - Feedback ...
Feature Proposal: Conversational Components We're back with another feature ... or bundle everything up inside a components directory in the root folder of ......
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found