Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need To Customize Style #47

Open
MKR2554 opened this issue Jul 23, 2019 · 2 comments
Open

Need To Customize Style #47

MKR2554 opened this issue Jul 23, 2019 · 2 comments

Comments

@MKR2554
Copy link

MKR2554 commented Jul 23, 2019

Add Feature for customize the css property .

@adisatriakw
Copy link

@lanjingling0510 is it possible to add className props to component ? if so, it would be better

@anewcoder1992
Copy link

@lanjingling0510 is it possible to add className props to component ? if so, it would be better
you can add classname by yourself. then add your custome css.
my component flowing:

import React, { useEffect } from 'react'
import DatePicker from 'react-mobile-datepicker'
import './index.less'

const MyDatePicker = ({
  isOpen,
  onSelect,
  onCancel,
  confirmText,
  cancelText,
  value,
}) => {
  useEffect(() => {
    const modalElement = document.getElementsByClassName('Modal-Portal')[0]
    modalElement.classList.add('myDatePicker')
  }, [])
  return (
    <DatePicker
      theme="ios"
      isOpen={isOpen}
      showHeader={false}
      value={value}
      onCancel={onCancel}
      onSelect={onSelect}
      confirmText={confirmText}
      cancelText={cancelText}
    />
  )
}
export default MyDatePicker

my css file

.myDatePicker {
  .datepicker-modal {
    position: fixed;
  }
  .datepicker.ios {
    background-color: #ffffff;
    border-radius: 20px 20px 0px 0px;
    .datepicker-navbar {
      top: 20px;
    }
    .datepicker-content {
      padding-top: 94px;
    }
    .datepicker-navbar-btn {
      font-size: 28px;
      height: 74px;
      line-height: 74px;
      font-family: SF Pro Text, SF Pro Text-Regular;
      color: #0081cc;
    }
    .datepicker-scroll {
      & > li {
        font-size: 28px;
        font-family: SF Pro Text, SF Pro Text-Semibold;
        font-weight: 600;
        color: #262626;
      }
    }
  }

  .lockBody {
    overflow: hidden;
  }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants