Skip to content
Open
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
9 changes: 9 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ let toast = Toast.show('This is a message', {
animation: true,
hideOnPress: true,
delay: 0,
padding: 10,
borderRadius: 5,
onShow: () => {
// calls on toast\`s appear animation start
},
Expand Down Expand Up @@ -112,6 +114,9 @@ class Example extends Component{
shadow={false}
animation={false}
hideOnPress={true}
paddingVertical={16}
paddingHorizontal={32}
borderRadius={50}
>This is a message</Toast>;
}
}
Expand Down Expand Up @@ -141,6 +146,10 @@ onShow | null | Function | Callback for toast\`
onShown | null | Function | Callback for toast\`s appear animation end
onHide | null | Function | Callback for toast\`s hide animation start
onHidden | null | Function | Callback for toast\`s hide animation end
padding | null | Number | Padding of the toast
paddingVertical | null | Number | Vertical padding of the toast
paddingHorizontal | null | Number | Horizontal padding of the toast
borderRadius | null | Number | Border radius of the toast

### Constants

Expand Down
9 changes: 6 additions & 3 deletions index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,14 @@ declare module "react-native-root-toast"{
onHidden?: Function,
onShow?: Function,
onShown?: Function,
onPress?: Function
onPress?: Function,
padding?: number,
paddingVertical?: number,
paddingHorizontal?: number,
borderRadius?: number
}

export interface ToastProps extends ToastOptions,ReactNative.ViewProperties{
}
export interface ToastProps extends ToastOptions{}

export interface Durations {
LONG:number,
Expand Down
15 changes: 12 additions & 3 deletions lib/ToastContainer.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,11 @@ class ToastContainer extends Component {
onHide: PropTypes.func,
onHidden: PropTypes.func,
onShow: PropTypes.func,
onShown: PropTypes.func
onShown: PropTypes.func,
padding: PropTypes.number,
paddingVertical: PropTypes.number,
paddingHorizontal: PropTypes.number,
borderRadius: PropTypes.number
};

static defaultProps = {
Expand All @@ -93,7 +97,8 @@ class ToastContainer extends Component {
opacity: 0.8,
delay: 0,
hideOnPress: true,
keyboardAvoiding: true
keyboardAvoiding: true,
padding: 10
};

constructor() {
Expand Down Expand Up @@ -250,7 +255,11 @@ class ToastContainer extends Component {
opacity: this.state.opacity
},
props.shadow && styles.shadowStyle,
props.shadowColor && {shadowColor: props.shadowColor}
props.shadowColor && {shadowColor: props.shadowColor},
props.padding && {padding: props.padding},
props.paddingVertical && {paddingVertical: props.paddingVertical},
props.paddingHorizontal && {paddingHorizontal: props.paddingHorizontal},
props.borderRadius && {borderRadius: props.borderRadius}
]}
pointerEvents="none"
ref={ele => this._root = ele}
Expand Down