Skip to content

Commit

Permalink
Add workaround for firebase-ui
Browse files Browse the repository at this point in the history
  • Loading branch information
joelwross committed Nov 28, 2022
1 parent c13382a commit 9abe1bc
Show file tree
Hide file tree
Showing 30 changed files with 68 additions and 40 deletions.
2 changes: 1 addition & 1 deletion build/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/ajax.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/class-components.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/client-side-development.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/client-side-routing.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/code-style-guide.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/css-frameworks.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/css-in-js.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/css-layouts.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/css-options.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/css.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/dom.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/es6.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
20 changes: 15 additions & 5 deletions build/firebase.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down Expand Up @@ -824,14 +824,24 @@ <h3>Signing In with FirebaseUI</h3>
<img src="img/firebase/firebaseui-example.png" alt="" />
<p class="caption">Example of FirebaseUI authentication</p>
</div>
<p>There are different FirebaseUI libraries for different platforms; for React you would use <a href="https://github.com/firebase/firebaseui-web-react"><code>firebaseui-web-react</code></a>. This is an external library (just like <code>react-router</code>), so needs to be installed separately:</p>
<pre class="language-bash"><code><span class="token function">npm</span> <span class="token function">install</span> react-firebaseui</code></pre>
<p>There are different FirebaseUI libraries for different platforms; previously for React you would use <a href="https://github.com/firebase/firebaseui-web-react"><code>firebaseui-web-react</code></a>. However, as of November 2022 this library has not been updated to work with the latest version of React (React 18), and appears that it may have been abandoned rather than <a href="https://github.com/firebase/firebaseui-web-react/pull/173">applying the needed fix</a>. There are two possible workarounds to this:</p>
<ol style="list-style-type: decimal">
<li><p>You can install a user-contributed version of the library (which hasn’t been accepted as a pull request yet):</p>
<pre class="language-bash"><code><span class="token comment"># install library on the command line</span>
<span class="token function">npm</span> <span class="token function">install</span> https://gitpkg.now.sh/gvillenave/firebaseui-web-react/dist</code></pre>
<p>Confirm that your <code>package.json</code> file has the correct dependency listed:</p>
<pre><code>&quot;react-firebaseui&quot;: &quot;https://gitpkg.now.sh/gvillenave/firebaseui-web-react/dist&quot;</code></pre></li>
<li><p>You can install the non-React version of the library (<code>firebaseui</code>), and then define the needed Component (<code>StyledFirebaseUI</code>) manually:</p>
<pre class="language-bash"><code><span class="token function">npm</span> <span class="token function">install</span> firebaseui</code></pre>
<p>Create the <code>StyledFirebaseAuth.txs</code> file defined <a href="https://github.com/firebase/firebaseui-web-react/pull/173#issuecomment-1224404146">in this comment post</a>.</p></li>
</ol>
<p>The React FirebaseUI library provides a Component called <code>&lt;StyledFirebaseAuth&gt;</code>, which you can render in your page like any other Component. You can think of this Component as the “login form”. A complete example of how this Component is used can be found below, following by an explanation.</p>
<pre class="language-jsx"><code><span class="token comment">//import auth functions and variables from Firebase</span>
<span class="token keyword">import</span> <span class="token punctuation">{</span> getAuth<span class="token punctuation">,</span> EmailAuthProvider<span class="token punctuation">,</span> GoogleAuthProvider <span class="token punctuation">}</span> <span class="token keyword">from</span> <span class="token string">'firebase/auth'</span>

<span class="token comment">//import the component</span>
<span class="token keyword">import</span> StyledFirebaseAuth <span class="token keyword">from</span> <span class="token string">'react-firebaseui/StyledFirebaseAuth'</span><span class="token punctuation">;</span>
<span class="token comment">//import the component -- pick one!</span>
<span class="token keyword">import</span> StyledFirebaseAuth <span class="token keyword">from</span> <span class="token string">'react-firebaseui/StyledFirebaseAuth'</span><span class="token punctuation">;</span> <span class="token comment">//install option 1</span>
<span class="token keyword">import</span> StyledFirebaseAuth <span class="token keyword">from</span> <span class="token string">'./StyledFirebaseAuth'</span><span class="token punctuation">;</span> <span class="token comment">//install option 2</span>

