diff --git a/README.md b/README.md index 2df2277..f9ea721 100644 --- a/README.md +++ b/README.md @@ -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 }, @@ -112,6 +114,9 @@ class Example extends Component{ shadow={false} animation={false} hideOnPress={true} + paddingVertical={16} + paddingHorizontal={32} + borderRadius={50} >This is a message; } } @@ -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 diff --git a/index.d.ts b/index.d.ts index 88c2647..91854f5 100644 --- a/index.d.ts +++ b/index.d.ts @@ -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, diff --git a/lib/ToastContainer.js b/lib/ToastContainer.js index e18a707..4868cd2 100644 --- a/lib/ToastContainer.js +++ b/lib/ToastContainer.js @@ -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 = { @@ -93,7 +97,8 @@ class ToastContainer extends Component { opacity: 0.8, delay: 0, hideOnPress: true, - keyboardAvoiding: true + keyboardAvoiding: true, + padding: 10 }; constructor() { @@ -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}