ANTD React How can I do affix like antd website? - reactjs

I want to affix the buttons in the bottom right corner as on the antd website. I couldn't do this

You can easily achieve this. Before that, I would recommend you to show us what you have tried. Stackoverflow should be used when you aren't able to achieve what you desire. Please don't repeat the same in the near future. BTW, you can do this by using Affix as you told. This should have a Button which has an icon. This will keep the icon fixed at the right bottom of page.
import {Button, Affix} from 'antd';
import { wechat } from '#ant-design/icons'
<Affix style={{position:'fixed',bottom:10,right:10}}>
<Button type="primary" icon="wechat" />
</Affix>

Related

React Native - Bottom Sheet always shows up on mount

I am using React Native with Expo and i am attempting to use Gorhom's Bottom Sheet component to display a bottom sheet when a user clicks on a button. Everything works fine except the bottom sheet insists to always pop up on screen mount, which is obviously bad, it should only pop up when user clicks on a trigger like a button.
Here's my component:
import BottomSheet, { BottomSheetScrollView } from '#gorhom/bottom-sheet'
<BottomSheet
ref={sheetRef}
enableOverDrag
handleIndicatorStyle={styles.handleIndicator}
snapPoints={snapPoints}
enablePanDownToClose
>
<BottomSheetScrollView>
{children}
</BottomSheetScrollView>
</BottomSheet>
I've tried to toggle a display none/flex but that makes the popup not smooth and very sudden:
containerStyle={[styles.container, {display: showSheet ? 'flex' : 'none'}]}
I've went through the entire docs twice but found nothing that can help me.
If the expected behavior is to only show the bottom sheet when the user clicks a button, then it's looking more like a modal. There's the BottomSheetModal wrapper/decorator for that.
Instead of importing BottomSheet, import BottomSheetModal. Then get its reference and call the methods bottomSheetRef.current.present() and bottomSheetRef.current.close(). Doing it this way, all the show/hide up/down animations will work right off the bet.
Take a look at the documentation for a full example.

antd badge number is resized incorrectly

I'm trying to use antd's badge, but the number+badge always looks out of sync with the icon no matter which icon I use.
Here is a screenshot of the problem:
I have antd's badge imported correctly, NotificationOutlined imported properly, and antd is 4.0+. I have attempted using CSS and playing with fontSize but it does not doing anything.
Code:
<Badge count={5}>
<NotificationOutlined />
</Badge>
I'd appreciate any guesses/ insight to how I can solve this!
Source: https://ant.design/components/badge/

Material Ui TextField remove bottom border

i am using material ui for my project and this is my textField
text field reality
as you can see there is an bottom border underline it, but i want to remove it completely, previously i usually use border: "0px" but i dont know how to customize it, this is what i want
text field expectation
thank for your time to help me out, highly appreciate your effort, hope you have a good day
you can edit in this codesandbox link: codesanboxlink
for this case you can import InputBase from material-ui
import InputBase from '#material-ui/core/InputBase';
you can see your example at codesandbox codesandboxlink

React How do you pin up/show/poster a button with visibility icon (eye) in material ui table?

I want to show in React a green button with an eye like in my sketch green button the goala . I did my table material-ui from material-ui website. However I can't pin up my <IconButton><Visibility/></IconButton> in my websitemywebsitewiththetick. I followed a lot of videos without success. I tried different values im my table but this one shows me V (tick).
code
code
I put in "import" :
import React from 'react';
import MaterialTable from 'material-table';
import IconButton from 'material-ui';
import { Visibility } from '#material-ui-icons';
What do you think, please ?
Have a good day
Video :
https://www.youtube.com/watch?v=Vj27n1ekPJY
Icon Visibility material-ui :
https://material-ui.com/components/material-icons/
table material-ui in code sandbox :
https://codesandbox.io/s/material-demo-yet69?file=/index.js
enter image description here
I used my own codepen with html css and javascript babel. I changed js file into jsx file.My tables works. I have done.I find the answer.

antd dont import all icons

I am using only the loading property of Button component.
Internally the button component requires 0.5mb of icons.
Is there is any way to use only loading icon and not the huge icons import?
Thanks.
I haven't tried for Icon components,
but you can check out babel-plugin-import, which optimizes import statements.
I was able to make it work with CSS & other AntD components.
What I understood from your question is correct, the answer is no. In the meanwhile, you can try another way. download the specific icon as an SVG format form the icon and create your own icon bundle for using icon moon and use it. So you can reduce the size.
Bonus point: Always try to import a specific component like below instead downloading whole antd component.
import Button from 'antd/lib/button';

Resources