Skip to content

Commit

Permalink
Fix native example and lint
Browse files Browse the repository at this point in the history
  • Loading branch information
steida committed Nov 26, 2023
1 parent 02b2fc2 commit c753cac
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 17 deletions.
24 changes: 9 additions & 15 deletions apps/native/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -56,20 +56,15 @@ const Database = S.struct({
todoCategory: TodoCategoryTable,
});

const {
useEvoluError,
createQuery,
useQuery,
useCreate,
useUpdate,
useOwner,
useEvolu,
} = Evolu.create(Database, {
const evolu = Evolu.create(Database, {
...(process.env.NODE_ENV === "development" && {
syncUrl: "http://localhost:4000",
}),
});

// React Hooks
const { useEvolu, useEvoluError, useQuery, useOwner } = evolu;

export default function App(): JSX.Element {
return (
<ScrollView style={appStyles.container}>
Expand Down Expand Up @@ -175,7 +170,7 @@ const OwnerActions: FC = () => {
);
};

const todosWithCategories = createQuery((db) =>
const todosWithCategories = evolu.createQuery((db) =>
db
.selectFrom("todo")
.select(["id", "title", "isCompleted", "categoryId"])
Expand All @@ -199,7 +194,7 @@ const todosWithCategories = createQuery((db) =>
);

const Todos: FC = () => {
const create = useCreate();
const { create } = useEvolu();
const { rows } = useQuery(todosWithCategories);

const [text, setText] = useState("");
Expand Down Expand Up @@ -242,7 +237,7 @@ const TodoItem = memo<{
}>(function TodoItem({
row: { id, title, isCompleted, categoryId, categories },
}) {
const update = useUpdate();
const { update } = useEvolu();

return (
<View style={{ marginBottom: 16 }}>
Expand Down Expand Up @@ -311,7 +306,7 @@ interface TodoCategoryForSelect {
readonly name: TodoCategoryTable["name"] | null;
}

const todoCategories = createQuery((db) =>
const todoCategories = evolu.createQuery((db) =>
db
.selectFrom("todoCategory")
.select(["id", "name", "json"])
Expand All @@ -323,8 +318,7 @@ const todoCategories = createQuery((db) =>
);

const TodoCategories: FC = () => {
const create = useCreate();
const update = useUpdate();
const { create, update } = useEvolu();
const { rows } = useQuery(todoCategories);

const [text, setText] = useState("");
Expand Down
3 changes: 1 addition & 2 deletions packages/eslint-config-evolu/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,8 @@ module.exports = {
},
parser: "@typescript-eslint/parser",

// https://github.com/facebook/react-native/issues/28549#issuecomment-1464986589
settings: {
"import/ignore": ["react-native"],
"import/ignore": ["node_modules/react-native/index\\.js$"],
},

parserOptions: {
Expand Down

0 comments on commit c753cac

Please sign in to comment.