antd

React - Internet explorer 11 input loses focus after first onchange

守給你的承諾、 提交于 2021-01-24 09:02:21
问题 I have come across a very strange issue that I can't wrap my head around. I'm currently working with an create-react-app using react 16.3 and Antd 3.11 framework and I have created a table which inside it's header column renders a component with an onChange event attached. The issue comes when I focus the input for the first time. I lose focus on first key event, and afterwards when I click the field again, it remains focused until I click something else. Here is the example I have been using

Cannot read property 'addListener' of undefined react-testing-library

 ̄綄美尐妖づ 提交于 2021-01-23 05:44:04
问题 I'm trying to test my antd application with react testing library , but I keep getting this error: TypeError: Cannot read property 'addListener' of undefined Im using a custom render but the error seems to be coming from the 'render' method. const customRender = (ui, options) => render(ui, { wrapper: TestingWrapper, ...options }) ^ I´m even using the same versions of react and react-dom (which seems to be a common issue with rtl). "react": "17.0.1", "react-dom": "17.0.1", The problematic

Cannot read property 'addListener' of undefined react-testing-library

北城以北 提交于 2021-01-23 05:42:09
问题 I'm trying to test my antd application with react testing library , but I keep getting this error: TypeError: Cannot read property 'addListener' of undefined Im using a custom render but the error seems to be coming from the 'render' method. const customRender = (ui, options) => render(ui, { wrapper: TestingWrapper, ...options }) ^ I´m even using the same versions of react and react-dom (which seems to be a common issue with rtl). "react": "17.0.1", "react-dom": "17.0.1", The problematic

Cannot read property 'addListener' of undefined react-testing-library

佐手、 提交于 2021-01-23 05:42:06
问题 I'm trying to test my antd application with react testing library , but I keep getting this error: TypeError: Cannot read property 'addListener' of undefined Im using a custom render but the error seems to be coming from the 'render' method. const customRender = (ui, options) => render(ui, { wrapper: TestingWrapper, ...options }) ^ I´m even using the same versions of react and react-dom (which seems to be a common issue with rtl). "react": "17.0.1", "react-dom": "17.0.1", The problematic

Using customRequest in Ant design file upload

限于喜欢 提交于 2021-01-21 06:01:23
问题 I am using Axios to handle the file upload. I am facing a problem showing the upload progress of the file upload. The file upload view I am using is "picture-card". HTML <Upload accept="image/*" customRequest={uploadImage} onChange={handleOnChange} listType="picture-card" fileList={defaultListOfFiles} className="image-upload-grid" > {defaultListOfFiles.length >= 8 ? null : <div>Upload Button</div>} </Upload> OnChangeHandler const handleOnChange = ({ file, fileList, event }) => { console.log

Using customRequest in Ant design file upload

送分小仙女□ 提交于 2021-01-21 06:00:54
问题 I am using Axios to handle the file upload. I am facing a problem showing the upload progress of the file upload. The file upload view I am using is "picture-card". HTML <Upload accept="image/*" customRequest={uploadImage} onChange={handleOnChange} listType="picture-card" fileList={defaultListOfFiles} className="image-upload-grid" > {defaultListOfFiles.length >= 8 ? null : <div>Upload Button</div>} </Upload> OnChangeHandler const handleOnChange = ({ file, fileList, event }) => { console.log

how to sort a table in alphabetical order with antd [duplicate]

旧街凉风 提交于 2021-01-21 00:44:02
问题 This question already has answers here : Sort array by firstname (alphabetically) in Javascript [duplicate] (23 answers) Closed 1 year ago . I want to filter the column in alphabetical order here is the code to filter by the size how to do thank you const columns = [{ title: 'First Name', dataIndex: 'first_name', sortDirections: ['descend', 'ascend'], key: 'first_name', width: '20%', sorter: (a, b) => a.first_name.length - b.first_name.length, }] 回答1: You can use localeCompare() sorter: (a, b

how to sort a table in alphabetical order with antd [duplicate]

北战南征 提交于 2021-01-21 00:38:47
问题 This question already has answers here : Sort array by firstname (alphabetically) in Javascript [duplicate] (23 answers) Closed 1 year ago . I want to filter the column in alphabetical order here is the code to filter by the size how to do thank you const columns = [{ title: 'First Name', dataIndex: 'first_name', sortDirections: ['descend', 'ascend'], key: 'first_name', width: '20%', sorter: (a, b) => a.first_name.length - b.first_name.length, }] 回答1: You can use localeCompare() sorter: (a, b

react-router+antD/ How to highlight a menu item when press back/forward button?

北城以北 提交于 2021-01-20 23:54:53
问题 I create a menu and want to highlight the item which i choose,and i did it. But when i press back/forward button,the menu item don't highlight. What should i do? I have tried to use addEventListener but failed. Have someone could give some advice? class Sidebar extends React.Component { constructor(props) { super(props); this.state={ test: "home" } this.menuClickHandle = this.menuClickHandle.bind(this); } componentWillMount(){ hashHistory.listen((event)=>{ test1 = event.pathname.split("/"); }

react-router+antD/ How to highlight a menu item when press back/forward button?

╄→гoц情女王★ 提交于 2021-01-20 23:49:32
问题 I create a menu and want to highlight the item which i choose,and i did it. But when i press back/forward button,the menu item don't highlight. What should i do? I have tried to use addEventListener but failed. Have someone could give some advice? class Sidebar extends React.Component { constructor(props) { super(props); this.state={ test: "home" } this.menuClickHandle = this.menuClickHandle.bind(this); } componentWillMount(){ hashHistory.listen((event)=>{ test1 = event.pathname.split("/"); }