Skip to content

Commit 09c924f

Browse files
committed
More customization
1 parent 0fc48ed commit 09c924f

File tree

3 files changed

+37
-21
lines changed

3 files changed

+37
-21
lines changed

README.md

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ npm i @freakycoder/react-native-empty-state
3434
## Import
3535

3636
```jsx
37-
import MyComponent from "@freakycoder/react-native-empty-state";
37+
import EmptyState from "@freakycoder/react-native-empty-state";
3838
```
3939

4040
## Fundamental Usage
@@ -64,24 +64,27 @@ should work of the example project.
6464

6565
## Fundamentals
6666

67-
| Property | Type | Default | Description |
68-
| ----------- | :----: | :-------: | --------------------- |
69-
| title | string | undefined | change the title |
70-
| description | string | undefined | change the descrition |
67+
| Property | Type | Default | Description |
68+
| ----------- | :----: | :-------: | ---------------------- |
69+
| title | string | undefined | change the title |
70+
| description | string | undefined | change the description |
7171

7272
## Customization (Optionals)
7373

74-
| Property | Type | Default | Description |
75-
| -------------------- | :-------: | :-------: | ---------------------------------------------------------------------- |
76-
| enableButton | boolean | false | let you enable the button (must use it for button) |
77-
| onPress | function | undefined | set your own logic for the button functionality when it is pressed |
78-
| buttonText | string | undefined | change the button's text |
79-
| style | ViewStyle | default | set or override the style object for the main container |
80-
| buttonStyle | ViewStyle | default | set or override the style object for the button style |
81-
| titleTextStyle | TextStyle | default | set or override the style object for the title text style |
82-
| buttonTextStyle | TextStyle | default | set or override the style object for the button's text style |
83-
| descriptionTextStyle | TextStyle | default | set or override the style object for the description text style |
84-
| ImageComponent | Image | default | set your own component instead of default react-native Image component |
74+
| Property | Type | Default | Description |
75+
| ------------------------- | :--------: | :-------: | ---------------------------------------------------------------------- |
76+
| enableButton | boolean | false | let you enable the button (must use it for button) |
77+
| onPress | function | undefined | set your own logic for the button functionality when it is pressed |
78+
| buttonText | string | undefined | change the button's text |
79+
| style | ViewStyle | default | set or override the style object for the main container |
80+
| buttonStyle | ViewStyle | default | set or override the style object for the button style |
81+
| titleTextStyle | TextStyle | default | set or override the style object for the title text style |
82+
| buttonTextStyle | TextStyle | default | set or override the style object for the button's text style |
83+
| descriptionTextStyle | TextStyle | default | set or override the style object for the description text style |
84+
| containerGlueStyle | ViewStyle | default | set or override the style object for the container glue style |
85+
| descriptionContainerStyle | ViewStyle | default | set or override the style object for the description container style |
86+
| imageStyle | ImageStyle | default | set or override the style object for the image style |
87+
| ImageComponent | Image | default | set your own component instead of default react-native Image component |
8588

8689
## Future Plans
8790

lib/EmptyState.tsx

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
import * as React from "react";
2-
import { Text, Image, View, ViewStyle, TextStyle } from "react-native";
2+
import {
3+
Text,
4+
Image,
5+
View,
6+
ViewStyle,
7+
TextStyle,
8+
ImageStyle,
9+
} from "react-native";
310
import RNBounceable from "@freakycoder/react-native-bounceable";
411
/**
512
* ? Local Imports
@@ -18,9 +25,12 @@ export interface IEmptyStateProps {
1825
ImageComponent?: any;
1926
style?: ViewStyle;
2027
buttonStyle?: ViewStyle;
28+
imageStyle?: ImageStyle;
2129
titleTextStyle?: TextStyle;
2230
buttonTextStyle?: TextStyle;
31+
containerGlueStyle?: ViewStyle;
2332
descriptionTextStyle?: TextStyle;
33+
descriptionContainerStyle?: ViewStyle;
2434
imageSource: ISource;
2535
onPress?: () => void;
2636
}
@@ -32,10 +42,13 @@ const EmptyState = (props: IEmptyStateProps) => {
3242
description,
3343
enableButton = false,
3444
style,
45+
imageStyle,
3546
buttonStyle,
3647
titleTextStyle,
3748
buttonTextStyle,
49+
containerGlueStyle,
3850
descriptionTextStyle,
51+
descriptionContainerStyle,
3952
ImageComponent = Image,
4053
imageSource,
4154
onPress,
@@ -45,11 +58,11 @@ const EmptyState = (props: IEmptyStateProps) => {
4558
<ImageComponent
4659
resizeMode="contain"
4760
source={imageSource}
48-
style={styles.imageStyle}
61+
style={[styles.imageStyle, imageStyle]}
4962
/>
50-
<View style={styles.containerGlue}>
63+
<View style={[styles.containerGlue, containerGlueStyle]}>
5164
<Text style={[styles.titleTextStyle, titleTextStyle]}>{title}</Text>
52-
<View style={styles.descriptionContainer}>
65+
<View style={[styles.descriptionContainer, descriptionContainerStyle]}>
5366
<Text style={[styles.descriptionTextStyle, descriptionTextStyle]}>
5467
{description}
5568
</Text>

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@freakycoder/react-native-empty-state",
3-
"version": "0.1.1",
3+
"version": "0.1.2",
44
"description": "Empty State library which is fully customizable and simple for any state view use-cases",
55
"main": "./build/dist/EmptyState.js",
66
"repository": "git@github.com:WrathChaos/react-native-empty-state.git",

0 commit comments

Comments
 (0)