@mbrain/epic-react-native-lib 0.0.1 → 0.0.3
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/dist/index.cjs +1 -1
- package/dist/index.mjs +1 -1
- package/dist/types/index.d.ts +2 -1
- package/dist/types/utils/orientation.d.ts +24 -0
- package/package.json +6 -2
package/dist/index.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var S=Object.create;var s=Object.defineProperty;var l=Object.getOwnPropertyDescriptor;var x=Object.getOwnPropertyNames;var m=Object.getPrototypeOf,y=Object.prototype.hasOwnProperty;var k=(t,e)=>{for(var n in e)s(t,n,{get:e[n],enumerable:!0})},u=(t,e,n,o)=>{if(e&&typeof e=="object"||typeof e=="function")for(let i of x(e))!y.call(t,i)&&i!==n&&s(t,i,{get:()=>e[i],enumerable:!(o=l(e,i))||o.enumerable});return t};var d=(t,e,n)=>(n=t!=null?S(m(t)):{},u(e||!t||!t.__esModule?s(n,"default",{value:t,enumerable:!0}):n,t)),L=t=>u(s({},"__esModule",{value:!0}),t);var P={};k(P,{Box1:()=>p,useOrientation:()=>O});module.exports=L(P);var c=d(require("react"),1),r=require("react-native");function p({style:t,children:e}){let[n,o]=(0,c.useState)(0);return c.default.createElement(r.View,{style:t},c.default.createElement(r.Text,{style:g.text,onPress:()=>{o(i=>i+1)}},"Box1 ",n),e)}var g=r.StyleSheet.create({text:{fontSize:20,padding:15,borderRadius:10,color:"#ffffff",backgroundColor:"#0a234a"}});var f=require("react"),a=d(require("expo-screen-orientation"),1);function O(){let[t,e]=(0,f.useState)({orientation:void 0,orientationLock:void 0});return(0,f.useEffect)(()=>{Promise.all([a.getOrientationAsync(),a.getOrientationLockAsync()]).then(([o,i])=>{e({orientation:o,orientationLock:i})});let n=a.addOrientationChangeListener(o=>{e({orientation:o.orientationInfo.orientation,orientationLock:o.orientationLock})});return()=>n.remove()},[]),t}
|
package/dist/index.mjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import
|
|
1
|
+
import a,{useState as c}from"react";import{View as s,Text as f,StyleSheet as u}from"react-native";function d({style:o,children:n}){let[i,t]=c(0);return a.createElement(s,{style:o},a.createElement(f,{style:p.text,onPress:()=>{t(r=>r+1)}},"Box1 ",i),n)}var p=u.create({text:{fontSize:20,padding:15,borderRadius:10,color:"#ffffff",backgroundColor:"#0a234a"}});import{useEffect as O,useState as S}from"react";import*as e from"expo-screen-orientation";function l(){let[o,n]=S({orientation:void 0,orientationLock:void 0});return O(()=>{Promise.all([e.getOrientationAsync(),e.getOrientationLockAsync()]).then(([t,r])=>{n({orientation:t,orientationLock:r})});let i=e.addOrientationChangeListener(t=>{n({orientation:t.orientationInfo.orientation,orientationLock:t.orientationLock})});return()=>i.remove()},[]),o}export{d as Box1,l as useOrientation};
|
package/dist/types/index.d.ts
CHANGED
|
@@ -1 +1,2 @@
|
|
|
1
|
-
export { Box1 } from '
|
|
1
|
+
export { Box1 } from './components/Box1';
|
|
2
|
+
export { useOrientation } from './utils/orientation';
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import * as ScreenOrientation from 'expo-screen-orientation';
|
|
2
|
+
/**
|
|
3
|
+
* Provides real-time screen orientation information and orientation lock status.
|
|
4
|
+
*
|
|
5
|
+
* ## Usage
|
|
6
|
+
*
|
|
7
|
+
* ```tsx
|
|
8
|
+
* import * as ScreenOrientation from 'expo-screen-orientation';
|
|
9
|
+
*
|
|
10
|
+
* // Both values start as undefined and are populated once the initial orientation is determined
|
|
11
|
+
* const { orientation, orientationLock } = useOrientation();
|
|
12
|
+
*
|
|
13
|
+
* const isLandscape = orientation === ScreenOrientation.Orientation.LANDSCAPE_LEFT ||
|
|
14
|
+
* orientation === ScreenOrientation.Orientation.LANDSCAPE_RIGHT;
|
|
15
|
+
*
|
|
16
|
+
* const isPortraitLocked = orientationLock === ScreenOrientation.OrientationLock.PORTRAIT_UP;
|
|
17
|
+
* ```
|
|
18
|
+
*
|
|
19
|
+
* @returns Object containing current orientation and orientation lock information
|
|
20
|
+
*/
|
|
21
|
+
export declare function useOrientation(): {
|
|
22
|
+
orientation: ScreenOrientation.Orientation | undefined;
|
|
23
|
+
orientationLock: ScreenOrientation.OrientationLock | undefined;
|
|
24
|
+
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mbrain/epic-react-native-lib",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.3",
|
|
4
4
|
"description": "A set of helpful, battle-tested utilities that simplify common React Native workflows and speed up app development",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"sideEffects": false,
|
|
@@ -15,6 +15,8 @@
|
|
|
15
15
|
},
|
|
16
16
|
"scripts": {
|
|
17
17
|
"dev": "npm run clean && npm-run-all --parallel dev:js dev:types",
|
|
18
|
+
"dev:js": "node scripts/build.mjs --watch",
|
|
19
|
+
"dev:types": "tsc --project tsconfig.build.json --emitDeclarationOnly --watch",
|
|
18
20
|
"build": "npm run clean && npm run build:types && npm run build:js",
|
|
19
21
|
"build:js": "NODE_ENV=production node scripts/build.mjs",
|
|
20
22
|
"build:types": "tsc --project tsconfig.build.json --emitDeclarationOnly",
|
|
@@ -31,7 +33,9 @@
|
|
|
31
33
|
"require": "./dist/index.cjs"
|
|
32
34
|
}
|
|
33
35
|
},
|
|
34
|
-
"dependencies": {
|
|
36
|
+
"dependencies": {
|
|
37
|
+
"expo-screen-orientation": "^9.0.7"
|
|
38
|
+
},
|
|
35
39
|
"peerDependencies": {
|
|
36
40
|
"react": ">=18.0.0",
|
|
37
41
|
"react-dom": ">=18.0.0",
|