Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.11.0 #177

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 1 addition & 73 deletions .eslintrc.js
Original file line number Diff line number Diff line change
@@ -1,75 +1,3 @@
module.exports = {
root: true,
parser: '@typescript-eslint/parser',
parserOptions: {
project: [
'./tsconfig.json',
],
ecmaFeatures: {
jsx: true,
},
},
plugins: [
'@typescript-eslint',
'react',
'react-native',
'react-hooks',
],
extends: [
// 'plugin:@typescript-eslint/recommended', <-- consider this when time permits
'plugin:react/recommended',
'plugin:react-native/all',
'airbnb-typescript',
],
env: {
es6: true,
jest: true,
'react-native/react-native': true,
},
settings: {
react: {
version: 'detect',
},
},
rules: {
'no-undef': 0, // TS handles this; https://github.com/eslint/eslint/issues/13699#issuecomment-694223066
'no-tabs': 0,
'no-shadow': 0,
'arrow-body-style': 0,
'arrow-parens': [2, 'always'],
'no-console': 0,
'max-len': [2, {
code: 120,
tabWidth: 4,
ignoreComments: true,
ignoreUrls: true,
ignoreStrings: true,
ignoreTemplateLiterals: true,
ignoreRegExpLiterals: true,
}],
'@typescript-eslint/indent': [2, 'tab', { SwitchCase: 1 }],
'@typescript-eslint/no-use-before-define': [2, { variables: false }],
'import/no-unresolved': 0, // ts already provides errors for this and updates more quickly in VSCode
'import/prefer-default-export': 0,
'import/no-extraneous-dependencies': [2, { devDependencies: true }], // allows import of type def libs
'react/destructuring-assignment': 0,
'react/jsx-props-no-spreading': 0,
'react/jsx-indent': [2, 'tab'],
'react/jsx-indent-props': [2, 'tab'],
'react/jsx-one-expression-per-line': 0,
'react/no-unused-state': 0,
'react/prop-types': 0,
'react/require-default-props': 0,
'react/no-unused-prop-types': 0,
'react/sort-comp': 0,
'react/state-in-constructor': 0,
'react-native/sort-styles': 0,
'react-native/no-color-literals': 0,
'react-hooks/rules-of-hooks': 2,
'react-hooks/exhaustive-deps': 1,
'@typescript-eslint/comma-dangle': [2, "always-multiline"],
},
ignorePatterns: [
'.eslintrc.js',
],
extends: ["universe/native", "universe/web"],
};
25 changes: 10 additions & 15 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@
"type": "git",
"url": "git+ssh://[email protected]/nuclearpasta/react-native-drax.git"
},
"main": "build/index.js",
"types": "build/index.d.ts",
"main": "src/index.ts",
"scripts": {
"lint": "yarn run eslint src",
"build": "yarn run tsc",
Expand All @@ -30,18 +29,14 @@
"@types/lodash.throttle": "^4.1.6",
"@types/node": "^14.14.43",
"@types/react-native": "^0.65.22",
"@typescript-eslint/eslint-plugin": "^4.22.0",
"@typescript-eslint/parser": "^4.22.0",
"eslint": "^7.25.0",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-plugin-import": "^2.22.1",
"eslint-plugin-jsx-a11y": "^6.4.1",
"eslint-plugin-react": "^7.23.2",
"eslint-plugin-react-hooks": "^4.2.0",
"eslint-plugin-react-native": "^3.10.0",
"react": "^17.0.2",
"react-native": "^0.65.2",
"react-native-gesture-handler": "^1.8.0",
"typescript": "^4.7.3"
"eslint": "8",
"eslint-config-universe": "^13.0.0",

"prettier": "^3.3.3",
"react": "^18.3.1",
"react-native": "^0.75.4",
"react-native-gesture-handler": "^2.20.0",
"react-native-reanimated": "^3.15.5",
"typescript": "^5.6.3"
}
}
30 changes: 30 additions & 0 deletions src/AllHoverViews.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
import React, { useMemo, useState } from "react";
import { useAnimatedReaction, runOnJS } from "react-native-reanimated";

import { ReanimatedHoverView } from "./HoverView";
import { useDraxContext } from "./hooks";

export const AllHoverViews = ({ allViewIds }: { allViewIds: string[] }) => {
const { getHoverItems } = useDraxContext();

const hoverViews = useMemo(
() => allViewIds && getHoverItems(allViewIds),
[allViewIds, getHoverItems],
);
// const updateHoverViews = () => {
// console.log('getAllViewIds()', allViewIds);
// console.log('getHoverItems(getAllViewIds())', allViewIds && getHoverItems(allViewIds));
// allViewIds && setAllHoverViews(getHoverItems(allViewIds));
// };
return hoverViews?.map(
(viewData, index) =>
viewData?.protocol.hoverPosition?.value && (
<ReanimatedHoverView
key={viewData.id || index}
hoverPosition={viewData?.protocol.hoverPosition}
scrollPosition={viewData?.scrollPosition}
{...(viewData?.protocol || {})}
/>
),
);
};
10 changes: 6 additions & 4 deletions src/DraxContext.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
import { createContext } from 'react';
import { createContext } from "react";

import { DraxContextValue } from './types';
import { DraxContextValue } from "./types";

export const DraxContext = createContext<DraxContextValue | undefined>(undefined);
DraxContext.displayName = 'Drax';
export const DraxContext = createContext<DraxContextValue | undefined>(
undefined,
);
DraxContext.displayName = "Drax";
Loading