From 8cf5b54408fd339e98546ede8bf521e3966b36f0 Mon Sep 17 00:00:00 2001 From: kikeztw Date: Mon, 11 Apr 2022 12:24:45 -0400 Subject: [PATCH 1/2] fix import react --- src/context.tsx | 6 +++--- src/hook.ts | 4 ++-- src/provider.tsx | 6 +++--- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/context.tsx b/src/context.tsx index ffde7d2..3dd2d71 100644 --- a/src/context.tsx +++ b/src/context.tsx @@ -1,4 +1,4 @@ -import { createContext, useContext } from 'react'; +import * as React from 'react'; import { AuthClientContextType } from './types'; /** @@ -8,7 +8,7 @@ const stub = (): never => { throw new Error('You forgot to wrap your component in .'); }; -export const AuthClientContext = createContext({ +export const AuthClientContext = React.createContext({ isAuthenticated: false, isLoading: true, clearSession: stub, @@ -16,4 +16,4 @@ export const AuthClientContext = createContext({ }); export const useAuth = (): AuthClientContextType => - useContext(AuthClientContext); + React.useContext(AuthClientContext); diff --git a/src/hook.ts b/src/hook.ts index a6ca4ee..e8ede19 100644 --- a/src/hook.ts +++ b/src/hook.ts @@ -1,7 +1,7 @@ -import { useContext } from 'react'; +import * as React from 'react'; import { AuthClientContext } from './context'; import { AuthClientContextType } from './types'; export const useAuth = (): AuthClientContextType => - useContext(AuthClientContext); + React.useContext(AuthClientContext); diff --git a/src/provider.tsx b/src/provider.tsx index edcd120..9678afb 100644 --- a/src/provider.tsx +++ b/src/provider.tsx @@ -1,4 +1,4 @@ -import React, { useEffect, useState } from 'react'; +import * as React from 'react'; import { Auth0Native } from './client'; import { AuthClientContext } from './context'; import { AuthClientContextType } from './types'; @@ -7,7 +7,7 @@ export const AuthProvider: React.FC<{ client: Auth0Native; scope: string; }> = ({ children, client, scope }) => { - const [state, setState] = useState<{ + const [state, setState] = React.useState<{ isLoading: boolean; isAuthenticated: boolean; }>({ @@ -15,7 +15,7 @@ export const AuthProvider: React.FC<{ isLoading: true, }); - useEffect(() => { + React.useEffect(() => { client.isAuthenticated().then((isAuth) => { setState((prev) => ({ ...prev, From 7bc08bf38375ade88c32b9a85eb55cdacda3f223 Mon Sep 17 00:00:00 2001 From: kikeztw Date: Mon, 11 Apr 2022 12:27:42 -0400 Subject: [PATCH 2/2] update version --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index e2aa097..5253cf0 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@cobuildlab/react-native-auth0", - "version": "0.3.2", + "version": "0.3.3", "description": "Todo", "main": "lib/index.js", "types": "./lib/index.d.ts",