Skip to content

Commit

Permalink
Merge pull request #17 from cobuildlab/hotfix/react-import
Browse files Browse the repository at this point in the history
Hotfix/react import
  • Loading branch information
jesusrodrz authored Apr 11, 2022
2 parents 984d754 + 7bc08bf commit afefeb8
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -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",
Expand Down
6 changes: 3 additions & 3 deletions src/context.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createContext, useContext } from 'react';
import * as React from 'react';
import { AuthClientContextType } from './types';

/**
Expand All @@ -8,12 +8,12 @@ const stub = (): never => {
throw new Error('You forgot to wrap your component in <Auth0Provider>.');
};

export const AuthClientContext = createContext<AuthClientContextType>({
export const AuthClientContext = React.createContext<AuthClientContextType>({
isAuthenticated: false,
isLoading: true,
clearSession: stub,
authorize: stub,
});

export const useAuth = (): AuthClientContextType =>
useContext(AuthClientContext);
React.useContext(AuthClientContext);
4 changes: 2 additions & 2 deletions src/hook.ts
Original file line number Diff line number Diff line change
@@ -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);
6 changes: 3 additions & 3 deletions src/provider.tsx
Original file line number Diff line number Diff line change
@@ -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';
Expand All @@ -7,15 +7,15 @@ 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;
}>({
isAuthenticated: false,
isLoading: true,
});

useEffect(() => {
React.useEffect(() => {
client.isAuthenticated().then((isAuth) => {
setState((prev) => ({
...prev,
Expand Down

0 comments on commit afefeb8

Please sign in to comment.