react-bootstrap

Cannot apply any Bootstrap style in using React-bootstrap library

孤人 提交于 2019-12-29 01:47:10
问题 I want to use default Bootstrap components in my React application, so I'm using React-bootstrap NPM-package. But I stuck at the very beginning: I cannot use any default component although I'm just copying very simple exmaples from official docs. Every time I use Bootstrap-styled component, I get basic component withouts styles. For example the code below renders a <button> without styles, not <Button bsStyle="danger"> from Bootstrap. import React from "react"; import ReactDOM from "react-dom

Cannot apply any Bootstrap style in using React-bootstrap library

旧街凉风 提交于 2019-12-29 01:47:03
问题 I want to use default Bootstrap components in my React application, so I'm using React-bootstrap NPM-package. But I stuck at the very beginning: I cannot use any default component although I'm just copying very simple exmaples from official docs. Every time I use Bootstrap-styled component, I get basic component withouts styles. For example the code below renders a <button> without styles, not <Button bsStyle="danger"> from Bootstrap. import React from "react"; import ReactDOM from "react-dom

React-bootstrap not allowing `import {components}` syntax

廉价感情. 提交于 2019-12-25 10:05:12
问题 This is kinda weird. It works with other projects, but not with React-Bootstrap. For example; import {Jumbotron, Button} from 'react-bootstrap'; import * as ReactBootstrap from 'react-bootstrap'; both give me a Invalid argument must be an array in all.js:12 file. However, importing like this works: var Jumbotron = require('react-bootstrap/lib/Jumbotron'); var Button = require('react-bootstrap/lib/Button'); Sure I can use this, but it's more efficient to declare an array of components I want.

Difference between import * as Button and import {Button}

社会主义新天地 提交于 2019-12-25 09:03:20
问题 I am new to Typescript and I'm trying to import a react-bootstrap Button using case 1: import {Button} from 'react-bootstrap/lib/Button' case 2: import * as Button from 'react-bootstrap/lib/Button' Both the ways dont throw any error on import statement but throws error when this Button is rendered using <Button bsClass="glyphicon glyphicon-new-window"></Button> In case 1 there is no compile time error but Button is undefined In case 2 Typescript throws the following compile time error TS2604:

Control Focus of Multiple FormControl Fields

Deadly 提交于 2019-12-25 08:59:04
问题 I have a mapped list of input fields: <FormControl name={row_index} value={barcode.barcode} placeholder="Barcode - then Enter" onChange={this.onChange} onKeyPress={this._handleKeyPress} disabled={barcode.submitted} /> I am currently using onKeyPress to handle submit: _handleKeyPress = (e) => { if (e.key === 'Enter') { const name = e.target.name; const barcodes = this.state.barcodes; const this_barcode = barcodes[name]; let apiFormatted = {"barcode": this_barcode.barcode, "uid": this.props

What is the correct way to pass props to NavItem

烂漫一生 提交于 2019-12-25 04:37:15
问题 My code works but give an error so I just wanted to inform how I can prevent an error from showing up. I'd like to learn how to write correct code. This is what my code looks like now: export const AuthenticatedNavigation = (props) => { const activeCity = props.activeCity; return ( <div> <Nav className="fluid-container"> <LinkContainer to="beijing" > <NavItem eventKey={ 1 } href="">Chapter 1: Beijing</NavItem> </LinkContainer> <LinkContainer to="shanghai"> <NavItem eventKey={ 2 } activeCity=

Change the <a> element class in react-bootstrap NavItem

人盡茶涼 提交于 2019-12-24 14:35:05
问题 I am trying to work with react-bootstrap and change the NavItem inner <a> element's class. I tried using className but it didn't affect it. I want to change the colour of the hover action. How can I do it? <Navbar.Collapse> <Nav pullRight> <NavItem eventKey={1} href="#">1</NavItem> <NavItem eventKey={2} href="#">2</NavItem> <NavItem eventKey={3} href="#" className="my-class">3</NavItem> </Nav> </Navbar.Collapse> css: .xnavbar-tab a { color: #F89800; } 回答1: to change the anchor element that is

How to get dropdown-button working in react bootstrap?

余生长醉 提交于 2019-12-24 09:06:01
问题 I am using react-bootstrap and am using the dropdownbutton component. This for some reason does not render . I am unable to figure it out. Any help will be appreciated. It basically does not show up. I also wanted to know if I am getting the value of the dropdownbutton the correct way. By the way I have also imported href="https://maxcdn.bootstrapcdn.com/bootstrap/latest/css/bootstrap.min.css" in the index file. import {Component} from "react"; import fetch from "isomorphic-fetch"; import

How can I structure a modal from a navbar in react with Bootstrap?

烈酒焚心 提交于 2019-12-24 06:48:31
问题 I'm new to React, so I apologize in advance. Here's my navbar component: import React, { Component } from 'react'; import AuthModal from './modals/AuthModal' import { Nav, NavItem, Navbar, NavDropdown, MenuItem } from 'react-bootstrap' export default class MyNavbar extends Component { render() { return ( <Navbar inverse> <Navbar.Header> <Navbar.Brand> <span className="logo">SITE</span> </Navbar.Brand> <Navbar.Toggle /> </Navbar.Header> <Navbar.Collapse> <Nav className="navleft"> <NavItem

How to get value of selected option in react-bootstrap select FromControl

烂漫一生 提交于 2019-12-24 06:08:12
问题 I'm trying to write what the user selects from a dropdown to a firebase database based off the value stored in the component state, but I can't figure out how to get the value of the selected option and update it to the storeType state Here is my dropdown menu: <FormGroup> <FormControl componentClass="select" placeholder="Store type" onChange={this.handleCatChange} > <option value="placeholder">Choose eatery type...</option> <option value="cafe">Cafe</option> <option value="bakery">Bakery<