gitbrent / bootstrap4-toggle

Bootstrap 4 Switch Button / Toggle
https://gitbrent.github.io/bootstrap4-toggle/
MIT License
213 stars 67 forks source link

toggle component shows up as a checkbox #31

Open ptt-bs23 opened 4 years ago

ptt-bs23 commented 4 years ago

I made a toggle switch component in react with bootstrap4-toggle and it looks like this:

import React, { Component } from "react";
import "bootstrap4-toggle/css/bootstrap4-toggle.min.css";

class ToggleSwitch extends Component {
  render() {
    return (
      <div className="toggle-switch">
        <input
          type="checkbox"
          data-toggle="toggle"
          data-on="Ready"
          data-off="Not Ready"
          data-onstyle="success"
          data-offstyle="danger"
        />
      </div>
    );
  }
}

export default ToggleSwitch;

But it shows like a simple checkbox. No error in console. Any help on this?

ToTenMilan commented 3 years ago

I had this issue two times. The first time, toggles were initially showing as a simple checkbox, no classes applied, but after the page reload, the form properly shows toggles. I "fixed" it by changing the form attribute from remote: true to remote: false The second time toggles are not showing initially even with remote: false and I didn't found a solution yet