Skip to content

Commit abf178b

Browse files
committed
chore: clean-up
1 parent 1ddd9f2 commit abf178b

File tree

4 files changed

+14
-15
lines changed

4 files changed

+14
-15
lines changed

docs/developing/autofocus.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,15 +10,15 @@ title: Autofocus
1010
/>
1111
</head>
1212

13-
Developers that want to set focus to an element on "page load" can use the `setFocus` API to set focus to an element. This API should be used in place of the `autofocus` attribute and called within the `ionViewDidEnter` lifecycle event.
13+
Developers that want to set focus to an element on "page load" can use the `setFocus` API to set focus to an element. This API should be used in place of the `autofocus` attribute and called within the `ionViewDidEnter` lifecycle event for routing applications and the `appload` event for vanilla JavaScript applications.
1414

1515
The example below highlights the difference in behavior between the `autofocus` attribute and the `setFocus` API.
1616

1717
import Basic from '@site/static/usage/v7/autofocus/basic/index.md';
1818

1919
<Basic />
2020

21-
:::warning
21+
:::warning Warning
2222

2323
Developers will receive a warning in their console when using the `autofocus` attribute in the StackBlitz examples due to cross-origin restrictions.
2424

static/usage/v7/autofocus/basic/index.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ import vue_example_vue from './vue/example_vue.md';
1616
import vue_router_ts from './vue/router_ts.md';
1717

1818
import react_main_tsx from './react/main_tsx.md';
19-
import react_home_page_tsx from './react/home_page_tsx.md';
19+
import react_home_tsx from './react/home_tsx.md';
2020

2121
<Playground
2222
version="7"
@@ -32,8 +32,8 @@ import react_home_page_tsx from './react/home_page_tsx.md';
3232
},
3333
angular: {
3434
files: {
35-
'src/app/example.component.html': angular_example_component_html,
3635
'src/app/example.component.ts': angular_example_component_ts,
36+
'src/app/example.component.html': angular_example_component_html,
3737
'src/app/app.module.ts': angular_app_module_ts,
3838
'src/app/app.component.html': angular_app_component_html,
3939
'src/app/app.component.ts': angular_app_component_ts,
@@ -42,8 +42,8 @@ import react_home_page_tsx from './react/home_page_tsx.md';
4242
},
4343
react: {
4444
files: {
45+
'src/pages/Home.tsx': react_home_tsx,
4546
'src/main.tsx': react_main_tsx,
46-
'src/pages/HomePage.tsx': react_home_page_tsx,
4747
},
4848
},
4949
}}

static/usage/v7/autofocus/basic/react/home_page_tsx.md renamed to static/usage/v7/autofocus/basic/react/home_tsx.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import React, { useRef } from 'react';
33
import { IonInput, IonItem, IonList, IonPage, useIonViewDidEnter } from '@ionic/react';
44

5-
const HomePage = () => {
5+
const Home = () => {
66
const input = useRef<HTMLIonInputElement>(null);
77

88
useIonViewDidEnter(() => {
@@ -23,5 +23,5 @@ const HomePage = () => {
2323
);
2424
};
2525

26-
export default HomePage;
26+
export default Home;
2727
```

static/usage/v7/autofocus/basic/react/main_tsx.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,18 @@ import { IonReactRouter } from '@ionic/react-router';
55

66
import { Route, Redirect } from 'react-router';
77

8-
import HomePage from './pages/HomePage';
8+
import Home from './pages/Home';
99

1010
function Example() {
1111
return (
1212
<IonReactRouter>
1313
<IonRouterOutlet>
14-
<Redirect exact path="/" to="/home" />
15-
{/*
16-
Use the render method to reduce the number of renders your component will have due to a route change.
17-
18-
Use the component prop when your component depends on the RouterComponentProps passed in automatically.
19-
*/}
20-
<Route path="/home" render={() => <HomePage />} exact={true} />
14+
<Route exact path="/home">
15+
<Home />
16+
</Route>
17+
<Route exact path="/">
18+
<Redirect to="/home" />
19+
</Route>
2120
</IonRouterOutlet>
2221
</IonReactRouter>
2322
);

0 commit comments

Comments
 (0)