Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

figure out navigation #8

Open
github-actions bot opened this issue Jan 3, 2022 · 0 comments
Open

figure out navigation #8

github-actions bot opened this issue Jan 3, 2022 · 0 comments
Labels

Comments

@github-actions
Copy link

github-actions bot commented Jan 3, 2022

figure out navigation

and a scrollable list where clicking an item takes you the details view.

// TODO: figure out navigation

import React from "react";
import {Box} from "./Box";
import {Color} from "./Common";
import {ErrorBoundary} from "./ErrorBoundary";
// import {KeyboardAccessoryNavigation} from "react-native-keyboard-accessory";
import {Spinner} from "./Spinner";
import {Unifier} from "./Unifier";
import {FlatList} from "./FlatList";
import {ListRenderItemInfo} from "react-native";

interface SplitPageProps {
  // TODO: figure out navigation
  navigation: any;
  loading?: boolean;
  color?: Color;
  keyboardOffset?: number;
  rightButton?: string;
  rightButtonOnClick?: () => void;
  renderListViewItem: (itemInfo: ListRenderItemInfo<any>) => React.ReactElement | null;
  renderListViewHeader?: () => React.ReactElement | null;
  listViewData: any[];
  listViewExtraData?: any;
}

interface SplitPageState {}

// A component for rendering a list on one side and a details view on the right for large screens,
// and a scrollable list where clicking an item takes you the details view.
export class SplitPage extends React.Component<SplitPageProps, SplitPageState> {
  actionSheetRef: React.RefObject<any> = React.createRef();

  render() {
    return (
      <ErrorBoundary>
        <Box
          avoidKeyboard={true}
          keyboardOffset={this.props.keyboardOffset}
          display="flex"
          width="100%"
          height="100%"
          flex="grow"
          direction="row"
          color={this.props.color || "lightGray"}
        >
          {this.props.loading === true && (
            <Spinner size="md" color={Unifier.theme.darkGray as any} />
          )}
          {/* <KeyboardAccessoryNavigation
          avoidKeyboard
          doneButton={true}
          nextButton={true}
          previousButton={true}
        /> */}

          {/* TODO: render this only for small sizes */}
          <Box width={300} maxWidth={300} flex="shrink" direction="column" scroll={true}>
            {this.props.renderListViewHeader && this.props.renderListViewHeader()}
            <FlatList
              data={this.props.listViewData}
              renderItem={this.props.renderListViewItem}
              keyExtractor={(item) => item.id}
              extraData={this.props.listViewExtraData}
            />
          </Box>
          <Box flex="grow" padding={2}>
            {this.props.children}
          </Box>
        </Box>
      </ErrorBoundary>
    );
  }
}

67e41971bb3cef70d08bddd18d047e31d8778fa1

@github-actions github-actions bot added the todo label Jan 3, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

0 participants