This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// dependency - you need to finish load rooms before you load reservations | |
let roomsLoadPromise = undefined; | |
export function loadRooms() { | |
return async function (dispatch, getState) { | |
if (!roomsLoadPromise) { | |
roomsLoadPromise = dispatch(_loadRooms()); | |
} | |
await roomsLoadPromise; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'use strict'; | |
var Controllers = require('react-native-controllers'); | |
var React = Controllers.hijackReact(); | |
var { | |
ControllerRegistry, | |
TabBarControllerIOS, | |
NavigationControllerIOS, | |
ViewControllerIOS, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// notes: | |
// notice how this file is not related at all to react-native-controllers, this is how you would define a regular | |
// React component that's connected to a redux store | |
// we don't want to add react-native-controllers modifications in every one of your screens, see app.ios.js + index.ios.js | |
// to see how we concentrate all necessary modifications in one place | |
import React, { | |
Component, | |
Text, | |
View, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// note: | |
// this is the entry point for the entire app | |
import React, { Component, AppRegistry } from 'react-native'; | |
import { createStore, applyMiddleware, combineReducers } from 'redux'; | |
import { Provider } from 'react-redux'; | |
import thunk from 'redux-thunk'; | |
import * as reducers from './reducers'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// note: | |
// this code was taken almost as-is from the example project in react-native-controllers/index.ios.js | |
// sorry for mixing es5 and es6 syntax, but it should be very easy to upgrade the syntax here to es6 | |
var Controllers = require('react-native-controllers'); | |
// it's a good idea to separate all react-native-controllers specific code to a single separate file | |
// because we have a special React instance in this file | |
var React = Controllers.hijackReact(); | |
var { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import React, { Component } from 'react'; | |
import { Text, View, Dimensions } from 'react-native'; | |
import RecyclingListView from './RecyclingListView'; | |
const ROWS_IN_DATA_SOURCE = 3000; | |
const dataSource = []; | |
for (let i=0; i<ROWS_IN_DATA_SOURCE; i++) dataSource.push(`This is the data for row # ${i+1}`); | |
export default class RecyclingExample extends Component { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "RNTableViewManager.h" | |
#import "RNTableView.h" | |
@implementation RNTableViewManager | |
RCT_EXPORT_MODULE() | |
- (UIView *)view | |
{ | |
return [[RNTableView alloc] initWithBridge:self.bridge]; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#import "RNTableView.h" | |
#import "RCTConvert.h" | |
#import "RCTEventDispatcher.h" | |
#import "RCTUtils.h" | |
#import "UIView+React.h" | |
@interface RNTableView()<UITableViewDataSource, UITableViewDelegate> | |
@property (strong, nonatomic) UITableView *tableView; | |
@end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)atIndex { | |
// will not add them as subviews yet because we don't need to draw them | |
// [super insertSubview:subview atIndex:atIndex]; | |
[_unusedCells addObject:subview]; | |
} | |
- (UIView*) getUnusedCell { | |
UIView* res = [_unusedCells lastObject]; | |
[_unusedCells removeLastObject]; | |
if (res != nil) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// this is finally the full implementation of this function, all missing pieces filled in | |
- (UITableViewCell *)tableView:(UITableView *)theTableView cellForRowAtIndexPath:(NSIndexPath *)indexPath | |
{ | |
static NSString *cellIdentifier = @"CustomCell"; | |
TableViewCell *cell = (TableViewCell *)[theTableView dequeueReusableCellWithIdentifier:cellIdentifier]; | |
if (cell == nil) { | |
cell = [[TableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellIdentifier]; | |
cell.cellView = [self getUnusedCell]; | |
NSLog(@"Allocated childIndex %d for row %d", (int)cell.cellView.tag, (int)indexPath.row); |
OlderNewer