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

fix: linter #7

Merged
merged 1 commit into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
const examples = [
{ component: ThreeTabs, name: 'Three Tabs' },
{ component: FourTabs, name: 'Four Tabs' },
{
component: FourTabs,
name: 'Four Tabs - No header',
screenOptions: { headerShown: false },
},
{ component: JSBottomTabs, name: 'JS Bottom Tabs' },
];

Expand Down Expand Up @@ -61,7 +66,7 @@
name="BottomTabs Example"
component={App}
options={{
headerRight: () => (

Check warning on line 69 in example/src/App.tsx

View workflow job for this annotation

GitHub Actions / lint

Do not define components during render. React will see a new component type on every render and destroy the entire subtree’s DOM nodes and state (https://reactjs.org/docs/reconciliation.html#elements-of-different-types). Instead, move this component definition out of the parent component “Navigation” and pass data as props. If you want to allow component creation in props, set allowAsProps option to true
<Button
onPress={() =>
Alert.alert(
Expand Down Expand Up @@ -91,6 +96,7 @@
key={index}
name={example.name}
component={example.component}
options={example.screenOptions}
/>
))}
</NavigationStack.Navigator>
Expand Down
2 changes: 1 addition & 1 deletion example/src/Examples/FourTabs.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Albums } from '../Screens/Albums';
import { Contacts } from '../Screens/Contacts';
import { Chat } from '../Screens/Chat';

export default function ThreeTabs() {
export default function FourTabs() {
const [index, setIndex] = useState(0);
const [routes] = useState([
{ key: 'article', title: 'Article', icon: 'document.fill', badge: '!' },
Expand Down
2 changes: 1 addition & 1 deletion src/TabViewNativeComponent.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ export type OnPageSelectedEventData = Readonly<{
export type TabViewItems = ReadonlyArray<{
key: string;
title: string;
icon: string;
icon?: string;
badge?: string;
}>;

Expand Down
6 changes: 0 additions & 6 deletions src/index.tsx
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
import TabView from './TabView';
import type {
TabViewItems,
OnPageSelectedEventData,
} from './TabViewNativeComponent';

export type { TabViewItems, OnPageSelectedEventData };

export { SceneMap } from './SceneMap';

Expand Down
Loading