Skip to content

Commit 62b8607

Browse files
committed
FEATURE: dyamic pheights
1 parent e58e16a commit 62b8607

File tree

4 files changed

+14
-3
lines changed

4 files changed

+14
-3
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
"react-native": "*"
4242
},
4343
"dependencies": {
44+
"@sarmad1995/react-native-content-loader": "^0.2.4",
4445
"hex-to-rgba": "^2.0.1"
4546
}
4647
}

src/ContentLoader.tsx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,8 @@ import {
1616
/**
1717
* default content loader .
1818
*
19-
* can be customized to the needs, .
2019
*
20+
* can be customized to the needs, .
2121
*/
2222
interface ContentLoaderAvatar {
2323
default: string | number,

src/shared.tsx

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import { Animated, ViewStyle } from 'react-native';
44
export type WidthArrayType = number | string;
55
export type AShapeType = 'circle'|'square';
66
export type ASizeType = string | number | 'small' | 'large' | 'default';
7-
export type PHeightType = string | number;
7+
export type PHeightType = string | number | Array<string|number>;
88
export type PWidthType = string | number | Array<WidthArrayType>;
99
export type TWidthType = string | number;
1010
export type THeightType = string | number;
@@ -35,11 +35,14 @@ export const getInterpolatedColor = (animation: Animated.Value, primaryColor: Co
3535
});
3636

3737
export const paragraphInitialStyles = (index: number, pHeight: PHeightType, pWidth: PWidthType) => {
38-
const height = pHeight;
38+
let height = pHeight;
3939
let width = pWidth;
4040
if ( pWidth.constructor === Array) {
4141
width = pWidth[index] || '100%';
4242
}
43+
if (pHeight.constructor === Array) {
44+
height = pHeight[index] || 8
45+
}
4346
return {
4447
height,
4548
width

yarn.lock

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,13 @@
1818
esutils "^2.0.2"
1919
js-tokens "^4.0.0"
2020

21+
"@sarmad1995/react-native-content-loader@^0.2.4":
22+
version "0.2.4"
23+
resolved "https://registry.yarnpkg.com/@sarmad1995/react-native-content-loader/-/react-native-content-loader-0.2.4.tgz#b24f110534045f34ecb22ef3ee3ca0e5a8baa04e"
24+
integrity sha512-GSYDYbXLC6/xW45wAffdr3AlkXyo7NqlA0M9rqnXoTkk5TFhGMRBPfA7jakpaS2WtzkaOsh67VPAtlxIXigqiw==
25+
dependencies:
26+
hex-to-rgba "^2.0.1"
27+
2128
"@types/prop-types@*":
2229
version "15.7.3"
2330
resolved "https://registry.yarnpkg.com/@types/prop-types/-/prop-types-15.7.3.tgz#2ab0d5da2e5815f94b0b9d4b95d1e5f243ab2ca7"

0 commit comments

Comments
 (0)