@prototyp/skeletor 1.0.5 → 1.0.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -96
- package/lib/module/hooks/index.js +1 -1
- package/lib/module/hooks/index.js.map +1 -1
- package/lib/module/hooks/skeleform/README.md +100 -0
- package/lib/module/hooks/skeleform/package.json +53 -0
- package/lib/module/hooks/{useForm.js → skeleform/src/index.js} +31 -16
- package/lib/module/hooks/skeleform/src/index.js.map +1 -0
- package/lib/module/hooks/skeleform/tsconfig.json +14 -0
- package/lib/module/hooks/skeleform/yarn.lock +5132 -0
- package/lib/typescript/components/Block/Block.d.ts.map +1 -0
- package/lib/typescript/components/Block/index.d.ts.map +1 -0
- package/lib/typescript/components/InputFocusScrollView/InputFocusScrollView.d.ts.map +1 -0
- package/lib/typescript/components/InputFocusScrollView/index.d.ts.map +1 -0
- package/lib/typescript/components/Screen/Screen.d.ts.map +1 -0
- package/lib/typescript/components/Screen/index.d.ts.map +1 -0
- package/lib/typescript/components/SkeletorProvider/SkeletorContext.d.ts.map +1 -0
- package/lib/typescript/components/SkeletorProvider/SkeletorProvider.d.ts.map +1 -0
- package/lib/typescript/components/SkeletorProvider/index.d.ts.map +1 -0
- package/lib/typescript/components/Text/Text.d.ts.map +1 -0
- package/lib/typescript/components/Text/index.d.ts.map +1 -0
- package/lib/typescript/components/index.d.ts.map +1 -0
- package/lib/typescript/{lib/module/hooks → hooks}/index.d.ts +1 -1
- package/lib/typescript/hooks/index.d.ts.map +1 -0
- package/lib/typescript/{src/hooks/useForm.d.ts → hooks/skeleform/src/index.d.ts} +8 -8
- package/lib/typescript/hooks/skeleform/src/index.d.ts.map +1 -0
- package/lib/typescript/hooks/useAndroidBackHandler.d.ts.map +1 -0
- package/lib/typescript/hooks/useAnimation.d.ts.map +1 -0
- package/lib/typescript/hooks/useAnimationTimeline.d.ts.map +1 -0
- package/lib/typescript/hooks/useAppState.d.ts.map +1 -0
- package/lib/typescript/hooks/useSkeletor.d.ts.map +1 -0
- package/lib/typescript/index.d.ts.map +1 -0
- package/lib/typescript/models/Alignment.d.ts.map +1 -0
- package/lib/typescript/models/Border.d.ts.map +1 -0
- package/lib/typescript/models/Size.d.ts.map +1 -0
- package/lib/typescript/models/SkeletorConfig.d.ts.map +1 -0
- package/lib/typescript/models/Spacing.d.ts.map +1 -0
- package/lib/typescript/models/index.d.ts.map +1 -0
- package/lib/typescript/utils/extractAlignmentProperties.d.ts.map +1 -0
- package/lib/typescript/utils/extractSizeProperties.d.ts.map +1 -0
- package/lib/typescript/utils/index.d.ts.map +1 -0
- package/package.json +7 -6
- package/lib/module/hooks/useForm.js.map +0 -1
- package/lib/typescript/lib/module/components/Block/Block.d.ts +0 -4
- package/lib/typescript/lib/module/components/Block/Block.d.ts.map +0 -1
- package/lib/typescript/lib/module/components/Block/index.d.ts.map +0 -1
- package/lib/typescript/lib/module/components/InputFocusScrollView/InputFocusScrollView.d.ts +0 -4
- package/lib/typescript/lib/module/components/InputFocusScrollView/InputFocusScrollView.d.ts.map +0 -1
- package/lib/typescript/lib/module/components/InputFocusScrollView/index.d.ts.map +0 -1
- package/lib/typescript/lib/module/components/Screen/Screen.d.ts +0 -5
- package/lib/typescript/lib/module/components/Screen/Screen.d.ts.map +0 -1
- package/lib/typescript/lib/module/components/Screen/index.d.ts.map +0 -1
- package/lib/typescript/lib/module/components/SkeletorProvider/SkeletorContext.d.ts +0 -14
- package/lib/typescript/lib/module/components/SkeletorProvider/SkeletorContext.d.ts.map +0 -1
- package/lib/typescript/lib/module/components/SkeletorProvider/SkeletorProvider.d.ts +0 -8
- package/lib/typescript/lib/module/components/SkeletorProvider/SkeletorProvider.d.ts.map +0 -1
- package/lib/typescript/lib/module/components/SkeletorProvider/index.d.ts.map +0 -1
- package/lib/typescript/lib/module/components/Text/Text.d.ts +0 -4
- package/lib/typescript/lib/module/components/Text/Text.d.ts.map +0 -1
- package/lib/typescript/lib/module/components/Text/index.d.ts.map +0 -1
- package/lib/typescript/lib/module/components/index.d.ts.map +0 -1
- package/lib/typescript/lib/module/hooks/index.d.ts.map +0 -1
- package/lib/typescript/lib/module/hooks/useAndroidBackHandler.d.ts +0 -2
- package/lib/typescript/lib/module/hooks/useAndroidBackHandler.d.ts.map +0 -1
- package/lib/typescript/lib/module/hooks/useAnimation.d.ts +0 -9
- package/lib/typescript/lib/module/hooks/useAnimation.d.ts.map +0 -1
- package/lib/typescript/lib/module/hooks/useAnimationTimeline.d.ts +0 -10
- package/lib/typescript/lib/module/hooks/useAnimationTimeline.d.ts.map +0 -1
- package/lib/typescript/lib/module/hooks/useAppState.d.ts +0 -2
- package/lib/typescript/lib/module/hooks/useAppState.d.ts.map +0 -1
- package/lib/typescript/lib/module/hooks/useForm.d.ts +0 -33
- package/lib/typescript/lib/module/hooks/useForm.d.ts.map +0 -1
- package/lib/typescript/lib/module/hooks/useSkeletor.d.ts +0 -7
- package/lib/typescript/lib/module/hooks/useSkeletor.d.ts.map +0 -1
- package/lib/typescript/lib/module/index.d.ts.map +0 -1
- package/lib/typescript/lib/module/models/Alignment.d.ts +0 -2
- package/lib/typescript/lib/module/models/Alignment.d.ts.map +0 -1
- package/lib/typescript/lib/module/models/Border.d.ts +0 -2
- package/lib/typescript/lib/module/models/Border.d.ts.map +0 -1
- package/lib/typescript/lib/module/models/Size.d.ts +0 -2
- package/lib/typescript/lib/module/models/Size.d.ts.map +0 -1
- package/lib/typescript/lib/module/models/SkeletorConfig.d.ts +0 -1
- package/lib/typescript/lib/module/models/SkeletorConfig.d.ts.map +0 -1
- package/lib/typescript/lib/module/models/Spacing.d.ts +0 -2
- package/lib/typescript/lib/module/models/Spacing.d.ts.map +0 -1
- package/lib/typescript/lib/module/models/index.d.ts +0 -5
- package/lib/typescript/lib/module/models/index.d.ts.map +0 -1
- package/lib/typescript/lib/module/types/Font.d.d.ts +0 -1
- package/lib/typescript/lib/module/types/Font.d.d.ts.map +0 -1
- package/lib/typescript/lib/module/utils/extractAlignmentProperties.d.ts +0 -8
- package/lib/typescript/lib/module/utils/extractAlignmentProperties.d.ts.map +0 -1
- package/lib/typescript/lib/module/utils/extractSizeProperties.d.ts +0 -10
- package/lib/typescript/lib/module/utils/extractSizeProperties.d.ts.map +0 -1
- package/lib/typescript/lib/module/utils/index.d.ts.map +0 -1
- package/lib/typescript/src/components/Block/Block.d.ts.map +0 -1
- package/lib/typescript/src/components/Block/index.d.ts +0 -2
- package/lib/typescript/src/components/Block/index.d.ts.map +0 -1
- package/lib/typescript/src/components/InputFocusScrollView/InputFocusScrollView.d.ts.map +0 -1
- package/lib/typescript/src/components/InputFocusScrollView/index.d.ts +0 -2
- package/lib/typescript/src/components/InputFocusScrollView/index.d.ts.map +0 -1
- package/lib/typescript/src/components/Screen/Screen.d.ts.map +0 -1
- package/lib/typescript/src/components/Screen/index.d.ts +0 -2
- package/lib/typescript/src/components/Screen/index.d.ts.map +0 -1
- package/lib/typescript/src/components/SkeletorProvider/SkeletorContext.d.ts.map +0 -1
- package/lib/typescript/src/components/SkeletorProvider/SkeletorProvider.d.ts.map +0 -1
- package/lib/typescript/src/components/SkeletorProvider/index.d.ts +0 -3
- package/lib/typescript/src/components/SkeletorProvider/index.d.ts.map +0 -1
- package/lib/typescript/src/components/Text/Text.d.ts.map +0 -1
- package/lib/typescript/src/components/Text/index.d.ts +0 -2
- package/lib/typescript/src/components/Text/index.d.ts.map +0 -1
- package/lib/typescript/src/components/index.d.ts +0 -6
- package/lib/typescript/src/components/index.d.ts.map +0 -1
- package/lib/typescript/src/hooks/index.d.ts +0 -7
- package/lib/typescript/src/hooks/index.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useAndroidBackHandler.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useAnimation.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useAnimationTimeline.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useAppState.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useForm.d.ts.map +0 -1
- package/lib/typescript/src/hooks/useSkeletor.d.ts.map +0 -1
- package/lib/typescript/src/index.d.ts +0 -5
- package/lib/typescript/src/index.d.ts.map +0 -1
- package/lib/typescript/src/models/Alignment.d.ts.map +0 -1
- package/lib/typescript/src/models/Border.d.ts.map +0 -1
- package/lib/typescript/src/models/Size.d.ts.map +0 -1
- package/lib/typescript/src/models/SkeletorConfig.d.ts.map +0 -1
- package/lib/typescript/src/models/Spacing.d.ts.map +0 -1
- package/lib/typescript/src/models/index.d.ts.map +0 -1
- package/lib/typescript/src/utils/extractAlignmentProperties.d.ts.map +0 -1
- package/lib/typescript/src/utils/extractSizeProperties.d.ts.map +0 -1
- package/lib/typescript/src/utils/index.d.ts +0 -3
- package/lib/typescript/src/utils/index.d.ts.map +0 -1
- package/src/components/Block/Block.tsx +0 -106
- package/src/components/Block/index.ts +0 -1
- package/src/components/InputFocusScrollView/InputFocusScrollView.tsx +0 -113
- package/src/components/InputFocusScrollView/index.ts +0 -1
- package/src/components/Screen/Screen.tsx +0 -91
- package/src/components/Screen/index.ts +0 -1
- package/src/components/SkeletorProvider/SkeletorContext.ts +0 -12
- package/src/components/SkeletorProvider/SkeletorProvider.tsx +0 -18
- package/src/components/SkeletorProvider/index.ts +0 -2
- package/src/components/Text/Text.tsx +0 -99
- package/src/components/Text/index.ts +0 -1
- package/src/components/index.ts +0 -5
- package/src/hooks/index.ts +0 -6
- package/src/hooks/useAndroidBackHandler.ts +0 -45
- package/src/hooks/useAnimation.ts +0 -62
- package/src/hooks/useAnimationTimeline.ts +0 -139
- package/src/hooks/useAppState.ts +0 -26
- package/src/hooks/useForm.ts +0 -190
- package/src/hooks/useSkeletor.ts +0 -7
- package/src/index.ts +0 -4
- package/src/models/Alignment.ts +0 -9
- package/src/models/Border.ts +0 -17
- package/src/models/Size.ts +0 -11
- package/src/models/SkeletorConfig.ts +0 -6
- package/src/models/Spacing.ts +0 -22
- package/src/models/index.ts +0 -5
- package/src/types/Font.d.ts +0 -1
- package/src/utils/extractAlignmentProperties.ts +0 -13
- package/src/utils/extractSizeProperties.ts +0 -13
- package/src/utils/index.ts +0 -2
- /package/lib/typescript/{src/components → components}/Block/Block.d.ts +0 -0
- /package/lib/typescript/{lib/module/components → components}/Block/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/InputFocusScrollView/InputFocusScrollView.d.ts +0 -0
- /package/lib/typescript/{lib/module/components → components}/InputFocusScrollView/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Screen/Screen.d.ts +0 -0
- /package/lib/typescript/{lib/module/components → components}/Screen/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/SkeletorProvider/SkeletorContext.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/SkeletorProvider/SkeletorProvider.d.ts +0 -0
- /package/lib/typescript/{lib/module/components → components}/SkeletorProvider/index.d.ts +0 -0
- /package/lib/typescript/{src/components → components}/Text/Text.d.ts +0 -0
- /package/lib/typescript/{lib/module/components → components}/Text/index.d.ts +0 -0
- /package/lib/typescript/{lib/module/components → components}/index.d.ts +0 -0
- /package/lib/typescript/{src/hooks → hooks}/useAndroidBackHandler.d.ts +0 -0
- /package/lib/typescript/{src/hooks → hooks}/useAnimation.d.ts +0 -0
- /package/lib/typescript/{src/hooks → hooks}/useAnimationTimeline.d.ts +0 -0
- /package/lib/typescript/{src/hooks → hooks}/useAppState.d.ts +0 -0
- /package/lib/typescript/{src/hooks → hooks}/useSkeletor.d.ts +0 -0
- /package/lib/typescript/{lib/module/index.d.ts → index.d.ts} +0 -0
- /package/lib/typescript/{src/models → models}/Alignment.d.ts +0 -0
- /package/lib/typescript/{src/models → models}/Border.d.ts +0 -0
- /package/lib/typescript/{src/models → models}/Size.d.ts +0 -0
- /package/lib/typescript/{src/models → models}/SkeletorConfig.d.ts +0 -0
- /package/lib/typescript/{src/models → models}/Spacing.d.ts +0 -0
- /package/lib/typescript/{src/models → models}/index.d.ts +0 -0
- /package/lib/typescript/{src/utils → utils}/extractAlignmentProperties.d.ts +0 -0
- /package/lib/typescript/{src/utils → utils}/extractSizeProperties.d.ts +0 -0
- /package/lib/typescript/{lib/module/utils → utils}/index.d.ts +0 -0
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/components/index.ts"],"names":[],"mappings":"AAAA,cAAc,QAAQ,CAAC;AACvB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,oBAAoB,CAAC;AACnC,cAAc,wBAAwB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/hooks/index.ts"],"names":[],"mappings":"AAAA,cAAc,WAAW,CAAC;AAC1B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,wBAAwB,CAAC;AACvC,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,yBAAyB,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAndroidBackHandler.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAndroidBackHandler.ts"],"names":[],"mappings":"AAGA,UAAU,YAAY;IACpB,yDAAyD;IACzD,OAAO,EAAE,OAAO,CAAC;CAClB;AACD,UAAU,YAAa,SAAQ,YAAY;IACzC,wFAAwF;IACxF,WAAW,EAAE,MAAM,IAAI,CAAC;CACzB;AAED,UAAU,WAAY,SAAQ,YAAY;IACxC,8EAA8E;IAC9E,cAAc,EAAE,OAAO,CAAC;CACzB;AAED,oBAAY,wBAAwB,GAAG,YAAY,GAAG,WAAW,CAAC;AAQlE,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,wBAAwB,QAmBpE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAnimation.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAnimation.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEnD,mDAAmD;AACnD,aAAK,SAAS,CAAC,IAAI,SAAS,MAAM,OAAO,CAAC,SAAS,CAAC,IAAI,MAAM,CAC5D,IAAI,EACJ,QAAQ,CAAC,qBAAqB,CAAC,MAAM,GAAG,MAAM,CAAC,GAAG,GAAG,CACtD,CAAC;AACF,aAAK,UAAU,CAAC,IAAI,SAAS,MAAM,OAAO,CAAC,SAAS,CAAC,IAAI,MAAM,CAC7D,IAAI,EACJ,MAAM,EAAE,GAAG,MAAM,EAAE,CACpB,CAAC;AAEF,UAAU,aAAa;IACrB,qBAAqB;IACrB,QAAQ,EAAE,MAAM,CAAC;IACjB,yHAAyH;IACzH,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,eAAe,CAAC,EAAE,OAAO,CAAC;CAC3B;AAED,MAAM,WAAW,YAAY,CAAC,IAAI,SAAS,MAAM,OAAO,CAAC,SAAS,CAAC;IACjE,MAAM,EAAE,QAAQ,CAAC,KAAK,EAAE,CAAC;IACzB,WAAW,EAAE,UAAU,CAAC,IAAI,CAAC,CAAC;IAC9B,UAAU,EAAE,SAAS,CAAC,IAAI,CAAC,CAAC;IAC5B,aAAa,EAAE,aAAa,CAAC;CAC9B;AAED,wBAAgB,YAAY,CAAC,IAAI,SAAS,MAAM,OAAO,CAAC,SAAS,CAAC,EAChE,MAAM,EAAE,UAAU,CAAC,IAAI,CAAC,EACxB,aAAa,CAAC,EAAE,aAAa,GAC5B,YAAY,CAAC,IAAI,CAAC,CA8BpB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAnimationTimeline.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAnimationTimeline.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,MAAM,gBAAgB,CAAC;AAE9C,UAAU,gBAAgB;IACxB,QAAQ,EAAE,YAAY,CAAC,GAAG,CAAC,EAAE,CAAC;IAC9B,KAAK,EAAE,OAAO,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,IAAI,CAAC;IACxB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;CACxB;AAED,aAAK,aAAa,GAAG,gBAAgB,GAAG;IACtC,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AACF,aAAK,eAAe,GAAG,gBAAgB,GAAG;IACxC,OAAO,EAAE,MAAM,CAAC;CACjB,CAAC;AAEF,UAAU,qBAAqB;IAC7B,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,QAAQ,CAAC,EAAE,gBAAgB,CAAC;IAC5B,OAAO,CAAC,EAAE,eAAe,CAAC;CAC3B;AAED;;;;;;;EAOE;AACF,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,qBAAqB,GAAG,IAAI,CAyGxE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useAppState.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useAppState.ts"],"names":[],"mappings":"AAGA,UAAU,MAAM;IACd,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;IAC1B,YAAY,CAAC,EAAE,MAAM,IAAI,CAAC;CAC3B;AAED,wBAAgB,WAAW,CAAC,EAAE,YAAY,EAAE,YAAY,EAAE,EAAE,MAAM,QAiBjE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useForm.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useForm.ts"],"names":[],"mappings":"AAEA,aAAK,UAAU,CAAC,CAAC,IAAI;KAAG,CAAC,IAAI,MAAM,OAAO,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO;CAAE,CAAC;AAC3D,aAAK,KAAK,CAAC,CAAC,IAAI;KACb,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,EAAE,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,CAAC,EAAE,KAAK,EAAE,CAAC,KAAK,OAAO,GAAG,SAAS;CAChE,CAAC;AAEF,aAAK,MAAM,CAAC,CAAC,IAAI;KACd,CAAC,IAAI,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC;CACrB,CAAC;AAEF,oBAAY,UAAU,CAAC,CAAC,IAAI;IAC1B,8FAA8F;IAC9F,QAAQ,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC,CAAC;IAC1B,uNAAuN;IACvN,KAAK,CAAC,EAAE,KAAK,CAAC,CAAC,CAAC,CAAC;IACjB,sGAAsG;IACtG,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB,CAAC;AAEF;;;;;;;;GAQG;AACH,wBAAgB,OAAO,CAAC,CAAC,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;;;8EA2B/C,OAAO;;wBAmBD,OAAO;;;;;;EAgDjC;AAED,0EAA0E;AAC1E,wBAAgB,YAAY,CAAC,CAAC,EAAE,MAAM,CAAC,EAAE,UAAU,CAAC,CAAC,CAAC;4BACrB,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS;oEAU5C,OAAO,CAAC,CAAC;sBAUO,MAAM,CAAC;2BAKzB,MAAM,CAAC,SACL,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,SAAS,SACtB,OAAO,CAAC,CAAC;6BAWc,OAAO,CAAC,CAAC;;;;EAuB1C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"useSkeletor.d.ts","sourceRoot":"","sources":["../../../../src/hooks/useSkeletor.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAG3C,wBAAgB,WAAW,IAAI,cAAc,CAE5C"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,cAAc,CAAC;AAC7B,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Alignment.d.ts","sourceRoot":"","sources":["../../../../src/models/Alignment.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAEzC,MAAM,WAAW,SAAS;IACxB,KAAK,CAAC,EAAE,SAAS,CAAC,YAAY,CAAC,CAAC;IAChC,SAAS,CAAC,EAAE,SAAS,CAAC,WAAW,CAAC,CAAC;IACnC,OAAO,CAAC,EAAE,SAAS,CAAC,gBAAgB,CAAC,CAAC;IACtC,aAAa,CAAC,EAAE,SAAS,CAAC,eAAe,CAAC,CAAC;IAC3C,QAAQ,CAAC,EAAE,SAAS,CAAC,UAAU,CAAC,CAAC;CAClC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Border.d.ts","sourceRoot":"","sources":["../../../../src/models/Border.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAE5D,MAAM,WAAW,MAAM;IACrB,MAAM,CAAC,EAAE;QACP,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,cAAc,CAAC,EAAE,MAAM,CAAC;QACxB,iBAAiB,CAAC,EAAE,MAAM,CAAC;QAC3B,eAAe,CAAC,EAAE,MAAM,CAAC;QACzB,gBAAgB,CAAC,EAAE,MAAM,CAAC;QAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;QACrB,YAAY,CAAC,EAAE,sBAAsB,CAAC;QACtC,mBAAmB,CAAC,EAAE,sBAAsB,CAAC;QAC7C,oBAAoB,CAAC,EAAE,sBAAsB,CAAC;QAC9C,sBAAsB,CAAC,EAAE,sBAAsB,CAAC;QAChD,uBAAuB,CAAC,EAAE,sBAAsB,CAAC;KAClD,CAAC;CACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Size.d.ts","sourceRoot":"","sources":["../../../../src/models/Size.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,WAAW,IAAI;IACnB,KAAK,CAAC,EAAE,cAAc,CAAC;IACvB,MAAM,CAAC,EAAE,cAAc,CAAC;IACxB,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,SAAS,CAAC,EAAE,cAAc,CAAC;IAC3B,QAAQ,CAAC,EAAE,cAAc,CAAC;IAC1B,IAAI,CAAC,EAAE,MAAM,CAAC;CACf"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"SkeletorConfig.d.ts","sourceRoot":"","sources":["../../../../src/models/SkeletorConfig.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,cAAc;IAC7B,WAAW,EAAE,IAAI,GAAG,SAAS,CAAC;IAC9B,eAAe,EAAE,CAAC,MAAM,EAAE,MAAM,CAAC,GAAG,MAAM,CAAC;IAC3C,oBAAoB,EAAE,cAAc,GAAG,eAAe,GAAG,SAAS,CAAC;IACnE,gBAAgB,EAAE,MAAM,CAAC;CAC1B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Spacing.d.ts","sourceRoot":"","sources":["../../../../src/models/Spacing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAC;AAEpD,MAAM,WAAW,OAAO;IACtB,OAAO,CAAC,EAAE;QACR,SAAS,CAAC,EAAE,cAAc,CAAC;QAC3B,YAAY,CAAC,EAAE,cAAc,CAAC;QAC9B,UAAU,CAAC,EAAE,cAAc,CAAC;QAC5B,WAAW,CAAC,EAAE,cAAc,CAAC;QAC7B,gBAAgB,CAAC,EAAE,cAAc,CAAC;QAClC,cAAc,CAAC,EAAE,cAAc,CAAC;QAChC,MAAM,CAAC,EAAE,cAAc,CAAC;KACzB,CAAC;IACF,QAAQ,CAAC,EAAE;QACT,UAAU,CAAC,EAAE,cAAc,CAAC;QAC5B,aAAa,CAAC,EAAE,cAAc,CAAC;QAC/B,WAAW,CAAC,EAAE,cAAc,CAAC;QAC7B,YAAY,CAAC,EAAE,cAAc,CAAC;QAC9B,iBAAiB,CAAC,EAAE,cAAc,CAAC;QACnC,eAAe,CAAC,EAAE,cAAc,CAAC;QACjC,OAAO,CAAC,EAAE,cAAc,CAAC;KAC1B,CAAC;CACH"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/models/index.ts"],"names":[],"mappings":"AAAA,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,kBAAkB,CAAC;AACjC,cAAc,WAAW,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractAlignmentProperties.d.ts","sourceRoot":"","sources":["../../../../src/utils/extractAlignmentProperties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,wBAAgB,0BAA0B,CAAC,KAAK,SAAS,SAAS,EAChE,KAAK,EAAE,KAAK,GACX,SAAS,CAQX"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"extractSizeProperties.d.ts","sourceRoot":"","sources":["../../../../src/utils/extractSizeProperties.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,wBAAgB,qBAAqB,CAAC,KAAK,SAAS,IAAI,EAAE,KAAK,EAAE,KAAK,GAAG,IAAI,CAU5E"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/utils/index.ts"],"names":[],"mappings":"AAAA,cAAc,8BAA8B,CAAC;AAC7C,cAAc,yBAAyB,CAAC"}
|
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import React, { PropsWithChildren, useMemo } from "react";
|
|
2
|
-
import {
|
|
3
|
-
ScrollView,
|
|
4
|
-
StyleProp,
|
|
5
|
-
StyleSheet,
|
|
6
|
-
View,
|
|
7
|
-
ViewProps,
|
|
8
|
-
ViewStyle,
|
|
9
|
-
} from "react-native";
|
|
10
|
-
import { Alignment, Border, Size, Spacing } from "../../models";
|
|
11
|
-
import { extractAlignmentProperties, extractSizeProperties } from "../../utils";
|
|
12
|
-
|
|
13
|
-
interface SharedProps extends ViewProps {
|
|
14
|
-
background?: string;
|
|
15
|
-
overflow?: ViewStyle["overflow"];
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
interface BlockScrollViewProps extends SharedProps {
|
|
19
|
-
scrollable: true;
|
|
20
|
-
horizontal?: boolean;
|
|
21
|
-
showsVerticalScrollIndicator?: boolean;
|
|
22
|
-
showsHorizontalScrollIndicator?: boolean;
|
|
23
|
-
bounces?: boolean;
|
|
24
|
-
style?: StyleProp<ViewStyle>;
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
export interface BlockViewProps extends SharedProps {
|
|
28
|
-
scrollable?: false | undefined;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
type BlockElementProps = SharedProps & Alignment & Spacing & Size & Border;
|
|
32
|
-
|
|
33
|
-
const BlockElement: React.FC<PropsWithChildren<BlockElementProps>> = ({
|
|
34
|
-
children,
|
|
35
|
-
...props
|
|
36
|
-
}) => {
|
|
37
|
-
const { border, paddings, margins, background, style, overflow, ...view } =
|
|
38
|
-
props;
|
|
39
|
-
|
|
40
|
-
const size = extractSizeProperties(props);
|
|
41
|
-
const {
|
|
42
|
-
align: alignItems,
|
|
43
|
-
justify: justifyContent,
|
|
44
|
-
...alignment
|
|
45
|
-
} = extractAlignmentProperties(props);
|
|
46
|
-
|
|
47
|
-
const styles = useMemo(
|
|
48
|
-
() =>
|
|
49
|
-
StyleSheet.flatten([
|
|
50
|
-
{
|
|
51
|
-
...margins,
|
|
52
|
-
...paddings,
|
|
53
|
-
...alignment,
|
|
54
|
-
...size,
|
|
55
|
-
...border,
|
|
56
|
-
alignItems,
|
|
57
|
-
justifyContent,
|
|
58
|
-
backgroundColor: background,
|
|
59
|
-
overflow,
|
|
60
|
-
},
|
|
61
|
-
style,
|
|
62
|
-
]),
|
|
63
|
-
[alignment, size, background, style, overflow, margins, paddings]
|
|
64
|
-
);
|
|
65
|
-
|
|
66
|
-
return (
|
|
67
|
-
<View {...view} style={styles}>
|
|
68
|
-
{children}
|
|
69
|
-
</View>
|
|
70
|
-
);
|
|
71
|
-
};
|
|
72
|
-
|
|
73
|
-
type BaseProps = Alignment & Spacing & Size & Border;
|
|
74
|
-
export type BlockProps = (BlockViewProps | BlockScrollViewProps) & BaseProps;
|
|
75
|
-
|
|
76
|
-
export const Block: React.FC<PropsWithChildren<BlockProps>> = ({
|
|
77
|
-
children,
|
|
78
|
-
...props
|
|
79
|
-
}) => {
|
|
80
|
-
const { scrollable, ...rest } = props;
|
|
81
|
-
const element = () => <BlockElement {...rest}>{children}</BlockElement>;
|
|
82
|
-
|
|
83
|
-
if (!scrollable) {
|
|
84
|
-
return element();
|
|
85
|
-
}
|
|
86
|
-
|
|
87
|
-
const {
|
|
88
|
-
horizontal,
|
|
89
|
-
showsHorizontalScrollIndicator,
|
|
90
|
-
showsVerticalScrollIndicator,
|
|
91
|
-
bounces,
|
|
92
|
-
} = props;
|
|
93
|
-
|
|
94
|
-
return (
|
|
95
|
-
<ScrollView
|
|
96
|
-
horizontal={horizontal}
|
|
97
|
-
keyboardShouldPersistTaps="handled"
|
|
98
|
-
showsHorizontalScrollIndicator={showsHorizontalScrollIndicator}
|
|
99
|
-
showsVerticalScrollIndicator={showsVerticalScrollIndicator}
|
|
100
|
-
contentContainerStyle={{ flexGrow: 1, backgroundColor: rest.background }}
|
|
101
|
-
bounces={bounces}
|
|
102
|
-
>
|
|
103
|
-
{element()}
|
|
104
|
-
</ScrollView>
|
|
105
|
-
);
|
|
106
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Block";
|
|
@@ -1,113 +0,0 @@
|
|
|
1
|
-
import React, { useRef, useState } from "react";
|
|
2
|
-
import {
|
|
3
|
-
Platform,
|
|
4
|
-
LayoutChangeEvent,
|
|
5
|
-
NativeSyntheticEvent,
|
|
6
|
-
ScrollView,
|
|
7
|
-
ScrollViewProps,
|
|
8
|
-
StyleSheet,
|
|
9
|
-
TextInputFocusEventData,
|
|
10
|
-
Dimensions,
|
|
11
|
-
UIManager,
|
|
12
|
-
findNodeHandle,
|
|
13
|
-
TextInput,
|
|
14
|
-
} from "react-native";
|
|
15
|
-
import { Spacing } from "../../models";
|
|
16
|
-
|
|
17
|
-
export interface InputFocusScrollViewProps
|
|
18
|
-
extends Omit<ScrollViewProps, "children">,
|
|
19
|
-
Spacing {
|
|
20
|
-
/** Percentage of screen to add to element position. Values between 0 and 1. Use this if you want to position the input focus somewhere other than the top of the screen. Defaults to 0.3 */
|
|
21
|
-
focusPositionOffset?: number;
|
|
22
|
-
height?: "full" | "auto";
|
|
23
|
-
children: (
|
|
24
|
-
onInputFocus: (e: NativeSyntheticEvent<TextInputFocusEventData>) => void
|
|
25
|
-
) => React.ReactNode;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
/**
|
|
29
|
-
* This scroll view will automatically scroll to an active input field rendered within it, provided you attach the onInputFocus callback to the input onFocus prop.
|
|
30
|
-
*
|
|
31
|
-
* The return value is a lambda component, returning a callback which you attach to input fields rendered within it.
|
|
32
|
-
* @example <InputFocusScrollView>{(onInputFocus) => <TextInput onFocus={onInputFocus} ... />}</InputFocusScrollView>
|
|
33
|
-
* NOTE: This works on iOS only, Android does this by default with @param android:windowSoftInputMode
|
|
34
|
-
*/
|
|
35
|
-
export const InputFocusScrollView: React.FC<InputFocusScrollViewProps> = ({
|
|
36
|
-
children,
|
|
37
|
-
style,
|
|
38
|
-
contentContainerStyle,
|
|
39
|
-
height = "full",
|
|
40
|
-
focusPositionOffset = 0.3,
|
|
41
|
-
margins,
|
|
42
|
-
paddings,
|
|
43
|
-
...rest
|
|
44
|
-
}) => {
|
|
45
|
-
const screenHeight = useRef(Dimensions.get("screen").height).current;
|
|
46
|
-
const ref = useRef<ScrollView>(null);
|
|
47
|
-
/** Cached scroll position to keep focus on input if layout shifts. */
|
|
48
|
-
const [scrollPosition, setScrollPosition] = useState<number | null>(null);
|
|
49
|
-
const [scrollTarget, setScrollTarget] = useState<number | null>(null);
|
|
50
|
-
|
|
51
|
-
function onInputFocus(e: NativeSyntheticEvent<TextInputFocusEventData>) {
|
|
52
|
-
if (Platform.OS !== "ios" || !scrollTarget) return;
|
|
53
|
-
|
|
54
|
-
(e.currentTarget as unknown as TextInput).measureLayout(
|
|
55
|
-
scrollTarget,
|
|
56
|
-
(nope, top, nuuh, elementHeight) => {
|
|
57
|
-
let scrollY = top - elementHeight;
|
|
58
|
-
if (focusPositionOffset !== undefined) {
|
|
59
|
-
scrollY = scrollY - screenHeight * focusPositionOffset;
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
// Cache scroll position for layout shift cases
|
|
63
|
-
setScrollPosition(scrollY);
|
|
64
|
-
// Scroll to input position
|
|
65
|
-
ref.current?.scrollTo({ y: scrollY });
|
|
66
|
-
},
|
|
67
|
-
() => console.error("failed to measure layout")
|
|
68
|
-
);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/** Handle layout shifts by programmatically scrolling to the same input position without animation. */
|
|
72
|
-
function onContentSizeChange() {
|
|
73
|
-
if (Platform.OS !== "ios" || !scrollPosition) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
ref.current?.scrollTo({ y: scrollPosition, animated: false });
|
|
77
|
-
setScrollPosition(null);
|
|
78
|
-
}
|
|
79
|
-
|
|
80
|
-
const containerStyles = StyleSheet.flatten([styles[height], margins, style]);
|
|
81
|
-
|
|
82
|
-
const contentStyles = StyleSheet.flatten([
|
|
83
|
-
styles.content,
|
|
84
|
-
{ ...paddings },
|
|
85
|
-
contentContainerStyle,
|
|
86
|
-
]);
|
|
87
|
-
|
|
88
|
-
return (
|
|
89
|
-
<ScrollView
|
|
90
|
-
ref={ref}
|
|
91
|
-
scrollToOverflowEnabled
|
|
92
|
-
scrollEventThrottle={16}
|
|
93
|
-
onLayout={(e) => setScrollTarget(e.currentTarget)}
|
|
94
|
-
onContentSizeChange={onContentSizeChange}
|
|
95
|
-
showsVerticalScrollIndicator={false}
|
|
96
|
-
showsHorizontalScrollIndicator={false}
|
|
97
|
-
style={containerStyles}
|
|
98
|
-
contentContainerStyle={contentStyles}
|
|
99
|
-
{...rest}
|
|
100
|
-
>
|
|
101
|
-
{children(onInputFocus)}
|
|
102
|
-
</ScrollView>
|
|
103
|
-
);
|
|
104
|
-
};
|
|
105
|
-
|
|
106
|
-
const styles = StyleSheet.create({
|
|
107
|
-
full: { height: "100%" },
|
|
108
|
-
auto: { height: "auto" },
|
|
109
|
-
content: {
|
|
110
|
-
flexGrow: 1,
|
|
111
|
-
paddingBottom: 30,
|
|
112
|
-
},
|
|
113
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./InputFocusScrollView";
|
|
@@ -1,91 +0,0 @@
|
|
|
1
|
-
import React, { PropsWithChildren } from "react";
|
|
2
|
-
import {
|
|
3
|
-
SafeAreaView,
|
|
4
|
-
View,
|
|
5
|
-
ViewProps,
|
|
6
|
-
StyleSheet,
|
|
7
|
-
StatusBar,
|
|
8
|
-
Platform,
|
|
9
|
-
Dimensions,
|
|
10
|
-
} from "react-native";
|
|
11
|
-
import { useSkeletor } from "../../hooks";
|
|
12
|
-
import { Block } from "../Block";
|
|
13
|
-
|
|
14
|
-
type OwnProps = {
|
|
15
|
-
/** Pass a specific background view OR just a background color value. Custom components should be 100% height and width. */
|
|
16
|
-
background?: JSX.Element | string;
|
|
17
|
-
hideTopSafeArea?: boolean;
|
|
18
|
-
hideBottomSafeArea?: boolean;
|
|
19
|
-
bottomSafeAreaColor?: string;
|
|
20
|
-
topSafeAreaColor?: string;
|
|
21
|
-
statusBarType?: "default" | "light-content" | "dark-content";
|
|
22
|
-
isLandscape?: boolean;
|
|
23
|
-
};
|
|
24
|
-
|
|
25
|
-
export type ScreenProps = OwnProps & ViewProps;
|
|
26
|
-
|
|
27
|
-
export const Screen: React.FC<PropsWithChildren<ScreenProps>> = ({
|
|
28
|
-
background,
|
|
29
|
-
children,
|
|
30
|
-
hideBottomSafeArea,
|
|
31
|
-
hideTopSafeArea,
|
|
32
|
-
bottomSafeAreaColor,
|
|
33
|
-
topSafeAreaColor,
|
|
34
|
-
style,
|
|
35
|
-
statusBarType,
|
|
36
|
-
isLandscape,
|
|
37
|
-
...rest
|
|
38
|
-
}) => {
|
|
39
|
-
const { defaultStatusBarType } = useSkeletor();
|
|
40
|
-
|
|
41
|
-
return (
|
|
42
|
-
<>
|
|
43
|
-
{background &&
|
|
44
|
-
(typeof background === "string" ? (
|
|
45
|
-
<View style={[styles.container, { backgroundColor: background }]} />
|
|
46
|
-
) : (
|
|
47
|
-
<View style={styles.container}>{background}</View>
|
|
48
|
-
))}
|
|
49
|
-
|
|
50
|
-
{!hideTopSafeArea && (
|
|
51
|
-
<SafeAreaView style={{ backgroundColor: topSafeAreaColor }} />
|
|
52
|
-
)}
|
|
53
|
-
|
|
54
|
-
<StatusBar
|
|
55
|
-
translucent
|
|
56
|
-
backgroundColor="transparent"
|
|
57
|
-
barStyle={statusBarType || defaultStatusBarType}
|
|
58
|
-
/>
|
|
59
|
-
|
|
60
|
-
<Block
|
|
61
|
-
paddings={{
|
|
62
|
-
paddingTop:
|
|
63
|
-
Platform.OS === "android" && !isLandscape
|
|
64
|
-
? StatusBar.currentHeight || 24
|
|
65
|
-
: 0,
|
|
66
|
-
}}
|
|
67
|
-
flex={1}
|
|
68
|
-
style={style}
|
|
69
|
-
{...rest}
|
|
70
|
-
>
|
|
71
|
-
{children}
|
|
72
|
-
</Block>
|
|
73
|
-
|
|
74
|
-
{!hideBottomSafeArea && (
|
|
75
|
-
<SafeAreaView
|
|
76
|
-
style={{
|
|
77
|
-
backgroundColor: bottomSafeAreaColor,
|
|
78
|
-
}}
|
|
79
|
-
/>
|
|
80
|
-
)}
|
|
81
|
-
</>
|
|
82
|
-
);
|
|
83
|
-
};
|
|
84
|
-
|
|
85
|
-
const styles = StyleSheet.create({
|
|
86
|
-
container: {
|
|
87
|
-
position: "absolute",
|
|
88
|
-
height: Dimensions.get("screen").height,
|
|
89
|
-
width: Dimensions.get("screen").width,
|
|
90
|
-
},
|
|
91
|
-
});
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Screen";
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import React from "react";
|
|
2
|
-
import { SkeletorConfig } from "../../models";
|
|
3
|
-
|
|
4
|
-
export const SkeletorDefaults: SkeletorConfig = {
|
|
5
|
-
defaultFont: undefined,
|
|
6
|
-
defaultFontSize: [12, 16],
|
|
7
|
-
defaultStatusBarType: "dark-content",
|
|
8
|
-
defaultTextColor: "black",
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export const SkeletorContext =
|
|
12
|
-
React.createContext<SkeletorConfig>(SkeletorDefaults);
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import React, { PropsWithChildren } from "react";
|
|
2
|
-
import { SkeletorConfig } from "../../models";
|
|
3
|
-
import { SkeletorContext, SkeletorDefaults } from "./SkeletorContext";
|
|
4
|
-
|
|
5
|
-
type Props = Partial<SkeletorConfig>;
|
|
6
|
-
|
|
7
|
-
/** Create a Font.d.ts type in your typescript types directory and define fonts as follows:
|
|
8
|
-
* @example type Font = "Helvetica" | "Montserrat" ... */
|
|
9
|
-
export const SkeletorProvider: React.FC<PropsWithChildren<Props>> = ({
|
|
10
|
-
children,
|
|
11
|
-
...config
|
|
12
|
-
}) => {
|
|
13
|
-
return (
|
|
14
|
-
<SkeletorContext.Provider value={{ ...SkeletorDefaults, ...config }}>
|
|
15
|
-
{children}
|
|
16
|
-
</SkeletorContext.Provider>
|
|
17
|
-
);
|
|
18
|
-
};
|
|
@@ -1,99 +0,0 @@
|
|
|
1
|
-
import React, { PropsWithChildren, useMemo } from "react";
|
|
2
|
-
import {
|
|
3
|
-
StyleSheet,
|
|
4
|
-
Text as RNText,
|
|
5
|
-
TextProps as RNTextProps,
|
|
6
|
-
TextStyle,
|
|
7
|
-
} from "react-native";
|
|
8
|
-
import { Size, Spacing } from "../../models";
|
|
9
|
-
import { extractSizeProperties } from "../../utils";
|
|
10
|
-
import { useSkeletor } from "../../hooks";
|
|
11
|
-
|
|
12
|
-
interface OwnProps extends RNTextProps {
|
|
13
|
-
/** Create a Font.d.ts type in your typescript types directory and define fonts as follows:
|
|
14
|
-
* @example type Font = "Helvetica" | "Montserrat" ... */
|
|
15
|
-
font?: Font;
|
|
16
|
-
/** Either define [fontSize, lineHeight] or just one size applied to both fontSize and lineHeight */
|
|
17
|
-
size?: [number, number] | number;
|
|
18
|
-
textTransform?: TextStyle["textTransform"];
|
|
19
|
-
letterSpacing?: TextStyle["letterSpacing"];
|
|
20
|
-
color?: string;
|
|
21
|
-
textAlign?: TextStyle["textAlign"];
|
|
22
|
-
opacity?: TextStyle["opacity"];
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
export type TextProps = OwnProps & Spacing & Size;
|
|
26
|
-
|
|
27
|
-
/** Create a Font.d.ts type in your typescript types directory and define fonts as follows:
|
|
28
|
-
* @example type Font = "Helvetica" | "Montserrat" ... */
|
|
29
|
-
export const Text: React.FC<PropsWithChildren<TextProps>> = ({
|
|
30
|
-
font,
|
|
31
|
-
size,
|
|
32
|
-
textTransform,
|
|
33
|
-
letterSpacing,
|
|
34
|
-
color,
|
|
35
|
-
style,
|
|
36
|
-
children,
|
|
37
|
-
textAlign,
|
|
38
|
-
opacity,
|
|
39
|
-
margins,
|
|
40
|
-
paddings,
|
|
41
|
-
...props
|
|
42
|
-
}) => {
|
|
43
|
-
const { defaultFont, defaultFontSize, defaultTextColor } = useSkeletor();
|
|
44
|
-
const sizeProps = extractSizeProperties(props);
|
|
45
|
-
|
|
46
|
-
const textSize = useMemo(() => {
|
|
47
|
-
function mapper(value: [number, number] | number) {
|
|
48
|
-
if (Array.isArray(value)) {
|
|
49
|
-
const [fontSize, lineHeight] = value;
|
|
50
|
-
return { fontSize, lineHeight };
|
|
51
|
-
} else {
|
|
52
|
-
return { fontSize: value, lineHeight: value };
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
return mapper(size || defaultFontSize);
|
|
57
|
-
}, [size, defaultFontSize]);
|
|
58
|
-
|
|
59
|
-
const styles = useMemo(
|
|
60
|
-
() =>
|
|
61
|
-
StyleSheet.flatten([
|
|
62
|
-
{
|
|
63
|
-
color: color || defaultTextColor,
|
|
64
|
-
...textSize,
|
|
65
|
-
fontFamily: font || defaultFont,
|
|
66
|
-
opacity,
|
|
67
|
-
textAlign,
|
|
68
|
-
textTransform,
|
|
69
|
-
letterSpacing,
|
|
70
|
-
...margins,
|
|
71
|
-
...paddings,
|
|
72
|
-
...sizeProps,
|
|
73
|
-
},
|
|
74
|
-
style,
|
|
75
|
-
]),
|
|
76
|
-
[
|
|
77
|
-
color,
|
|
78
|
-
font,
|
|
79
|
-
opacity,
|
|
80
|
-
textAlign,
|
|
81
|
-
textTransform,
|
|
82
|
-
textSize,
|
|
83
|
-
margins,
|
|
84
|
-
paddings,
|
|
85
|
-
style,
|
|
86
|
-
]
|
|
87
|
-
);
|
|
88
|
-
|
|
89
|
-
return (
|
|
90
|
-
<RNText
|
|
91
|
-
style={styles}
|
|
92
|
-
allowFontScaling={false}
|
|
93
|
-
maxFontSizeMultiplier={1}
|
|
94
|
-
{...props}
|
|
95
|
-
>
|
|
96
|
-
{children}
|
|
97
|
-
</RNText>
|
|
98
|
-
);
|
|
99
|
-
};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export * from "./Text";
|
package/src/components/index.ts
DELETED
package/src/hooks/index.ts
DELETED
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
import { useEffect } from "react";
|
|
2
|
-
import { BackHandler } from "react-native";
|
|
3
|
-
|
|
4
|
-
interface DefaultProps {
|
|
5
|
-
/** Whether the custom handler is enabled or disabled. */
|
|
6
|
-
enabled: boolean;
|
|
7
|
-
}
|
|
8
|
-
interface WithCallback extends DefaultProps {
|
|
9
|
-
/** Callback function to execute on back button press. Will disable default behavior. */
|
|
10
|
-
handlePress: () => void;
|
|
11
|
-
}
|
|
12
|
-
|
|
13
|
-
interface WithDisable extends DefaultProps {
|
|
14
|
-
/** Whether or not the default android back button behavior will be blocked */
|
|
15
|
-
disableDefault: boolean;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type AndroidBackHandlerConfig = WithCallback | WithDisable;
|
|
19
|
-
|
|
20
|
-
function isWithCallback(
|
|
21
|
-
props: AndroidBackHandlerConfig,
|
|
22
|
-
): props is WithCallback {
|
|
23
|
-
return Object.keys(props).some((key) => key === "handlePress");
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
export function useAndroidBackHandler(props: AndroidBackHandlerConfig) {
|
|
27
|
-
const { enabled } = props;
|
|
28
|
-
|
|
29
|
-
useEffect(() => {
|
|
30
|
-
if (!enabled) {
|
|
31
|
-
return;
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
const handler = BackHandler.addEventListener("hardwareBackPress", () => {
|
|
35
|
-
if (isWithCallback(props)) {
|
|
36
|
-
props.handlePress();
|
|
37
|
-
return true;
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return props.disableDefault;
|
|
41
|
-
});
|
|
42
|
-
|
|
43
|
-
return handler.remove;
|
|
44
|
-
}, [enabled]);
|
|
45
|
-
}
|