How to use the realm/react-native.ListView.DataSource function in realm

To help you get started, we’ve selected a few realm examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github sussol / react-native-generic-table-page / index.js View on Github external
constructor(props) {
    super(props);
    const dataSource = new ListView.DataSource({
      rowHasChanged: (row1, row2) => row1 !== row2,
    });
    this.state = {
      dataSource: dataSource,
      searchTerm: '',
      sortBy: props.defaultSortKey,
      isAscending: props.defaultSortDirection === 'ascending',
      selection: props.selection,
      expandedRows: [],
    };
    this.cellRefsMap = {}; // { rowId: reference, rowId: reference, ...}
    this.dataTableRef = null;
    this.onSearchChange = this.onSearchChange.bind(this);
    this.onColumnSort = this.onColumnSort.bind(this);
    this.focusNextField = this.focusNextField.bind(this);
    this.renderFooter = this.renderFooter.bind(this);
github realm / realm-js / examples / ReactExample / components / todo-itemsview.js View on Github external
constructor(props) {
        super(props);

        let dataSource = new ListView.DataSource({
            rowHasChanged(a, b) {
                // Always re-render TodoList items.
                return a.done !== b.done || a.text !== b.text || a.items || b.items;
            }
        });

        this.state = {
            dataSource: this._cloneDataSource(dataSource, props),
        };

        this.renderRow = this.renderRow.bind(this);
    }
github realm / realm-js / examples / ReactExample / components / todo-listview.js View on Github external
constructor(props) {
        super(props);

        let dataSource = new ListView.DataSource({
            rowHasChanged(a, b) {
                // Always re-render TodoList items.
                return a.done !== b.done || a.text !== b.text || a.items || b.items;
            }
        });

        this.state = {
            dataSource: this._cloneDataSource(dataSource, props),
        };

        this.renderRow = this.renderRow.bind(this);
    }
github mongrov / roverz / src / chat / members / MemberListView.js View on Github external
constructor(props) {
    super(props);
    this._service = new Network();
    this._group = this.props.group;
    const dataSource = new ListView.DataSource({
      rowHasChanged: (row1, row2) => row1 !== row2,
    });
    this._mounted = false;
    this._memberListData = [];
    this.state = {
      dataSource: dataSource.cloneWithRows(this._memberListData),
      loaded: false,
      totalMembers: 0,
      onlineMembers: 0,
      roomName: this.props.roomTitle ? this.props.roomTitle : this.props.roomName,
      layout: {
        height,
        width,
      },
    };
    this._membersCallback = this._membersCallback.bind(this);
github mongrov / roverz / src / chat / groups / GroupView.js View on Github external
constructor(props) {
    super(props);
    this._service = new Network();
    const dataSource = new ListView.DataSource({
      rowHasChanged: (row1, row2) => row1 !== row2,
    });
    this._mounted = false;
    this.state = {
      dataSource: dataSource.cloneWithRows(dataSource),
      loaded: false,
      items: this._service.chat.service.availableChannels,
      connected: false,
      appState: AppState.currentState,
    };
  }
github mongrov / roverz / src / chat / groups / GroupView.js View on Github external
constructor(props) {
    super(props);
    this._service = new Network();
    const dataSource = new ListView.DataSource({
      rowHasChanged: (row1, row2) => row1 !== row2,
    });
    this._mounted = false;
    this.state = {
      dataSource: dataSource.cloneWithRows(dataSource),
      loaded: false,
      items: this._service.chat.service.availableChannels,
      connected: false,
      appState: AppState.currentState,
    };
  }
github huchenme / 30daysOfReactNative / js / Day20.js View on Github external
themeColor: PropTypes.string.isRequired,
    title: PropTypes.string.isRequired,
    todos: PropTypes.object.isRequired,
    realm: PropTypes.any,
    style: PropTypes.object,
    toggleTab: PropTypes.func,
  }

  static defaultProps = {
    remainCount: 0,
  }

  state = {
    remainCount: this.props.todos.filtered('completed = false').length,
    newTodo: '',
    dataSource: new ListView.DataSource({rowHasChanged: (row1, row2) => {
      return row1 !== row2
    }}),
  }

  componentDidMount() {
    this.resetDataSource()
  }

  _resetDataSource = () => {
    this.setState({
      dataSource: this.state.dataSource.cloneWithRows(this.props.todos),
      remainCount: this.props.todos.filtered('completed = false').length,
    })
    LayoutAnimation.configureNext(animations)
  }
github mongrov / roverz / src / chat / ui / group / SearchRoomView.js View on Github external
constructor(props) {
    super(props);
    const n = new Network();
    this._group = this.props.group;
    const dataSource = new ListView.DataSource({
      rowHasChanged: (row1, row2) => row1 !== row2,
    });

    this.state = {
      _network: n,
      dataSource: dataSource.cloneWithRows(memberListData),
      loaded: false,
      roomObj: this.props.group,
      text: '',
    };
    this._searchRoomsCallback = this._searchRoomsCallback.bind(this);
    this._createRoomCallback = this._createRoomCallback.bind(this);
    this.createRoom = this.createRoom.bind(this);
  }
github miguelespinoza / react-goku / app / pages / SavedPage.js View on Github external
getInitialState() {
        var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1.solved !== r2.solved});
        return {
            dataSource: ds.cloneWithRows(GokuDB.getBoards()),
        };
    },
    render() {