<span class="token comment">//an object of configuration values</span>
<span class="token keyword">const</span> firebaseUIConfig <span class="token operator">=</span> <span class="token punctuation">{</span>
Expand Down
2 changes: 1 addition & 1 deletion build/functional-programming.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/html-fundamentals.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
4 changes: 2 additions & 2 deletions build/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down Expand Up @@ -543,7 +543,7 @@ <h1>
<div id="header">
<h1 class="title">Client-Side Web Development</h1>
<p class="author"><em><a href="http://faculty.washington.edu/joelross/">Joel Ross</a> and <a href="http://mfviz.com/#/">Mike Freeman</a></em></p>
<p class="date"><em>November 21, 2022</em></p>
<p class="date"><em>November 28, 2022</em></p>
</div>
<div id="about-the-book" class="section level1 unnumbered">
<h1>About the Book</h1>
Expand Down
2 changes: 1 addition & 1 deletion build/interactive-react.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/javascript-libraries.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/javascript.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/jest.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/machine-setup.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/react-native.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/react.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/redux.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/responsive-css.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/search_index.json

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion build/standards-and-accessibility.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
2 changes: 1 addition & 1 deletion build/webpack.html
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<meta name="author" content="Joel Ross and Mike Freeman" />


<meta name="date" content="2022-11-21" />
<meta name="date" content="2022-11-28" />

<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="apple-mobile-web-app-capable" content="yes" />
Expand Down
30 changes: 24 additions & 6 deletions firebase.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -346,20 +346,38 @@ Instead, a nicer approach is to use the [**FireabaseUI**](https://firebase.googl
![Example of FirebaseUI authentication](img/firebase/firebaseui-example.png)
There are different FirebaseUI libraries for different platforms; for React you would use [`firebaseui-web-react`](https://github.com/firebase/firebaseui-web-react). This is an external library (just like `react-router`), so needs to be installed separately:
There are different FirebaseUI libraries for different platforms; previously for React you would use [`firebaseui-web-react`](https://github.com/firebase/firebaseui-web-react). However, as of November 2022 this library has not been updated to work with the latest version of React (React 18), and appears that it may have been abandoned rather than [applying the needed fix](https://github.com/firebase/firebaseui-web-react/pull/173). There are two possible workarounds to this:
```bash
npm install react-firebaseui
```
1. You can install a user-contributed version of the library (which hasn't been accepted as a pull request yet):
```bash
# install library on the command line
npm install https://gitpkg.now.sh/gvillenave/firebaseui-web-react/dist
```
Confirm that your `package.json` file has the correct dependency listed:
```
"react-firebaseui": "https://gitpkg.now.sh/gvillenave/firebaseui-web-react/dist"
```
2. You can install the non-React version of the library (`firebaseui`), and then define the needed Component (`StyledFirebaseUI`) manually:
```bash
npm install firebaseui
```
Create the `StyledFirebaseAuth.txs` file defined [in this comment post](https://github.com/firebase/firebaseui-web-react/pull/173#issuecomment-1224404146).
The React FirebaseUI library provides a Component called `<StyledFirebaseAuth>`, which you can render in your page like any other Component. You can think of this Component as the "login form". A complete example of how this Component is used can be found below, following by an explanation.
```jsx
//import auth functions and variables from Firebase
import { getAuth, EmailAuthProvider, GoogleAuthProvider } from 'firebase/auth'
//import the component
import StyledFirebaseAuth from 'react-firebaseui/StyledFirebaseAuth';
//import the component -- pick one!
import StyledFirebaseAuth from 'react-firebaseui/StyledFirebaseAuth'; //install option 1
import StyledFirebaseAuth from './StyledFirebaseAuth'; //install option 2
//an object of configuration values
const firebaseUIConfig = {
Expand Down

0 comments on commit 9abe1bc

Please sign in to comment.