Using Material-UI v1,
I want to access root inside styles of the Button component, and to use it for a whole other component (an input).
Doing import { styles } from 'material-ui/Button'; doesn't seem to work.
Is it possible? if so, then how?
Was able to achieve this using simply import { styles } from 'material-ui/Button/Button';
Related
Hi i'm trying to use the stack component from material ui. I use a lot of material ui component and they all work just fine but for some reason using the import route from the offical material ui doc doesn't seem to work.
import { Accordion, AccordionDetails, Stack, Grid, Typography } from '#material-ui/core';
It simply says that: "Module '"#material-ui/core"' has no exported member 'Stack'."
It does the same exact thing if i try the other import route:
import Stack from '#material-ui/core/Stack';
I am really confused as to what is going on here. Anybody has any idea?
The stack component is not available in V4. It is only available in V5.
I faced the same problem, look to the documentaion
import { Stack } from '#mui/material';
The Ionic 5 documentation says:
The textarea component accepts the native textarea attributes in addition to the Ionic properties.
But this does not apply to CSS properties of the native textarea, so how is it possible to make the ion-textarea element resizable?
You can try using the below plugin:
https://www.npmjs.com/package/ngx-autosize
OR
npm i ngx-autosize
import { AutosizeModule } from 'ngx-autosize';
below is the code i used in ionic/angular to make the ion-textarea resize:
<ion-textarea
[minRows]="1"
[maxRows]="5"
autosize
placeholder="Start writing..."
></ion-textarea>
you need to import it in and imports array in app.module and page.module where you need to use it.
Im using material-ui and react-router-dom in my react (typescript) application
I have tried to use the following tip/help, so that when a user clicks a button (or whatever) he gets redirected to that route. Very basic stuff. When I click on the button, the url is updated in the url-window in my browser, but the correct component is not loaded. I had this working using bootstrap (and 'react-router-bootstrap's NavigationLink), but now Im stuck. Any tips how to get this working
(Im also using Mobx as state handler), Im also happy with any other router, if that makes my life simpler
https://material-ui.com/demos/buttons/
and
How to make a Material UI react Button act as a react-router-dom Link?
Note that if I hit enter in the url-window I get routed correctly (to right component)
I'm using this method to achieve a correct react-router-dom link for a Button component from material-ui.
Define a LinkComponent
import * as React from 'react';
import { Link } from 'react-router-dom';
export const LinkComponent = (props: any) => {
return <Link {...props} />;
};
Then you can use it like this:
<Button
variant={'outlined'}
color={'primary'}
component={LinkComponent}
to={'/'}>
HomePage
</Button>
If you don't want to create a dedicated component for this purpose, you can use it as a lambda function as a component prop for the <Button>.
I am creating very basic ionic app. I want to show splash, then admob interstitial and on close of interstitial, i want to redirect to home page.
The only problem which I am facing here is updating the view in the home page. In home page, i have very simple text box and button. I am using 2 way data binding here and its not working at all.
I have created repo for this if somebody wants to have a look and let me know why the view is not updating.
https://github.com/krishnaa99/admobissue
Demo Video
https://www.youtube.com/watch?v=t_BKJ1mGpag
if the value is changing in component but not in view(html) then after action in component use this.
import { ChangeDetectorRef } from '#angular/core';
constructor(private changeRef: ChangeDetectorRef){}
this.changeRef.detectChanges();
i hope it can help.
Possible solutions you can try
you should check the logs for errors
Assign clear type to "input" variable. ( try making it explicitly
public )
"input" may be considered as a keyword, try using a different
variable name ( less likely )
I have recently upgraded to ionic 3 implementing the IonicPageModule for navigation. The push and setRoot works for all navigating however i am stuck at the trying to reference the pages in the app.component.ts
Normally i would reference the page from the import like so
this.rootPage = user ? ProgramsPage : LoginPage;
Where LoginPage and ProgramPage are declared in the app.module.ts
However in the new angular 4 / ionic 3 setup references to the "pages" are referenced with strings without an import in the related page.ts and seemly integrated with the navCtrl's push and set
I have tried
import { LoginPageModule } from '../pages/login/login.module';
But that does not make sense.
I figured the whole point of creating modules per page was to firstly enalble lazy loading but also minimize the import code on pages without having to create a config export class.
And the thing is you cannot declare the LoginPage twice and seeing as though it is already declared as a module through the IonicPageModule one cannot add that export class again.
So just wondering how do you reference a ionic 3 page module when you want to apply logic?
I came across an article that implemented close to what you really wanted; though it talked more about cloud functions but at the beginning it tried to solve your problem in a very fashionable way. Take a look https://javebratt.com/firebase-cloud-functions-profile/
if your pages are being declared as:
/* imports and stuff here ... */
#IonicPage()
#Component({
selector: 'page-user',
templateUrl: 'user.html'
})
export class UserPage { /* constructor, your code & else ... */ }
or generated using the ionic-cli by running: ionic g page NewAppPage
you will be able to use the string page name instead of using the page object (that also requires you to import the page).
Take a look at https://www.javascripttuts.com/ionic-3-new-pages-lazy-loading/ , it may help you understand a little bit more about lazy loading and pages inside the app component.