Skip to content

Commit

Permalink
Updating Lists to us RN over native module ListWrapper (#269)
Browse files Browse the repository at this point in the history
* remove ListWrapper from components

* Remove ListWrapper comp

* Remove ListWrapper doc

* remove export of ListWrapper

* remove ref to ListWrapper

* Added changesets
  • Loading branch information
JDMathew authored Nov 18, 2024
1 parent e5b1c06 commit 71cb312
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 169 deletions.
11 changes: 11 additions & 0 deletions .changeset/kind-impalas-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'@react-native-ama/lists': minor
'@react-native-ama/animations': minor
'@react-native-ama/core': minor
'@react-native-ama/extras': minor
'@react-native-ama/forms': minor
'@react-native-ama/internal': minor
'@react-native-ama/react-native': minor
---

Removed ListWrapper and corresponding native module allowing `lists` package to be used in expo apps
12 changes: 0 additions & 12 deletions packages/lists/docs/DynamicFlatList.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,18 +19,6 @@ import { DynamicFlatList } from '@react-native-ama/lists';
/>
```

## Accessibility Improvements

- On `Android` allows TalkBack to announce **in list**/**out list** or **in grid**/**out of grid**
- A [dynamic list](./DynamicFlatList.mdx) automatically announces the number of items found when
it gets filtered

### TalkBack

<TalkBackList />

To provide this accessibility feature AMA wraps the list in the custom native
component: [ListWrapper](./ListWrapper.mdx).

### Dynamic list

Expand Down
10 changes: 0 additions & 10 deletions packages/lists/docs/FlatList.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,6 @@ import { FlatList } from '@react-native-ama/lists';
/>
```

## Accessibility Improvements

- On `Android` allows TalkBack to announce **in list**/**out list** or **in grid**/**out of grid**
- A [dynamic list](./DynamicFlatList.mdx) automatically announces the number of items found when it gets filtered

### TalkBack

<TalkBackList />

To provide this accessibility feature AMA wraps the list in the custom native component: [ListWrapper](./ListWrapper.mdx).

### Dynamic list

Expand Down
42 changes: 0 additions & 42 deletions packages/lists/docs/ListWrapper.mdx

This file was deleted.

11 changes: 0 additions & 11 deletions packages/lists/docs/StaticFlatList.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@ import { StaticFlatList } from '@react-native-ama/lists';
/>
```

## Accessibility Improvements

- On `Android` allows TalkBack to announce **in list**/**out list** or **in grid**/**out of grid**

### TalkBack

<TalkBackList />

To provide this accessibility feature, AMA wraps the list in the custom native
component: [ListWrapper](./ListWrapper.mdx).


## Additional props

Expand Down
23 changes: 7 additions & 16 deletions packages/lists/src/components/DynamicFlatList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ import React from 'react';
import { FlatList, FlatListProps } from 'react-native';

import { useDynamicList } from '../hooks/useDynamicList';
import { ListWrapper } from './ListWrapper';

type DynamicFlatListProps<T> = FlatListProps<T> & {
singularMessage: string;
Expand All @@ -27,22 +26,14 @@ export const DynamicFlatList = React.forwardRef<
});

return __DEV__ ? (
<ListWrapper
rowsCount={dynamicList.rowsCount}
columnsCount={dynamicList.columnsCount}>
<FlatList
data={data}
{...rest}
ref={forwardedRef}
style={dynamicList.style}
/>
</ListWrapper>
<FlatList
data={data}
{...rest}
ref={forwardedRef}
style={dynamicList.style}
/>
) : (
<ListWrapper
rowsCount={dynamicList.rowsCount}
columnsCount={dynamicList.columnsCount}>
<FlatList data={data} {...rest} ref={forwardedRef} />
</ListWrapper>
<FlatList data={data} {...rest} ref={forwardedRef} />
);
},
);
20 changes: 0 additions & 20 deletions packages/lists/src/components/ListWrapper.android.test.tsx

This file was deleted.

15 changes: 0 additions & 15 deletions packages/lists/src/components/ListWrapper.ios.test.tsx

This file was deleted.

35 changes: 0 additions & 35 deletions packages/lists/src/components/ListWrapper.tsx

This file was deleted.

8 changes: 1 addition & 7 deletions packages/lists/src/components/StaticFlatList.tsx
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
import React from 'react';
import { FlatList, FlatListProps } from 'react-native';

import { ListWrapper } from './ListWrapper';

export type StaticFlatListProps = {
rowsCount?: number;
numColumns?: number;
Expand All @@ -24,9 +22,5 @@ export const StaticFlatList = React.forwardRef<
return Math.ceil(columns > 1 && length > 0 ? length / columns : length);
}, [columns, data?.length, rowsCount]);

return (
<ListWrapper rowsCount={rows} columnsCount={columns}>
<FlatList data={data} {...rest} ref={ref} />
</ListWrapper>
);
return <FlatList data={data} {...rest} ref={ref} />;
});
1 change: 0 additions & 1 deletion packages/lists/src/index.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
// Components
export { DynamicFlatList } from './components/DynamicFlatList';
export { FlatList } from './components/FlatList';
export { ListWrapper } from './components/ListWrapper';
export { StaticFlatList } from './components/StaticFlatList';

// Hooks
Expand Down

0 comments on commit 71cb312

Please sign in to comment.