From a61a648707cb78a4722c65f6a4832832b36fa2e8 Mon Sep 17 00:00:00 2001 From: Kishan Jadav Date: Wed, 14 Feb 2024 22:21:20 +0000 Subject: [PATCH] Update example --- example/babel.config.js | 15 +++-- .../src/lib/components/CameraController.tsx | 5 +- .../src/lib/components/FloatingBackButton.tsx | 2 +- .../components/ImperativeTextWithLabel.tsx | 4 +- .../screens/ExpoSensorFusionDebugScreen.tsx | 59 +++++++++---------- example/tsconfig.json | 4 +- example/webpack.config.js | 4 +- package-lock.json | 4 +- src/libs/enhanceSubscriptionWithCleanup.ts | 2 +- 9 files changed, 50 insertions(+), 49 deletions(-) diff --git a/example/babel.config.js b/example/babel.config.js index 0d16ad2..9f3c27c 100644 --- a/example/babel.config.js +++ b/example/babel.config.js @@ -10,10 +10,15 @@ module.exports = function (api) { extensions: ['.tsx', '.ts', '.js', '.json'], alias: { // For development, we want to alias the library to the source - 'expo-sensor-fusion': path.join(__dirname, '..', 'src', 'index.ts'), - }, - }, - ], - ], + '@the-curve-consulting/expo-sensor-fusion': path.join( + __dirname, + '..', + 'src', + 'index.ts' + ) + } + } + ] + ] }; }; diff --git a/example/src/lib/components/CameraController.tsx b/example/src/lib/components/CameraController.tsx index 8f4429c..df7fbb3 100644 --- a/example/src/lib/components/CameraController.tsx +++ b/example/src/lib/components/CameraController.tsx @@ -1,5 +1,5 @@ import { useThree } from '@react-three/fiber'; -import { ExpoSensorFusion } from 'expo-sensor-fusion'; +import { ExpoSensorFusion } from '@the-curve-consulting/expo-sensor-fusion'; import { useEffect, useRef } from 'react'; import { Matrix4 } from 'three'; @@ -12,16 +12,15 @@ export const CameraController = () => { const rotationUpdateSubscription = ExpoSensorFusion.addRotationUpdateListener((event) => { const matrix = event.rotationMatrix; - matrixRef.current.set( matrix.m11, matrix.m21, matrix.m31, 0, // eslint-disable-line prettier/prettier matrix.m12, matrix.m22, matrix.m32, 0, // eslint-disable-line prettier/prettier matrix.m13, matrix.m23, matrix.m33, 0, // eslint-disable-line prettier/prettier 0, 0, 0, 0 // eslint-disable-line prettier/prettier ); - camera.rotation.setFromRotationMatrix(matrixRef.current); }); + return () => { rotationUpdateSubscription.remove(); }; diff --git a/example/src/lib/components/FloatingBackButton.tsx b/example/src/lib/components/FloatingBackButton.tsx index 9eb59bc..7ea5675 100644 --- a/example/src/lib/components/FloatingBackButton.tsx +++ b/example/src/lib/components/FloatingBackButton.tsx @@ -11,7 +11,7 @@ export const FloatingBackButton = ({ onBack }: BackButtonProps) => { diff --git a/example/src/lib/components/ImperativeTextWithLabel.tsx b/example/src/lib/components/ImperativeTextWithLabel.tsx index 9fa7ef4..c3125fa 100644 --- a/example/src/lib/components/ImperativeTextWithLabel.tsx +++ b/example/src/lib/components/ImperativeTextWithLabel.tsx @@ -3,7 +3,6 @@ import { Text, TextInput, View } from 'react-native'; export type ImperativeTextWithLabelProps = { label: string; - text: string; }; export type ImperativeTextWithLabelRef = { @@ -36,7 +35,7 @@ export type ImperativeTextWithLabelRef = { export const ImperativeTextWithLabel = forwardRef< ImperativeTextWithLabelRef, ImperativeTextWithLabelProps ->(({ label, text }, ref) => { +>(({ label }, ref) => { const textInputRef = useRef(null); useImperativeHandle( @@ -64,7 +63,6 @@ export const ImperativeTextWithLabel = forwardRef< { @@ -57,28 +57,25 @@ export const ExpoSensorFusionDebugScreen = ({ - + + - - Rotate your device (and/or yourself) around to see the values change. - + + Rotate your device (and/or yourself) around to see the values change. + + ); }; diff --git a/example/tsconfig.json b/example/tsconfig.json index 6f04071..b286e95 100644 --- a/example/tsconfig.json +++ b/example/tsconfig.json @@ -3,8 +3,8 @@ "compilerOptions": { "strict": true, "paths": { - "expo-sensor-fusion": ["../src/index"], - "expo-sensor-fusion/*": ["../src/*"] + "@the-curve-consulting/expo-sensor-fusion": ["../src/index"], + "@the-curve-consulting/expo-sensor-fusion/*": ["../src/*"] } } } diff --git a/example/webpack.config.js b/example/webpack.config.js index a9a1ef3..719434c 100644 --- a/example/webpack.config.js +++ b/example/webpack.config.js @@ -6,7 +6,9 @@ module.exports = async (env, argv) => { { ...env, babel: { - dangerouslyAddModulePathsToTranspile: ['expo-sensor-fusion'] + dangerouslyAddModulePathsToTranspile: [ + '@the-curve-consulting/expo-sensor-fusion' + ] } }, argv diff --git a/package-lock.json b/package-lock.json index 6af48da..ef47526 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,11 +1,11 @@ { - "name": "expo-sensor-fusion", + "name": "@the-curve-consulting/expo-sensor-fusion", "version": "0.1.0", "lockfileVersion": 3, "requires": true, "packages": { "": { - "name": "expo-sensor-fusion", + "name": "@the-curve-consulting/expo-sensor-fusion", "version": "0.1.0", "license": "MIT", "dependencies": { diff --git a/src/libs/enhanceSubscriptionWithCleanup.ts b/src/libs/enhanceSubscriptionWithCleanup.ts index 7506a8f..830ec6d 100644 --- a/src/libs/enhanceSubscriptionWithCleanup.ts +++ b/src/libs/enhanceSubscriptionWithCleanup.ts @@ -2,7 +2,7 @@ import { Subscription } from 'expo-modules-core'; /** * Enhances a {@link Subscription} object with additional {@link cleanupCallback} function to run after the - * {@link subscription.remove} operation. + * {@link Subscription#remove} operation. * * @param subscription - The event emitter subscription reference. * @param cleanupCallback - Additional callback after {@link Subscription#remove} is called on {@link subscription}.