juliancwirko / react-s-alert

Alerts / Notifications for React with rich configuration options
https://www.npmjs.com/package/react-s-alert
MIT License
649 stars 75 forks source link

nothing happen on meteor 1.3 app #9

Closed zhaoyao91 closed 8 years ago

zhaoyao91 commented 8 years ago

hi, I've created a meteor 1.3 app, and try to use react-s-alert, but nothing happen

this is app layout

import React from 'react';
import Alert from 'react-s-alert';

const Layout = ({content = ()=>null})=> {
    return <div>
        <header>

        </header>

        <div>
            {content()}
            <Alert stack={{limit: 3}}/>
        </div>

        <footer>

        </footer>
    </div>
};

export default Layout

this is test page

import React from 'react';
import Container from '/client/modules/core/components/container';
import {PageHeader, Button} from 'react-bootstrap';
import Alert from 'react-s-alert'

const Page = (props) => {
    return <Container>
        <PageHeader>测试页</PageHeader>
        <Button onClick={onClick}>alert</Button>
    </Container>;

    function onClick() {
        console.log('before');
        const id = Alert.info('hi');
        console.log('after ', id);
    }
};

export default Page

window.Alert = Alert;
zhaoyao91 commented 8 years ago

I found the reason: position is not specified. maybe some default value or warning should be added.

juliancwirko commented 8 years ago

Yeah, you're right I should add a default value. I'll do it asap.

nickredmark commented 8 years ago

@zhaoyao91 how did you manage to make it work? I can't include the s-alert stylesheet.

juliancwirko commented 8 years ago

@zhaoyao91 take a look at the demo app: https://github.com/juliancwirko/react-s-alert-demo if you use Webpack just import the style file. Like here: https://github.com/juliancwirko/react-s-alert-demo/blob/master/app/components/homeView/Home.js#L4 If not you will have to copy or linke the styles from node_modules in other way.

znat commented 6 years ago

I am facing the same issue as @zhaoyao91 on Meteor 1.6 . I added a position, and console.log('after ', id); displays an id. However the alert is not showing. Any idea why?