Skip to content

Commit

Permalink
feat: add innerViewWrapperStyle prop
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards1211 committed May 7, 2019
1 parent 74c56b8 commit 3669a50
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,12 @@ Extra inline styles to add to the inner "viewport" element.

Extra inline styles to add to the view wrapper elements.

##### `innerViewWrapperStyle: Object`

Extra inline styles to add to the inner div between the `viewStyle` div and your
view content element. (The inner div was added to ensure perfect height
animation.)

##### `rootRef: (node: ?HTMLDivElement) => any`

The `ref` to pass to the root `<div>` element rendered by `ViewSlider`.
Expand Down
6 changes: 5 additions & 1 deletion src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ export type Props = {
viewportClassName?: string,
viewportStyle: Object,
viewStyle?: ?Object,
innerViewWrapperStyle?: ?Object,
rootRef?: (node: ?React.ElementRef<'div'>) => mixed,
viewportRef?: (node: ?React.ElementRef<'div'>) => mixed,
rtl: boolean,
Expand Down Expand Up @@ -180,6 +181,7 @@ export default class ViewSlider extends React.Component<Props, State> {
spacing,
rtl,
viewStyle,
innerViewWrapperStyle,
} = this.props
const { activeView, transitioning } = this.state

Expand All @@ -205,7 +207,9 @@ export default class ViewSlider extends React.Component<Props, State> {
style={prefixer.prefix(style)}
ref={c => (this.views[index] = c)}
>
<div style={{ width: '100%' }}>
<div
style={prefixer.prefix({ width: '100%', ...innerViewWrapperStyle })}
>
<TransitionContext state={this.getTransitionState(index)}>
{this.props.renderView({
index,
Expand Down
1 change: 1 addition & 0 deletions src/simple.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ export type Props = {
viewportClassName?: string,
viewportStyle?: Object,
viewStyle?: ?Object,
innerViewWrapperStyle?: ?Object,
rootRef?: (node: ?React.ElementRef<'div'>) => mixed,
viewportRef?: (node: ?React.ElementRef<'div'>) => mixed,
rtl?: ?boolean,
Expand Down

0 comments on commit 3669a50

Please sign in to comment.