Skip to content

Commit

Permalink
feat: add childrenStyle prop
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremybarbet committed Apr 22, 2020
1 parent 7153c68 commit 1519e9c
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 3 deletions.
10 changes: 9 additions & 1 deletion docs/PROPS.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ Multiple objects way to style the different part of Modalize.

### `modalStyle`

Define the style of the modal.
Define the style of the modal (includes handle/header/children/footer).

| Type | Required |
| -------- | -------- |
Expand All @@ -92,6 +92,14 @@ Define the style of the overlay.
| -------- | -------- |
| style | No |

### `childrenStyle`

Define the style of the children renderer (only the inside part).

| Type | Required |
| -------- | -------- |
| style | No |

### `modalElevation`

A number to define the elevation of the modal on Android. Useful if you have other elements of your app using other values of elevation.
Expand Down
1 change: 1 addition & 0 deletions examples/expo/src/components/modals/SectionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const SectionList = forwardRef((_, ref) => {
return (
<Modalize
ref={combinedRef}
childrenStyle={{ borderTopLeftRadius: 12, borderTopRightRadius: 12, overflow: 'hidden' }}
sectionListProps={{
sections: getSections(),
renderItem: renderItem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const SectionList = ({ componentId }) => {
<Modalize
ref={modalRef}
onClosed={onClosed}
childrenStyle={{ borderTopLeftRadius: 12, borderTopRightRadius: 12, overflow: 'hidden' }}
sectionListProps={{
sections: getSections(),
renderItem: renderItem,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ export const SectionList = forwardRef((_, ref) => {
return (
<Modalize
ref={combinedRef}
childrenStyle={{ borderTopLeftRadius: 12, borderTopRightRadius: 12, overflow: 'hidden' }}
sectionListProps={{
sections: getSections(),
renderItem: renderItem,
Expand Down
3 changes: 2 additions & 1 deletion src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ const ModalizeBase = (
modalStyle,
handleStyle,
overlayStyle,
childrenStyle,
modalElevation,

// Layout
Expand Down Expand Up @@ -685,7 +686,7 @@ const ModalizeBase = (
activeOffsetX={ACTIVATED}
onHandlerStateChange={onHandleChildren}
>
<Animated.View style={style}>
<Animated.View style={[style, childrenStyle]}>
<NativeViewGestureHandler
ref={modalContentView}
waitFor={modal}
Expand Down
7 changes: 6 additions & 1 deletion src/options.ts
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ export interface IProps<ListItem = any> {
sectionListProps?: Animated.AnimatedProps<SectionListProps<ListItem>>;

/**
* Define the style of the modal.
* Define the style of the modal (includes handle/header/children/footer).
*/
modalStyle?: TStyle;

Expand All @@ -77,6 +77,11 @@ export interface IProps<ListItem = any> {
*/
overlayStyle?: TStyle;

/**
* Define the style of the children renderer (only the inside part).
*/
childrenStyle?: TStyle;

/**
* A number to define the elevation of the modal on Android. Useful if you have other elements of your app using other values of elevation (Android specific).
*/
Expand Down

0 comments on commit 1519e9c

Please sign in to comment.