├── screen-shot.gif ├── .gitmodules ├── DropRefreshControl.h ├── DropRefreshControl.xcodeproj ├── project.xcworkspace │ ├── contents.xcworkspacedata │ ├── xcuserdata │ │ ├── oboo_chin.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ │ └── shuangzuan.xcuserdatad │ │ │ └── UserInterfaceState.xcuserstate │ └── xcshareddata │ │ ├── DropRefreshControl.xcscmblueprint │ │ ├── RCTRefreshControl.xcscmblueprint │ │ └── RCTRefreshControl.xccheckout ├── xcuserdata │ ├── seven.xcuserdatad │ │ └── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ └── RCTRefreshControl.xcscheme │ ├── oboo_chin.xcuserdatad │ │ └── xcschemes │ │ │ ├── xcschememanagement.plist │ │ │ └── RCTRefreshControl.xcscheme │ └── shuangzuan.xcuserdatad │ │ └── xcschemes │ │ ├── xcschememanagement.plist │ │ └── RCTRefreshControl.xcscheme └── project.pbxproj ├── DropRefreshControl.android.js ├── package.json ├── DropRefreshControl.ios.js ├── README.md └── DropRefreshControl.m /screen-shot.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/react-native-china/react-native-drop-refresh/HEAD/screen-shot.gif -------------------------------------------------------------------------------- /.gitmodules: -------------------------------------------------------------------------------- 1 | [submodule "ODRefreshControl"] 2 | path = ODRefreshControl 3 | url = https://github.com/Sephiroth87/ODRefreshControl.git 4 | -------------------------------------------------------------------------------- /DropRefreshControl.h: -------------------------------------------------------------------------------- 1 | #import 2 | 3 | @interface DropRefreshControl : NSObject 4 | 5 | @end 6 | -------------------------------------------------------------------------------- /DropRefreshControl.xcodeproj/project.xcworkspace/contents.xcworkspacedata: -------------------------------------------------------------------------------- 1 | 2 | 4 | 6 | 7 | 8 | -------------------------------------------------------------------------------- /DropRefreshControl.xcodeproj/project.xcworkspace/xcuserdata/oboo_chin.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/react-native-china/react-native-drop-refresh/HEAD/DropRefreshControl.xcodeproj/project.xcworkspace/xcuserdata/oboo_chin.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DropRefreshControl.xcodeproj/project.xcworkspace/xcuserdata/shuangzuan.xcuserdatad/UserInterfaceState.xcuserstate: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/react-native-china/react-native-drop-refresh/HEAD/DropRefreshControl.xcodeproj/project.xcworkspace/xcuserdata/shuangzuan.xcuserdatad/UserInterfaceState.xcuserstate -------------------------------------------------------------------------------- /DropRefreshControl.android.js: -------------------------------------------------------------------------------- 1 | /** 2 | * Stub of RCTRefreshControl for Android. 3 | * 4 | * @providesModule RCTRefreshControl 5 | * @flow 6 | */ 7 | 'use strict'; 8 | 9 | var warning = require('warning'); 10 | 11 | var RCTRefreshControl = { 12 | test: function() { 13 | warning("Not yet implemented for Android."); 14 | } 15 | }; 16 | 17 | export default RCTRefreshControl; 18 | -------------------------------------------------------------------------------- /DropRefreshControl.xcodeproj/xcuserdata/seven.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RCTRefreshControl.xcscheme 8 | 9 | orderHint 10 | 12 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 58B511DA1A9E6C8500147676 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /DropRefreshControl.xcodeproj/xcuserdata/oboo_chin.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RCTRefreshControl.xcscheme 8 | 9 | orderHint 10 | 0 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 58B511DA1A9E6C8500147676 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /DropRefreshControl.xcodeproj/xcuserdata/shuangzuan.xcuserdatad/xcschemes/xcschememanagement.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | SchemeUserState 6 | 7 | RCTRefreshControl.xcscheme 8 | 9 | orderHint 10 | 2 11 | 12 | 13 | SuppressBuildableAutocreation 14 | 15 | 58B511DA1A9E6C8500147676 16 | 17 | primary 18 | 19 | 20 | 21 | 22 | 23 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-drop-refresh", 3 | "description": "A pull down to refresh control for react native.", 4 | "version": "2.2.0", 5 | "keywords": [ 6 | "react-component", 7 | "react-native", 8 | "ios", 9 | "refresh", 10 | "control", 11 | "pull", 12 | "drop" 13 | ], 14 | "license": "MIT", 15 | "main": "DropRefreshControl.ios.js", 16 | "repository": { 17 | "type": "git", 18 | "url": "git+ssh://git@github.com/Obooman/RCTRefreshControl.git" 19 | }, 20 | "author": "Shuangzuan", 21 | "maintainers": [ 22 | "ObooChin " 23 | ], 24 | "bugs": { 25 | "url": "https://github.com/Obooman/RCTRefreshControl/issues" 26 | }, 27 | "homepage": "https://github.com/Obooman/RCTRefreshControl#readme", 28 | "scripts": { 29 | "test": "echo \"Error: no test specified\" && exit 1" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /DropRefreshControl.ios.js: -------------------------------------------------------------------------------- 1 | /** 2 | * @providesModule RCTRefreshControl 3 | * @flow 4 | */ 5 | 6 | import React from 'react'; 7 | import { 8 | DeviceEventEmitter, 9 | NativeModules: { 10 | DropRefreshControl, 11 | }, 12 | processColor 13 | } from 'react-native'; 14 | 15 | /** 16 | * A pull down to refresh control like the one in Apple's iOS6 Mail App. 17 | */ 18 | 19 | var DROP_VIEW_DID_BEGIN_REFRESHING_EVENT = 'dropViewDidBeginRefreshing'; 20 | 21 | var callbacks = {}; 22 | 23 | var subscription = DeviceEventEmitter.addListener( 24 | DROP_VIEW_DID_BEGIN_REFRESHING_EVENT, 25 | (reactTag) => callbacks[reactTag]() 26 | ); 27 | // subscription.remove(); 28 | 29 | var RCTRefreshControl = { 30 | configure: function(configs, callback) { 31 | var nodeHandle = React.findNodeHandle(configs.node); 32 | var options = { 33 | tintColor: processColor(configs.tintColor), 34 | activityIndicatorViewColor: processColor(configs.activityIndicatorViewColor) 35 | }; 36 | 37 | DropRefreshControl.configure(nodeHandle, options, (error) => { 38 | if (!error) { 39 | callbacks[nodeHandle] = callback; 40 | } 41 | }); 42 | }, 43 | endRefreshing: function(node) { 44 | var nodeHandle = React.findNodeHandle(node); 45 | DropRefreshControl.endRefreshing(nodeHandle); 46 | } 47 | }; 48 | 49 | export default RCTRefreshControl; 50 | -------------------------------------------------------------------------------- /DropRefreshControl.xcodeproj/project.xcworkspace/xcshareddata/DropRefreshControl.xcscmblueprint: -------------------------------------------------------------------------------- 1 | { 2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "0BCE712030F8A42B334E9CFA6081352FDFF54C76", 3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { 4 | 5 | }, 6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { 7 | "0BCE712030F8A42B334E9CFA6081352FDFF54C76" : 0, 8 | "C18D10292567FB7B676BADDDA11BE939E2AEEC91" : 0 9 | }, 10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "45E2E111-2734-4F50-AE54-0F5C7A05CE2B", 11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { 12 | "0BCE712030F8A42B334E9CFA6081352FDFF54C76" : "RCTRefreshControl\/", 13 | "C18D10292567FB7B676BADDDA11BE939E2AEEC91" : "RCTRefreshControl\/ODRefreshControl\/" 14 | }, 15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "DropRefreshControl", 16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204, 17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "DropRefreshControl.xcodeproj", 18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ 19 | { 20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "github.com:Obooman\/RCTRefreshControl.git", 21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "0BCE712030F8A42B334E9CFA6081352FDFF54C76" 23 | }, 24 | { 25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/Sephiroth87\/ODRefreshControl.git", 26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "C18D10292567FB7B676BADDDA11BE939E2AEEC91" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /DropRefreshControl.xcodeproj/project.xcworkspace/xcshareddata/RCTRefreshControl.xcscmblueprint: -------------------------------------------------------------------------------- 1 | { 2 | "DVTSourceControlWorkspaceBlueprintPrimaryRemoteRepositoryKey" : "0BCE712030F8A42B334E9CFA6081352FDFF54C76", 3 | "DVTSourceControlWorkspaceBlueprintWorkingCopyRepositoryLocationsKey" : { 4 | 5 | }, 6 | "DVTSourceControlWorkspaceBlueprintWorkingCopyStatesKey" : { 7 | "0BCE712030F8A42B334E9CFA6081352FDFF54C76" : 0, 8 | "C18D10292567FB7B676BADDDA11BE939E2AEEC91" : 0 9 | }, 10 | "DVTSourceControlWorkspaceBlueprintIdentifierKey" : "E012B9D7-9FDC-4199-9F5C-14C5739CB029", 11 | "DVTSourceControlWorkspaceBlueprintWorkingCopyPathsKey" : { 12 | "0BCE712030F8A42B334E9CFA6081352FDFF54C76" : "RCTRefreshControl", 13 | "C18D10292567FB7B676BADDDA11BE939E2AEEC91" : "RCTRefreshControl\/ODRefreshControl" 14 | }, 15 | "DVTSourceControlWorkspaceBlueprintNameKey" : "RCTRefreshControl", 16 | "DVTSourceControlWorkspaceBlueprintVersion" : 204, 17 | "DVTSourceControlWorkspaceBlueprintRelativePathToProjectKey" : "RCTRefreshControl.xcodeproj", 18 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoriesKey" : [ 19 | { 20 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/Shuangzuan\/RCTRefreshControl.git", 21 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 22 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "0BCE712030F8A42B334E9CFA6081352FDFF54C76" 23 | }, 24 | { 25 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryURLKey" : "https:\/\/github.com\/Sephiroth87\/ODRefreshControl.git", 26 | "DVTSourceControlWorkspaceBlueprintRemoteRepositorySystemKey" : "com.apple.dt.Xcode.sourcecontrol.Git", 27 | "DVTSourceControlWorkspaceBlueprintRemoteRepositoryIdentifierKey" : "C18D10292567FB7B676BADDDA11BE939E2AEEC91" 28 | } 29 | ] 30 | } -------------------------------------------------------------------------------- /DropRefreshControl.xcodeproj/project.xcworkspace/xcshareddata/RCTRefreshControl.xccheckout: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | IDESourceControlProjectFavoriteDictionaryKey 6 | 7 | IDESourceControlProjectIdentifier 8 | E012B9D7-9FDC-4199-9F5C-14C5739CB029 9 | IDESourceControlProjectName 10 | RCTRefreshControl 11 | IDESourceControlProjectOriginsDictionary 12 | 13 | 0BCE712030F8A42B334E9CFA6081352FDFF54C76 14 | https://github.com/Shuangzuan/RCTRefreshControl.git 15 | C18D10292567FB7B676BADDDA11BE939E2AEEC91 16 | https://github.com/Sephiroth87/ODRefreshControl.git 17 | 18 | IDESourceControlProjectPath 19 | RCTRefreshControl.xcodeproj 20 | IDESourceControlProjectRelativeInstallPathDictionary 21 | 22 | 0BCE712030F8A42B334E9CFA6081352FDFF54C76 23 | ../.. 24 | C18D10292567FB7B676BADDDA11BE939E2AEEC91 25 | ../../ODRefreshControl/ 26 | 27 | IDESourceControlProjectURL 28 | https://github.com/Shuangzuan/RCTRefreshControl.git 29 | IDESourceControlProjectVersion 30 | 111 31 | IDESourceControlProjectWCCIdentifier 32 | 0BCE712030F8A42B334E9CFA6081352FDFF54C76 33 | IDESourceControlProjectWCConfigurations 34 | 35 | 36 | IDESourceControlRepositoryExtensionIdentifierKey 37 | public.vcs.git 38 | IDESourceControlWCCIdentifierKey 39 | C18D10292567FB7B676BADDDA11BE939E2AEEC91 40 | IDESourceControlWCCName 41 | ODRefreshControl 42 | 43 | 44 | IDESourceControlRepositoryExtensionIdentifierKey 45 | public.vcs.git 46 | IDESourceControlWCCIdentifierKey 47 | 0BCE712030F8A42B334E9CFA6081352FDFF54C76 48 | IDESourceControlWCCName 49 | RCTRefreshControl 50 | 51 | 52 | 53 | 54 | -------------------------------------------------------------------------------- /DropRefreshControl.xcodeproj/xcuserdata/seven.xcuserdatad/xcschemes/RCTRefreshControl.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 60 | 61 | 67 | 68 | 69 | 70 | 72 | 73 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /DropRefreshControl.xcodeproj/xcuserdata/shuangzuan.xcuserdatad/xcschemes/RCTRefreshControl.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 42 | 43 | 49 | 50 | 51 | 52 | 53 | 54 | 60 | 61 | 67 | 68 | 69 | 70 | 72 | 73 | 76 | 77 | 78 | -------------------------------------------------------------------------------- /DropRefreshControl.xcodeproj/xcuserdata/oboo_chin.xcuserdatad/xcschemes/RCTRefreshControl.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 24 | 25 | 30 | 31 | 32 | 33 | 34 | 35 | 45 | 46 | 52 | 53 | 54 | 55 | 56 | 57 | 63 | 64 | 70 | 71 | 72 | 73 | 75 | 76 | 79 | 80 | 81 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # react-native-drop-refresh 2 | 3 | A pull down to refresh control for react native. 4 | This is a fork version from [Shuangzuan/RCTRefreshControl](https://github.com/Shuangzuan/RCTRefreshControl). 5 | 6 | Better npm maintainess,issues are welcomed. 7 | 8 | [![NPM](https://nodei.co/npm/react-native-drop-refresh.png)](https://nodei.co/npm/react-native-drop-refresh/) 9 | [![NPM](https://nodei.co/npm-dl/react-native-drop-refresh.png?months=9)](https://nodei.co/npm/react-native-drop-refresh/) 10 | 11 | ####Update 2.2.0 12 | Support react-native 0.40.0, change CMD to ES6 syntax. 13 | 14 | ####Update 2.1.0 15 | Support react-native 0.20.0, solve module name collsion issue. 16 | 17 | ## Screen Shot 18 | 19 | ![Screen Shot](screen-shot.gif) 20 | 21 | ## Installation 22 | 23 | 1. Run `npm install react-native-drop-refresh --save` in your project directory. 24 | 2. Run `react-native link` to link the lib up. 25 | 3. Add `import DropRefreshControl from 'react-native-drop-refresh';` to your code. 26 | 27 | ## Usage 28 | 29 | ```javascript 30 | import React, { Component } from 'react'; 31 | import DropRefreshControl from 'react-native-drop-refresh'; 32 | 33 | import { 34 | AppRegistry, 35 | ListView, 36 | ScrollView, 37 | StyleSheet, 38 | Text, 39 | View 40 | } from 'react-native'; 41 | 42 | var SCROLLVIEW = 'ScrollView'; 43 | var LISTVIEW = 'ListView'; 44 | 45 | class RCTRefreshControlDemo extends Component{ 46 | constructor(){ 47 | var ds = new ListView.DataSource({rowHasChanged: (r1, r2) => r1 !== r2}); 48 | this.state = { 49 | dataSource: ds.cloneWithRows(['#484848', '#2F9C0A', '#05A5D1']), 50 | } 51 | } 52 | 53 | componentDidMount() { 54 | // ScrollView 55 | DropRefreshControl.configure({ 56 | node: this.refs[SCROLLVIEW], 57 | tintColor: '#05A5D1', 58 | activityIndicatorViewColor: '#05A5D1' 59 | }, () => { 60 | setTimeout(() => { 61 | DropRefreshControl.endRefreshing(this.refs[SCROLLVIEW]); 62 | }, 2000); 63 | }); 64 | 65 | // ListView 66 | DropRefreshControl.configure({ 67 | node: this.refs[LISTVIEW] 68 | }, () => { 69 | setTimeout(() => { 70 | DropRefreshControl.endRefreshing(this.refs[LISTVIEW]); 71 | }, 2000); 72 | }); 73 | } 74 | 75 | render() { 76 | return ( 77 | 78 | 79 | 80 | 81 | 82 | 83 | 84 | { 89 | var color = rowData; 90 | return ( 91 | 92 | ); 93 | }} 94 | /> 95 | 96 | ); 97 | } 98 | }; 99 | 100 | var styles = StyleSheet.create({ 101 | container: { 102 | flex: 1, 103 | flexDirection: 'row' 104 | } 105 | }); 106 | 107 | AppRegistry.registerComponent('DropRefreshControlDemo', () => DropRefreshControlDemo); 108 | // use `export default DropRefreshControlDemo` instead to use this as an component; 109 | ``` 110 | 111 | --- 112 | 113 | ## License 114 | 115 | Available under the MIT license. See the LICENSE file for more informatiion. 116 | -------------------------------------------------------------------------------- /DropRefreshControl.m: -------------------------------------------------------------------------------- 1 | #import "DropRefreshControl.h" 2 | 3 | #import "ODRefreshControl.h" 4 | 5 | #import 6 | #import 7 | #import 8 | #import 9 | #import 10 | 11 | @implementation DropRefreshControl 12 | 13 | #pragma mark - 14 | 15 | @synthesize bridge = _bridge; 16 | 17 | RCT_EXPORT_MODULE() 18 | 19 | - (dispatch_queue_t)methodQueue { 20 | return self.bridge.uiManager.methodQueue; 21 | } 22 | 23 | RCT_EXPORT_METHOD(configure:(nonnull NSNumber *)reactTag 24 | options:(NSDictionary *)options 25 | callback:(RCTResponseSenderBlock)callback) { 26 | [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { 27 | 28 | UIView *view = viewRegistry[reactTag]; 29 | if (!view) { 30 | RCTLogError(@"Cannot find view with tag #%@", reactTag); 31 | return; 32 | } 33 | 34 | UIScrollView *scrollView = ((RCTScrollView *)view).scrollView; 35 | 36 | ODRefreshControl *refreshControl = [[ODRefreshControl alloc] initInScrollView:scrollView]; 37 | refreshControl.tag = [reactTag integerValue]; // Maybe something better 38 | 39 | UIColor *tintColor = options[@"tintColor"]; 40 | // TODO: activityIndicatorViewStyle 41 | UIColor *activityIndicatorViewColor = options[@"activityIndicatorViewColor"]; 42 | 43 | if (tintColor) refreshControl.tintColor = [RCTConvert UIColor:tintColor]; 44 | if (activityIndicatorViewColor) refreshControl.activityIndicatorViewColor = [RCTConvert UIColor:activityIndicatorViewColor]; 45 | 46 | [refreshControl addTarget:self action:@selector(dropViewDidBeginRefreshing:) forControlEvents:UIControlEventValueChanged]; 47 | 48 | callback(@[[NSNull null], reactTag]); 49 | }]; 50 | } 51 | 52 | RCT_EXPORT_METHOD(beginRefreshing:(nonnull NSNumber *)reactTag) { 53 | [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { 54 | 55 | UIView *view = viewRegistry[reactTag]; 56 | if (!view) { 57 | RCTLogError(@"Cannot find view with tag #%@", reactTag); 58 | return; 59 | } 60 | 61 | UIScrollView *scrollView = ((RCTScrollView *)view).scrollView; 62 | 63 | ODRefreshControl *refreshControl = (ODRefreshControl *)[scrollView viewWithTag:[reactTag integerValue]]; 64 | 65 | dispatch_async(dispatch_get_main_queue(), ^{ 66 | [refreshControl beginRefreshing]; 67 | }); 68 | }]; 69 | } 70 | 71 | RCT_EXPORT_METHOD(endRefreshing:(nonnull NSNumber *)reactTag) { 72 | [self.bridge.uiManager addUIBlock:^(RCTUIManager *uiManager, NSDictionary *viewRegistry) { 73 | 74 | UIView *view = viewRegistry[reactTag]; 75 | if (!view) { 76 | RCTLogError(@"Cannot find view with tag #%@", reactTag); 77 | return; 78 | } 79 | 80 | UIScrollView *scrollView = ((RCTScrollView *)view).scrollView; 81 | 82 | ODRefreshControl *refreshControl = (ODRefreshControl *)[scrollView viewWithTag:[reactTag integerValue]]; 83 | 84 | dispatch_async(dispatch_get_main_queue(), ^{ 85 | [refreshControl endRefreshing]; 86 | }); 87 | }]; 88 | } 89 | 90 | - (NSDictionary *)constantsToExport { 91 | return @{@"UIActivityIndicatorViewStyleWhiteLarge": @(UIActivityIndicatorViewStyleWhiteLarge), 92 | @"UIActivityIndicatorViewStyleWhite": @(UIActivityIndicatorViewStyleWhite), 93 | @"UIActivityIndicatorViewStyleGray": @(UIActivityIndicatorViewStyleGray)}; 94 | } 95 | 96 | - (void)dropViewDidBeginRefreshing:(ODRefreshControl *)refreshControl { 97 | [self.bridge.eventDispatcher sendDeviceEventWithName:@"dropViewDidBeginRefreshing" 98 | body:@(refreshControl.tag)]; 99 | 100 | /* 101 | double delayInSeconds = 3.0; 102 | dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); 103 | dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ 104 | [refreshControl endRefreshing]; 105 | }); */ 106 | } 107 | 108 | @end 109 | -------------------------------------------------------------------------------- /DropRefreshControl.xcodeproj/project.pbxproj: -------------------------------------------------------------------------------- 1 | // !$*UTF8*$! 2 | { 3 | archiveVersion = 1; 4 | classes = { 5 | }; 6 | objectVersion = 46; 7 | objects = { 8 | 9 | /* Begin PBXBuildFile section */ 10 | 14C16EF51B16176C00BB689B /* ODRefreshControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 14C16EF41B16176C00BB689B /* ODRefreshControl.m */; }; 11 | 68027C581CE430220061B053 /* DropRefreshControl.m in Sources */ = {isa = PBXBuildFile; fileRef = 68027C571CE430220061B053 /* DropRefreshControl.m */; }; 12 | /* End PBXBuildFile section */ 13 | 14 | /* Begin PBXCopyFilesBuildPhase section */ 15 | 58B511D91A9E6C8500147676 /* CopyFiles */ = { 16 | isa = PBXCopyFilesBuildPhase; 17 | buildActionMask = 2147483647; 18 | dstPath = "include/$(PRODUCT_NAME)"; 19 | dstSubfolderSpec = 16; 20 | files = ( 21 | ); 22 | runOnlyForDeploymentPostprocessing = 0; 23 | }; 24 | /* End PBXCopyFilesBuildPhase section */ 25 | 26 | /* Begin PBXFileReference section */ 27 | 134814201AA4EA6300B7C361 /* libDropRefreshControl.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libDropRefreshControl.a; sourceTree = BUILT_PRODUCTS_DIR; }; 28 | 14C16EF31B16176C00BB689B /* ODRefreshControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ODRefreshControl.h; sourceTree = ""; }; 29 | 14C16EF41B16176C00BB689B /* ODRefreshControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ODRefreshControl.m; sourceTree = ""; }; 30 | 68027C561CE430220061B053 /* DropRefreshControl.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DropRefreshControl.h; sourceTree = ""; }; 31 | 68027C571CE430220061B053 /* DropRefreshControl.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = DropRefreshControl.m; sourceTree = ""; }; 32 | /* End PBXFileReference section */ 33 | 34 | /* Begin PBXFrameworksBuildPhase section */ 35 | 58B511D81A9E6C8500147676 /* Frameworks */ = { 36 | isa = PBXFrameworksBuildPhase; 37 | buildActionMask = 2147483647; 38 | files = ( 39 | ); 40 | runOnlyForDeploymentPostprocessing = 0; 41 | }; 42 | /* End PBXFrameworksBuildPhase section */ 43 | 44 | /* Begin PBXGroup section */ 45 | 134814211AA4EA7D00B7C361 /* Products */ = { 46 | isa = PBXGroup; 47 | children = ( 48 | 134814201AA4EA6300B7C361 /* libDropRefreshControl.a */, 49 | ); 50 | name = Products; 51 | sourceTree = ""; 52 | }; 53 | 14C16EF21B16176C00BB689B /* ODRefreshControl */ = { 54 | isa = PBXGroup; 55 | children = ( 56 | 14C16EF31B16176C00BB689B /* ODRefreshControl.h */, 57 | 14C16EF41B16176C00BB689B /* ODRefreshControl.m */, 58 | ); 59 | name = ODRefreshControl; 60 | path = ODRefreshControl/ODRefreshControl; 61 | sourceTree = ""; 62 | }; 63 | 58B511D21A9E6C8500147676 = { 64 | isa = PBXGroup; 65 | children = ( 66 | 68027C561CE430220061B053 /* DropRefreshControl.h */, 67 | 68027C571CE430220061B053 /* DropRefreshControl.m */, 68 | 14C16EF21B16176C00BB689B /* ODRefreshControl */, 69 | 134814211AA4EA7D00B7C361 /* Products */, 70 | ); 71 | sourceTree = ""; 72 | }; 73 | /* End PBXGroup section */ 74 | 75 | /* Begin PBXNativeTarget section */ 76 | 58B511DA1A9E6C8500147676 /* DropRefreshControl */ = { 77 | isa = PBXNativeTarget; 78 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "DropRefreshControl" */; 79 | buildPhases = ( 80 | 58B511D71A9E6C8500147676 /* Sources */, 81 | 58B511D81A9E6C8500147676 /* Frameworks */, 82 | 58B511D91A9E6C8500147676 /* CopyFiles */, 83 | ); 84 | buildRules = ( 85 | ); 86 | dependencies = ( 87 | ); 88 | name = DropRefreshControl; 89 | productName = RCTDataManager; 90 | productReference = 134814201AA4EA6300B7C361 /* libDropRefreshControl.a */; 91 | productType = "com.apple.product-type.library.static"; 92 | }; 93 | /* End PBXNativeTarget section */ 94 | 95 | /* Begin PBXProject section */ 96 | 58B511D31A9E6C8500147676 /* Project object */ = { 97 | isa = PBXProject; 98 | attributes = { 99 | LastUpgradeCheck = 0610; 100 | ORGANIZATIONNAME = Facebook; 101 | TargetAttributes = { 102 | 58B511DA1A9E6C8500147676 = { 103 | CreatedOnToolsVersion = 6.1.1; 104 | }; 105 | }; 106 | }; 107 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "DropRefreshControl" */; 108 | compatibilityVersion = "Xcode 3.2"; 109 | developmentRegion = English; 110 | hasScannedForEncodings = 0; 111 | knownRegions = ( 112 | en, 113 | ); 114 | mainGroup = 58B511D21A9E6C8500147676; 115 | productRefGroup = 58B511D21A9E6C8500147676; 116 | projectDirPath = ""; 117 | projectRoot = ""; 118 | targets = ( 119 | 58B511DA1A9E6C8500147676 /* DropRefreshControl */, 120 | ); 121 | }; 122 | /* End PBXProject section */ 123 | 124 | /* Begin PBXSourcesBuildPhase section */ 125 | 58B511D71A9E6C8500147676 /* Sources */ = { 126 | isa = PBXSourcesBuildPhase; 127 | buildActionMask = 2147483647; 128 | files = ( 129 | 68027C581CE430220061B053 /* DropRefreshControl.m in Sources */, 130 | 14C16EF51B16176C00BB689B /* ODRefreshControl.m in Sources */, 131 | ); 132 | runOnlyForDeploymentPostprocessing = 0; 133 | }; 134 | /* End PBXSourcesBuildPhase section */ 135 | 136 | /* Begin XCBuildConfiguration section */ 137 | 58B511ED1A9E6C8500147676 /* Debug */ = { 138 | isa = XCBuildConfiguration; 139 | buildSettings = { 140 | ALWAYS_SEARCH_USER_PATHS = NO; 141 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 142 | CLANG_CXX_LIBRARY = "libc++"; 143 | CLANG_ENABLE_MODULES = YES; 144 | CLANG_ENABLE_OBJC_ARC = YES; 145 | CLANG_WARN_BOOL_CONVERSION = YES; 146 | CLANG_WARN_CONSTANT_CONVERSION = YES; 147 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 148 | CLANG_WARN_EMPTY_BODY = YES; 149 | CLANG_WARN_ENUM_CONVERSION = YES; 150 | CLANG_WARN_INT_CONVERSION = YES; 151 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 152 | CLANG_WARN_UNREACHABLE_CODE = YES; 153 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 154 | COPY_PHASE_STRIP = NO; 155 | ENABLE_STRICT_OBJC_MSGSEND = YES; 156 | GCC_C_LANGUAGE_STANDARD = gnu99; 157 | GCC_DYNAMIC_NO_PIC = NO; 158 | GCC_OPTIMIZATION_LEVEL = 0; 159 | GCC_PREPROCESSOR_DEFINITIONS = ( 160 | "DEBUG=1", 161 | "$(inherited)", 162 | ); 163 | GCC_SYMBOLS_PRIVATE_EXTERN = NO; 164 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 165 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 166 | GCC_WARN_UNDECLARED_SELECTOR = YES; 167 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 168 | GCC_WARN_UNUSED_FUNCTION = YES; 169 | GCC_WARN_UNUSED_VARIABLE = YES; 170 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 171 | MTL_ENABLE_DEBUG_INFO = YES; 172 | ONLY_ACTIVE_ARCH = YES; 173 | SDKROOT = iphoneos; 174 | }; 175 | name = Debug; 176 | }; 177 | 58B511EE1A9E6C8500147676 /* Release */ = { 178 | isa = XCBuildConfiguration; 179 | buildSettings = { 180 | ALWAYS_SEARCH_USER_PATHS = NO; 181 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x"; 182 | CLANG_CXX_LIBRARY = "libc++"; 183 | CLANG_ENABLE_MODULES = YES; 184 | CLANG_ENABLE_OBJC_ARC = YES; 185 | CLANG_WARN_BOOL_CONVERSION = YES; 186 | CLANG_WARN_CONSTANT_CONVERSION = YES; 187 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR; 188 | CLANG_WARN_EMPTY_BODY = YES; 189 | CLANG_WARN_ENUM_CONVERSION = YES; 190 | CLANG_WARN_INT_CONVERSION = YES; 191 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR; 192 | CLANG_WARN_UNREACHABLE_CODE = YES; 193 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; 194 | COPY_PHASE_STRIP = YES; 195 | ENABLE_NS_ASSERTIONS = NO; 196 | ENABLE_STRICT_OBJC_MSGSEND = YES; 197 | GCC_C_LANGUAGE_STANDARD = gnu99; 198 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES; 199 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR; 200 | GCC_WARN_UNDECLARED_SELECTOR = YES; 201 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE; 202 | GCC_WARN_UNUSED_FUNCTION = YES; 203 | GCC_WARN_UNUSED_VARIABLE = YES; 204 | IPHONEOS_DEPLOYMENT_TARGET = 7.0; 205 | MTL_ENABLE_DEBUG_INFO = NO; 206 | SDKROOT = iphoneos; 207 | VALIDATE_PRODUCT = YES; 208 | }; 209 | name = Release; 210 | }; 211 | 58B511F01A9E6C8500147676 /* Debug */ = { 212 | isa = XCBuildConfiguration; 213 | buildSettings = { 214 | HEADER_SEARCH_PATHS = ( 215 | "$(inherited)", 216 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 217 | "$(SRCROOT)/../../React/**", 218 | "$(SRCROOT)/../../node_modules/react-native/React/**", 219 | ); 220 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 221 | OTHER_LDFLAGS = "-ObjC"; 222 | PRODUCT_NAME = DropRefreshControl; 223 | SKIP_INSTALL = YES; 224 | }; 225 | name = Debug; 226 | }; 227 | 58B511F11A9E6C8500147676 /* Release */ = { 228 | isa = XCBuildConfiguration; 229 | buildSettings = { 230 | HEADER_SEARCH_PATHS = ( 231 | "$(inherited)", 232 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include, 233 | "$(SRCROOT)/../../React/**", 234 | "$(SRCROOT)/../../node_modules/react-native/React/**", 235 | ); 236 | LIBRARY_SEARCH_PATHS = "$(inherited)"; 237 | OTHER_LDFLAGS = "-ObjC"; 238 | PRODUCT_NAME = DropRefreshControl; 239 | SKIP_INSTALL = YES; 240 | }; 241 | name = Release; 242 | }; 243 | /* End XCBuildConfiguration section */ 244 | 245 | /* Begin XCConfigurationList section */ 246 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "DropRefreshControl" */ = { 247 | isa = XCConfigurationList; 248 | buildConfigurations = ( 249 | 58B511ED1A9E6C8500147676 /* Debug */, 250 | 58B511EE1A9E6C8500147676 /* Release */, 251 | ); 252 | defaultConfigurationIsVisible = 0; 253 | defaultConfigurationName = Release; 254 | }; 255 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "DropRefreshControl" */ = { 256 | isa = XCConfigurationList; 257 | buildConfigurations = ( 258 | 58B511F01A9E6C8500147676 /* Debug */, 259 | 58B511F11A9E6C8500147676 /* Release */, 260 | ); 261 | defaultConfigurationIsVisible = 0; 262 | defaultConfigurationName = Release; 263 | }; 264 | /* End XCConfigurationList section */ 265 | }; 266 | rootObject = 58B511D31A9E6C8500147676 /* Project object */; 267 | } 268 | --------------------------------------------------------------------------------