Skip to content

Commit

Permalink
Merge f5bdcef into 525c8f6
Browse files Browse the repository at this point in the history
  • Loading branch information
kuket15 committed Oct 23, 2021
2 parents 525c8f6 + f5bdcef commit e1c0f4b
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 1 deletion.
1 change: 1 addition & 0 deletions AUTHORS
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@ Pete Nykänen
Philihp Busby
Jason Harrison
Brendon Roberto
Luca Vallisa
13 changes: 13 additions & 0 deletions src/client/react-native.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,14 @@ import { Client as RawClient } from './client';
*/
export function Client(opts) {
const { game, numPlayers, board, multiplayer, enhancer } = opts;
let { loading } = opts;

// Component that is displayed before the client has synced
// with the game master.
if (loading === undefined) {
const Loading = () => <></>;
loading = Loading;
}

/*
* WrappedBoard
Expand Down Expand Up @@ -96,6 +104,11 @@ export function Client(opts) {
let _board = null;

const state = this.client.getState();

if (state === null) {
return React.createElement(loading);
}

const { matchID, playerID, ...rest } = this.props;

if (board) {
Expand Down
3 changes: 2 additions & 1 deletion src/client/react.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,8 @@ export function Client<
P extends BoardProps<G> = BoardProps<G>,
ContextWithPlugins extends Ctx = Ctx
>(opts: ReactClientOpts<G, P, ContextWithPlugins>) {
let { game, numPlayers, loading, board, multiplayer, enhancer, debug } = opts;
const { game, numPlayers, board, multiplayer, enhancer } = opts;
let { loading, debug } = opts;

// Component that is displayed before the client has synced
// with the game master.
Expand Down

0 comments on commit e1c0f4b

Please sign in to comment.