Skip to content

Commit

Permalink
Add image fading and less useEffect (#369)
Browse files Browse the repository at this point in the history
  • Loading branch information
NigelBreslaw authored Feb 14, 2024
1 parent 9c9387f commit 8749187
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions native_gg/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,12 @@ export default function App() {
console.warn("No .ENV file found. Please create one.");
}
const authServiceRef = useRef<AuthService | null>(null);
authServiceRef.current = AuthService.getInstance();

const [state, dispatch] = useReducer(reducer, initialState);
authServiceRef.current.subscribe(dispatch);

useEffect(() => {
authServiceRef.current = AuthService.getInstance();
// Subscribe to auth changes
authServiceRef.current.subscribe(dispatch);

// Unsubscribe when the component unmounts
return () => {
if (authServiceRef.current) {
Expand All @@ -60,6 +59,7 @@ export default function App() {
<Image
style={{ width: 200, height: 200 }}
contentFit="contain"
transition={300}
source={
state.currentAccount
? `https://www.bungie.net${state.currentAccount?.iconPath}`
Expand Down

0 comments on commit 8749187

Please sign in to comment.