@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 CHANGED
@@ -1 +1 @@
1
- "use strict";var p=Object.create;var x=Object.defineProperty;var y=Object.getOwnPropertyDescriptor;var c=Object.getOwnPropertyNames;var a=Object.getPrototypeOf,d=Object.prototype.hasOwnProperty;var S=(e,t)=>{for(var o in t)x(e,o,{get:t[o],enumerable:!0})},f=(e,t,o,n)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of c(t))!d.call(e,r)&&r!==o&&x(e,r,{get:()=>t[r],enumerable:!(n=y(t,r))||n.enumerable});return e};var u=(e,t,o)=>(o=e!=null?p(a(e)):{},f(t||!e||!e.__esModule?x(o,"default",{value:e,enumerable:!0}):o,e)),m=e=>f(x({},"__esModule",{value:!0}),e);var P={};S(P,{Box1:()=>i});module.exports=m(P);var l=u(require("react"),1),s=require("react-native");function i({style:e,children:t}){let[o,n]=(0,l.useState)(0);return l.default.createElement(s.View,{style:e},l.default.createElement(s.Text,{style:B.text,onPress:()=>{n(r=>r+1)}},"Box1 ",o),t)}var B=s.StyleSheet.create({text:{fontSize:20,padding:15,borderRadius:10,color:"#ffffff",backgroundColor:"#0a234a"}});
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 e,{useState as n}from"react";import{View as x,Text as f,StyleSheet as i}from"react-native";function p({style:t,children:o}){let[r,s]=n(0);return e.createElement(x,{style:t},e.createElement(f,{style:y.text,onPress:()=>{s(l=>l+1)}},"Box1 ",r),o)}var y=i.create({text:{fontSize:20,padding:15,borderRadius:10,color:"#ffffff",backgroundColor:"#0a234a"}});export{p as Box1};
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};
@@ -1 +1,2 @@
1
- export { Box1 } from '@/components/Box1';
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.1",
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",