├── .babelrc ├── .flowconfig ├── .gitignore ├── .npmignore ├── HISTORY.md ├── LICENSE ├── README.md ├── dist ├── NativeButton.js ├── index.js └── styles.js ├── example-0.57.1 ├── .babelrc ├── .buckconfig ├── .flowconfig ├── .gitattributes ├── .gitignore ├── .watchmanconfig ├── SwipeoutExample.js ├── android │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── swipeoutexample │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-mdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ ├── mipmap-xxxhdpi │ │ │ ├── ic_launcher.png │ │ │ └── ic_launcher_round.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── keystores │ │ ├── BUCK │ │ └── debug.keystore.properties │ └── settings.gradle ├── app.json ├── data.js ├── index.js ├── ios │ ├── swipeoutExample-tvOS │ │ └── Info.plist │ ├── swipeoutExample-tvOSTests │ │ └── Info.plist │ ├── swipeoutExample.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── swipeoutExample-tvOS.xcscheme │ │ │ └── swipeoutExample.xcscheme │ ├── swipeoutExample │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ ├── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ └── swipeoutExampleTests │ │ ├── Info.plist │ │ └── swipeoutExampleTests.m ├── package.json └── styles.js ├── example ├── .flowconfig ├── .gitignore ├── .npmignore ├── .watchmanconfig ├── SwipeoutExample.js ├── android │ ├── app │ │ ├── BUCK │ │ ├── build.gradle │ │ ├── proguard-rules.pro │ │ └── src │ │ │ └── main │ │ │ ├── AndroidManifest.xml │ │ │ ├── java │ │ │ └── com │ │ │ │ └── swipeoutexample │ │ │ │ ├── MainActivity.java │ │ │ │ └── MainApplication.java │ │ │ └── res │ │ │ ├── mipmap-hdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-mdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xhdpi │ │ │ └── ic_launcher.png │ │ │ ├── mipmap-xxhdpi │ │ │ └── ic_launcher.png │ │ │ └── values │ │ │ ├── strings.xml │ │ │ └── styles.xml │ ├── build.gradle │ ├── gradle.properties │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── gradlew │ ├── gradlew.bat │ ├── keystores │ │ ├── BUCK │ │ └── debug.keystore.properties │ └── settings.gradle ├── app.json ├── data.js ├── index.android.js ├── index.ios.js ├── ios │ ├── swipeoutExample-tvOS │ │ └── Info.plist │ ├── swipeoutExample-tvOSTests │ │ └── Info.plist │ ├── swipeoutExample.xcodeproj │ │ ├── project.pbxproj │ │ └── xcshareddata │ │ │ └── xcschemes │ │ │ ├── swipeoutExample-tvOS.xcscheme │ │ │ └── swipeoutExample.xcscheme │ ├── swipeoutExample │ │ ├── AppDelegate.h │ │ ├── AppDelegate.m │ │ ├── Base.lproj │ │ │ └── LaunchScreen.xib │ │ ├── Images.xcassets │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── Info.plist │ │ └── main.m │ └── swipeoutExampleTests │ │ ├── Info.plist │ │ └── swipeoutExampleTests.m ├── package.json └── styles.js ├── index.d.ts ├── package-lock.json ├── package.json └── src ├── NativeButton.js ├── index.js └── styles.js /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015", "stage-2", "react"] 3 | } 4 | -------------------------------------------------------------------------------- /.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | # We fork some components by platform. 4 | .*/*.web.js 5 | .*/*.android.js 6 | 7 | # Some modules have their own node_modules with overlap 8 | .*/node_modules/node-haste/.* 9 | 10 | # Ugh 11 | .*/node_modules/babel.* 12 | .*/node_modules/babylon.* 13 | .*/node_modules/invariant.* 14 | 15 | # Ignore react and fbjs where there are overlaps, but don't ignore 16 | # anything that react-native relies on 17 | .*/node_modules/fbjs-haste/.*/__tests__/.* 18 | .*/node_modules/fbjs-haste/__forks__/Map.js 19 | .*/node_modules/fbjs-haste/__forks__/Promise.js 20 | .*/node_modules/fbjs-haste/__forks__/fetch.js 21 | .*/node_modules/fbjs-haste/core/ExecutionEnvironment.js 22 | .*/node_modules/fbjs-haste/core/isEmpty.js 23 | .*/node_modules/fbjs-haste/crypto/crc32.js 24 | .*/node_modules/fbjs-haste/stubs/ErrorUtils.js 25 | .*/node_modules/react-haste/React.js 26 | .*/node_modules/react-haste/renderers/dom/ReactDOM.js 27 | .*/node_modules/react-haste/renderers/shared/event/eventPlugins/ResponderEventPlugin.js 28 | 29 | # Ignore commoner tests 30 | .*/node_modules/commoner/test/.* 31 | 32 | # See https://github.com/facebook/flow/issues/442 33 | .*/react-tools/node_modules/commoner/lib/reader.js 34 | 35 | # Ignore jest 36 | .*/node_modules/jest-cli/.* 37 | 38 | # Ignore Website 39 | .*/website/.* 40 | 41 | [include] 42 | 43 | [libs] 44 | node_modules/react-native/Libraries/react-native/react-native-interface.js 45 | 46 | [options] 47 | module.system=haste 48 | 49 | munge_underscores=true 50 | 51 | module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' 52 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.png$' -> 'RelativeImageStub' 53 | 54 | suppress_type=$FlowIssue 55 | suppress_type=$FlowFixMe 56 | suppress_type=$FixMe 57 | 58 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 59 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)? #[0-9]+ 60 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 61 | 62 | [version] 63 | 0.19.0 64 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | lib 25 | # Android/IJ 26 | # 27 | .idea 28 | .gradle 29 | local.properties 30 | 31 | # node.js 32 | # 33 | node_modules/ 34 | npm-debug.log 35 | yarn.lock 36 | example/ios/ip.txt 37 | -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | example 2 | index.android.js 3 | .babelrc -------------------------------------------------------------------------------- /HISTORY.md: -------------------------------------------------------------------------------- 1 | # History 2 | 3 | # 2.2.2 4 | 5 | - fix: support old version react-native, support both `View.propTypes` and `ViewPropTypes` 6 | 7 | # 2.2.1 8 | 9 | - fix: add missing `prop-types` `create-react-class` 10 | 11 | # 2.2.0 12 | 13 | - feature: swipe menu manual open, add `openLeft/openRight` properties. (https://github.com/dancormier/react-native-swipeout/pull/161) 14 | 15 | # 2.1.5 16 | 17 | - fix: Added missing react import (https://github.com/dancormier/react-native-swipeout/pull/196) 18 | 19 | # 2.1.4 20 | 21 | - improve: Update PropTypes and React.createClass (https://github.com/dancormier/react-native-swipeout/pull/193) 22 | 23 | # 2.1.2 ~ 2.1.3 24 | 25 | - fix: Avoid Wrapping button text. (https://github.com/dancormier/react-native-swipeout/commit/6e7ee3adb6f1fd95bbd057c5ed2850562ae16e1c) 26 | 27 | # * ~ 2.1.1 28 | 29 | - see [commits history](https://github.com/dancormier/react-native-swipeout/commits/master) 30 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | The MIT License (MIT) 2 | 3 | Copyright (c) 2015 Dan Cormier 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # DEPRECATED 2 | this is no longer supported, please consider using https://github.com/software-mansion/react-native-gesture-handler instead. 3 | 4 | # react-native-swipeout 5 | iOS-style swipeout buttons that appear from behind a component 6 | 7 | ![swipeout preview](http://i.imgur.com/oCQLNFC.gif) 8 | 9 | ## Installation 10 | ``` 11 | npm install --save react-native-swipeout 12 | ``` 13 | 14 | ## Usage example 15 | 16 | See example/index.ios.js for a more detailed example. 17 | See the [Wiki](https://github.com/dancormier/react-native-swipeout/wiki) usage tips. 18 | To use swipeout behind a iOS-style listitem, try [react-native-listitem](https://github.com/dancormier/react-native-listitem). 19 | 20 | ```js 21 | import Swipeout from 'react-native-swipeout'; 22 | 23 | // Buttons 24 | var swipeoutBtns = [ 25 | { 26 | text: 'Button' 27 | } 28 | ] 29 | 30 | // Swipeout component 31 | 32 | 33 | Swipe me left 34 | 35 | 36 | 37 | ``` 38 | 39 | ## Props 40 | 41 | Prop | Type | Optional | Default | Description 42 | --------------- | ------ | -------- | --------- | ----------- 43 | autoClose | bool | Yes | false | auto close on button press 44 | backgroundColor | string | Yes | '#dbddde' | 45 | close | bool | Yes | | close swipeout 46 | disabled | bool | Yes | false | whether to disable the swipeout 47 | left | array | Yes | [] | swipeout buttons on left 48 | onOpen | func | Yes | | (sectionID, rowId, direction: string) => void 49 | onClose | func | Yes | | (sectionID, rowId, direction: string) => void 50 | right | array | Yes | [] | swipeout buttons on right 51 | scroll | func | Yes | | prevent parent scroll 52 | style | style | Yes | | style of the container 53 | sensitivity | number | Yes | 50 | change the sensitivity of gesture 54 | buttonWidth | number | Yes | | each button width 55 | 56 | ##### Button props 57 | 58 | Prop | Type | Optional | Default | Description 59 | --------------- | ------ | -------- | --------- | ----------- 60 | backgroundColor | string | Yes | '#b6bec0' | background color 61 | color | string | Yes | '#ffffff' | text color 62 | component | ReactNode | Yes | null | pass custom component to button 63 | onPress | func | Yes | null | function executed onPress 64 | text | string | Yes | 'Click Me'| text 65 | type | string | Yes | 'default' | default, delete, primary, secondary 66 | underlayColor | string | Yes | null | button underlay color on press 67 | disabled | bool | Yes | false | disable button 68 | 69 | ## To Do 70 | 71 | [https://github.com/dancormier/react-native-swipeout/issues](https://github.com/dancormier/react-native-swipeout/issues) 72 | -------------------------------------------------------------------------------- /dist/NativeButton.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; 8 | 9 | var _react = require('react'); 10 | 11 | var _react2 = _interopRequireDefault(_react); 12 | 13 | var _propTypes = require('prop-types'); 14 | 15 | var _propTypes2 = _interopRequireDefault(_propTypes); 16 | 17 | var _createReactClass = require('create-react-class'); 18 | 19 | var _createReactClass2 = _interopRequireDefault(_createReactClass); 20 | 21 | var _reactNative = require('react-native'); 22 | 23 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 24 | 25 | var styles = _reactNative.StyleSheet.create({ 26 | button: { 27 | flexDirection: 'row', 28 | alignSelf: 'stretch', 29 | justifyContent: 'center' 30 | }, 31 | textButton: { 32 | fontSize: 14, 33 | alignSelf: 'center' 34 | }, 35 | opacity: { 36 | opacity: 0.8 37 | } 38 | }); 39 | 40 | var NativeButton = (0, _createReactClass2.default)({ 41 | displayName: 'NativeButton', 42 | 43 | 44 | propTypes: _extends({}, _reactNative.TouchableWithoutFeedback.propTypes, { 45 | textStyle: _propTypes2.default.any, 46 | disabledStyle: _propTypes2.default.any, 47 | children: _propTypes2.default.node.isRequired, 48 | underlayColor: _propTypes2.default.string, 49 | background: _propTypes2.default.any 50 | }), 51 | 52 | statics: { 53 | isAndroid: _reactNative.Platform.OS === 'android' 54 | }, 55 | 56 | getDefaultProps: function getDefaultProps() { 57 | return { 58 | textStyle: null, 59 | disabledStyle: null, 60 | underlayColor: null 61 | }; 62 | }, 63 | 64 | _renderText: function _renderText() { 65 | // If children is not a string don't wrapp it in a Text component 66 | if (typeof this.props.children !== 'string') { 67 | return this.props.children; 68 | } 69 | 70 | return _react2.default.createElement( 71 | _reactNative.Text, 72 | { numberOfLines: 1, ellipsizeMode: _reactNative.Platform.OS === 'ios' ? 'clip' : 'tail', style: [styles.textButton, this.props.textStyle] }, 73 | this.props.children 74 | ); 75 | }, 76 | 77 | render: function render() { 78 | var disabledStyle = this.props.disabled ? this.props.disabledStyle || styles.opacity : {}; 79 | 80 | // Extract Button props 81 | var buttonProps = { 82 | accessibilityComponentType: this.props.accessibilityComponentType, 83 | accessibilityTraits: this.props.accessibilityTraits, 84 | accessible: this.props.accessible, 85 | delayLongPress: this.props.delayLongPress, 86 | delayPressIn: this.props.delayPressIn, 87 | delayPressOut: this.props.delayPressOut, 88 | disabled: this.props.disabled, 89 | hitSlop: this.props.hitSlop, 90 | onLayout: this.props.onLayout, 91 | onPress: this.props.onPress, 92 | onPressIn: this.props.onPressIn, 93 | onPressOut: this.props.onPressOut, 94 | onLongPress: this.props.onLongPress, 95 | pressRetentionOffset: this.props.pressRetentionOffset 96 | }; 97 | 98 | // Render Native Android Button 99 | if (NativeButton.isAndroid) { 100 | buttonProps = Object.assign(buttonProps, { 101 | background: this.props.background || _reactNative.TouchableNativeFeedback.SelectableBackground() 102 | }); 103 | 104 | return _react2.default.createElement( 105 | _reactNative.TouchableNativeFeedback, 106 | buttonProps, 107 | _react2.default.createElement( 108 | _reactNative.View, 109 | { style: [styles.button, this.props.style, disabledStyle] }, 110 | this._renderText() 111 | ) 112 | ); 113 | } 114 | 115 | // Render default button 116 | return _react2.default.createElement( 117 | _reactNative.TouchableHighlight, 118 | _extends({}, buttonProps, { 119 | style: [styles.button, this.props.style, disabledStyle], 120 | underlayColor: this.props.underlayColor }), 121 | this._renderText() 122 | ); 123 | } 124 | }); 125 | 126 | exports.default = NativeButton; -------------------------------------------------------------------------------- /dist/index.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; 8 | 9 | var _reactTweenState = require('react-tween-state'); 10 | 11 | var _reactTweenState2 = _interopRequireDefault(_reactTweenState); 12 | 13 | var _NativeButton = require('./NativeButton'); 14 | 15 | var _NativeButton2 = _interopRequireDefault(_NativeButton); 16 | 17 | var _styles = require('./styles'); 18 | 19 | var _styles2 = _interopRequireDefault(_styles); 20 | 21 | var _react = require('react'); 22 | 23 | var _react2 = _interopRequireDefault(_react); 24 | 25 | var _propTypes = require('prop-types'); 26 | 27 | var _propTypes2 = _interopRequireDefault(_propTypes); 28 | 29 | var _createReactClass = require('create-react-class'); 30 | 31 | var _createReactClass2 = _interopRequireDefault(_createReactClass); 32 | 33 | var _reactNative = require('react-native'); 34 | 35 | function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } 36 | 37 | var SwipeoutBtn = (0, _createReactClass2.default)({ 38 | displayName: 'SwipeoutBtn', 39 | 40 | 41 | propTypes: { 42 | backgroundColor: _propTypes2.default.string, 43 | color: _propTypes2.default.string, 44 | component: _propTypes2.default.node, 45 | onPress: _propTypes2.default.func, 46 | text: _propTypes2.default.node, 47 | type: _propTypes2.default.string, 48 | underlayColor: _propTypes2.default.string 49 | }, 50 | 51 | getDefaultProps: function getDefaultProps() { 52 | return { 53 | backgroundColor: null, 54 | color: null, 55 | component: null, 56 | underlayColor: null, 57 | height: 0, 58 | onPress: null, 59 | disabled: false, 60 | text: 'Click me', 61 | type: '', 62 | width: 0 63 | }; 64 | }, 65 | 66 | render: function render() { 67 | var btn = this.props; 68 | 69 | var styleSwipeoutBtn = [_styles2.default.swipeoutBtn]; 70 | 71 | // apply "type" styles (delete || primary || secondary) 72 | if (btn.type === 'delete') styleSwipeoutBtn.push(_styles2.default.colorDelete);else if (btn.type === 'primary') styleSwipeoutBtn.push(_styles2.default.colorPrimary);else if (btn.type === 'secondary') styleSwipeoutBtn.push(_styles2.default.colorSecondary); 73 | 74 | // apply background color 75 | if (btn.backgroundColor) styleSwipeoutBtn.push([{ backgroundColor: btn.backgroundColor }]); 76 | 77 | styleSwipeoutBtn.push([{ 78 | height: btn.height, 79 | width: btn.width 80 | }]); 81 | 82 | var styleSwipeoutBtnComponent = []; 83 | 84 | // set button dimensions 85 | styleSwipeoutBtnComponent.push([{ 86 | height: btn.height, 87 | width: btn.width 88 | }]); 89 | 90 | var styleSwipeoutBtnText = [_styles2.default.swipeoutBtnText]; 91 | 92 | // apply text color 93 | if (btn.color) styleSwipeoutBtnText.push({ color: btn.color }); 94 | 95 | return _react2.default.createElement( 96 | _NativeButton2.default, 97 | { 98 | onPress: this.props.onPress, 99 | underlayColor: this.props.underlayColor, 100 | disabled: this.props.disabled, 101 | style: [_styles2.default.swipeoutBtnTouchable, styleSwipeoutBtn], 102 | textStyle: styleSwipeoutBtnText }, 103 | btn.component ? _react2.default.createElement( 104 | _reactNative.View, 105 | { style: styleSwipeoutBtnComponent }, 106 | btn.component 107 | ) : btn.text 108 | ); 109 | } 110 | }); 111 | 112 | var Swipeout = (0, _createReactClass2.default)({ 113 | displayName: 'Swipeout', 114 | 115 | mixins: [_reactTweenState2.default.Mixin], 116 | 117 | propTypes: { 118 | autoClose: _propTypes2.default.bool, 119 | backgroundColor: _propTypes2.default.string, 120 | close: _propTypes2.default.bool, 121 | left: _propTypes2.default.array, 122 | onOpen: _propTypes2.default.func, 123 | onClose: _propTypes2.default.func, 124 | right: _propTypes2.default.array, 125 | scroll: _propTypes2.default.func, 126 | style: (_reactNative.ViewPropTypes || _reactNative.View.propTypes).style, 127 | sensitivity: _propTypes2.default.number, 128 | buttonWidth: _propTypes2.default.number, 129 | disabled: _propTypes2.default.bool 130 | }, 131 | 132 | getDefaultProps: function getDefaultProps() { 133 | return { 134 | disabled: false, 135 | rowID: -1, 136 | sectionID: -1, 137 | sensitivity: 50 138 | }; 139 | }, 140 | 141 | getInitialState: function getInitialState() { 142 | return { 143 | autoClose: this.props.autoClose || false, 144 | btnWidth: 0, 145 | btnsLeftWidth: 0, 146 | btnsRightWidth: 0, 147 | contentHeight: 0, 148 | contentPos: 0, 149 | contentWidth: 0, 150 | openedRight: false, 151 | swiping: false, 152 | tweenDuration: 160, 153 | timeStart: null 154 | }; 155 | }, 156 | 157 | componentWillMount: function componentWillMount() { 158 | var _this = this; 159 | 160 | this._panResponder = _reactNative.PanResponder.create({ 161 | onStartShouldSetPanResponder: function onStartShouldSetPanResponder(event, gestureState) { 162 | return true; 163 | }, 164 | onStartShouldSetPanResponderCapture: function onStartShouldSetPanResponderCapture(event, gestureState) { 165 | return _this.state.openedLeft || _this.state.openedRight; 166 | }, 167 | onMoveShouldSetPanResponderCapture: function onMoveShouldSetPanResponderCapture(event, gestureState) { 168 | return Math.abs(gestureState.dx) > _this.props.sensitivity && Math.abs(gestureState.dy) <= _this.props.sensitivity; 169 | }, 170 | onPanResponderGrant: this._handlePanResponderGrant, 171 | onPanResponderMove: this._handlePanResponderMove, 172 | onPanResponderRelease: this._handlePanResponderEnd, 173 | onPanResponderTerminate: this._handlePanResponderEnd, 174 | onShouldBlockNativeResponder: function onShouldBlockNativeResponder(event, gestureState) { 175 | return false; 176 | }, 177 | onPanResponderTerminationRequest: function onPanResponderTerminationRequest() { 178 | return false; 179 | } 180 | }); 181 | }, 182 | 183 | componentWillReceiveProps: function componentWillReceiveProps(nextProps) { 184 | if (nextProps.close) this._close(); 185 | if (nextProps.openRight) this._openRight(); 186 | if (nextProps.openLeft) this._openLeft(); 187 | }, 188 | 189 | _handlePanResponderGrant: function _handlePanResponderGrant(e, gestureState) { 190 | var _this2 = this; 191 | 192 | if (this.props.disabled) return; 193 | if (!this.state.openedLeft && !this.state.openedRight) { 194 | this._callOnOpen(); 195 | } else { 196 | this._callOnClose(); 197 | } 198 | this.refs.swipeoutContent.measure(function (ox, oy, width, height) { 199 | var buttonWidth = _this2.props.buttonWidth || width / 5; 200 | _this2.setState({ 201 | btnWidth: buttonWidth, 202 | btnsLeftWidth: _this2.props.left ? buttonWidth * _this2.props.left.length : 0, 203 | btnsRightWidth: _this2.props.right ? buttonWidth * _this2.props.right.length : 0, 204 | swiping: true, 205 | timeStart: new Date().getTime() 206 | }); 207 | }); 208 | }, 209 | 210 | _handlePanResponderMove: function _handlePanResponderMove(e, gestureState) { 211 | if (this.props.disabled) return; 212 | var posX = gestureState.dx; 213 | var posY = gestureState.dy; 214 | var leftWidth = this.state.btnsLeftWidth; 215 | var rightWidth = this.state.btnsRightWidth; 216 | if (this.state.openedRight) var posX = gestureState.dx - rightWidth;else if (this.state.openedLeft) var posX = gestureState.dx + leftWidth; 217 | 218 | // prevent scroll if moveX is true 219 | var moveX = Math.abs(posX) > Math.abs(posY); 220 | if (this.props.scroll) { 221 | if (moveX) this.props.scroll(false);else this.props.scroll(true); 222 | } 223 | if (this.state.swiping) { 224 | // move content to reveal swipeout 225 | if (posX < 0 && this.props.right) { 226 | this.setState({ contentPos: Math.min(posX, 0) }); 227 | } else if (posX > 0 && this.props.left) { 228 | this.setState({ contentPos: Math.max(posX, 0) }); 229 | }; 230 | } 231 | }, 232 | 233 | _handlePanResponderEnd: function _handlePanResponderEnd(e, gestureState) { 234 | if (this.props.disabled) return; 235 | var posX = gestureState.dx; 236 | var contentPos = this.state.contentPos; 237 | var contentWidth = this.state.contentWidth; 238 | var btnsLeftWidth = this.state.btnsLeftWidth; 239 | var btnsRightWidth = this.state.btnsRightWidth; 240 | 241 | // minimum threshold to open swipeout 242 | var openX = contentWidth * 0.33; 243 | 244 | // should open swipeout 245 | var openLeft = posX > openX || posX > btnsLeftWidth / 2; 246 | var openRight = posX < -openX || posX < -btnsRightWidth / 2; 247 | 248 | // account for open swipeouts 249 | if (this.state.openedRight) var openRight = posX - openX < -openX; 250 | if (this.state.openedLeft) var openLeft = posX + openX > openX; 251 | 252 | // reveal swipeout on quick swipe 253 | var timeDiff = new Date().getTime() - this.state.timeStart < 200; 254 | if (timeDiff) { 255 | var openRight = posX < -openX / 10 && !this.state.openedLeft; 256 | var openLeft = posX > openX / 10 && !this.state.openedRight; 257 | } 258 | 259 | if (this.state.swiping) { 260 | if (openRight && contentPos < 0 && posX < 0) { 261 | this._open(-btnsRightWidth, 'right'); 262 | } else if (openLeft && contentPos > 0 && posX > 0) { 263 | this._open(btnsLeftWidth, 'left'); 264 | } else { 265 | this._close(); 266 | } 267 | } 268 | 269 | // Allow scroll 270 | if (this.props.scroll) this.props.scroll(true); 271 | }, 272 | 273 | _tweenContent: function _tweenContent(state, endValue) { 274 | this.tweenState(state, { 275 | easing: _reactTweenState2.default.easingTypes.easeInOutQuad, 276 | duration: endValue === 0 ? this.state.tweenDuration * 1.5 : this.state.tweenDuration, 277 | endValue: endValue 278 | }); 279 | }, 280 | 281 | _rubberBandEasing: function _rubberBandEasing(value, limit) { 282 | if (value < 0 && value < limit) return limit - Math.pow(limit - value, 0.85);else if (value > 0 && value > limit) return limit + Math.pow(value - limit, 0.85); 283 | return value; 284 | }, 285 | 286 | // close swipeout on button press 287 | _autoClose: function _autoClose(btn) { 288 | if (this.state.autoClose) this._close(); 289 | var onPress = btn.onPress; 290 | if (onPress) onPress(); 291 | }, 292 | 293 | _open: function _open(contentPos, direction) { 294 | var left = direction === 'left'; 295 | var _props = this.props, 296 | sectionID = _props.sectionID, 297 | rowID = _props.rowID, 298 | onOpen = _props.onOpen; 299 | 300 | onOpen && onOpen(sectionID, rowID, direction); 301 | this._tweenContent('contentPos', contentPos); 302 | this.setState({ 303 | contentPos: contentPos, 304 | openedLeft: left, 305 | openedRight: !left, 306 | swiping: false 307 | }); 308 | }, 309 | 310 | _close: function _close() { 311 | var _props2 = this.props, 312 | sectionID = _props2.sectionID, 313 | rowID = _props2.rowID, 314 | onClose = _props2.onClose; 315 | 316 | if (onClose && (this.state.openedLeft || this.state.openedRight)) { 317 | var direction = this.state.openedRight ? 'right' : 'left'; 318 | onClose(sectionID, rowID, direction); 319 | } 320 | this._tweenContent('contentPos', 0); 321 | this._callOnClose(); 322 | this.setState({ 323 | openedRight: false, 324 | openedLeft: false, 325 | swiping: false 326 | }); 327 | }, 328 | 329 | _callOnClose: function _callOnClose() { 330 | if (this.props.onClose) this.props.onClose(this.props.sectionID, this.props.rowID); 331 | }, 332 | 333 | _callOnOpen: function _callOnOpen() { 334 | if (this.props.onOpen) this.props.onOpen(this.props.sectionID, this.props.rowID); 335 | }, 336 | 337 | _openRight: function _openRight() { 338 | var _this3 = this; 339 | 340 | this.refs.swipeoutContent.measure(function (ox, oy, width, height) { 341 | var btnWidth = _this3.props.buttonWidth || width / 5; 342 | 343 | _this3.setState({ 344 | btnWidth: btnWidth, 345 | btnsRightWidth: _this3.props.right ? btnWidth * _this3.props.right.length : 0 346 | }, function () { 347 | _this3._tweenContent('contentPos', -_this3.state.btnsRightWidth); 348 | _this3._callOnOpen(); 349 | _this3.setState({ 350 | contentPos: -_this3.state.btnsRightWidth, 351 | openedLeft: false, 352 | openedRight: true, 353 | swiping: false 354 | }); 355 | }); 356 | }); 357 | }, 358 | 359 | _openLeft: function _openLeft() { 360 | var _this4 = this; 361 | 362 | this.refs.swipeoutContent.measure(function (ox, oy, width, height) { 363 | var btnWidth = _this4.props.buttonWidth || width / 5; 364 | 365 | _this4.setState({ 366 | btnWidth: btnWidth, 367 | btnsLeftWidth: _this4.props.left ? btnWidth * _this4.props.left.length : 0 368 | }, function () { 369 | _this4._tweenContent('contentPos', _this4.state.btnsLeftWidth); 370 | _this4._callOnOpen(); 371 | _this4.setState({ 372 | contentPos: _this4.state.btnsLeftWidth, 373 | openedLeft: true, 374 | openedRight: false, 375 | swiping: false 376 | }); 377 | }); 378 | }); 379 | }, 380 | 381 | render: function render() { 382 | var contentWidth = this.state.contentWidth; 383 | var posX = this.getTweeningValue('contentPos'); 384 | 385 | var styleSwipeout = [_styles2.default.swipeout, this.props.style]; 386 | if (this.props.backgroundColor) { 387 | styleSwipeout.push([{ backgroundColor: this.props.backgroundColor }]); 388 | } 389 | 390 | var limit = -this.state.btnsRightWidth; 391 | if (posX > 0) var limit = this.state.btnsLeftWidth; 392 | 393 | var styleLeftPos = { 394 | left: { 395 | left: 0, 396 | overflow: 'hidden', 397 | width: Math.min(limit * (posX / limit), limit) 398 | } 399 | }; 400 | var styleRightPos = { 401 | right: { 402 | left: Math.abs(contentWidth + Math.max(limit, posX)), 403 | right: 0 404 | } 405 | }; 406 | var styleContentPos = { 407 | content: { 408 | transform: [{ translateX: this._rubberBandEasing(posX, limit) }] 409 | } 410 | }; 411 | 412 | var styleContent = [_styles2.default.swipeoutContent]; 413 | styleContent.push(styleContentPos.content); 414 | 415 | var styleRight = [_styles2.default.swipeoutBtns]; 416 | styleRight.push(styleRightPos.right); 417 | 418 | var styleLeft = [_styles2.default.swipeoutBtns]; 419 | styleLeft.push(styleLeftPos.left); 420 | 421 | var isRightVisible = posX < 0; 422 | var isLeftVisible = posX > 0; 423 | 424 | return _react2.default.createElement( 425 | _reactNative.View, 426 | { style: styleSwipeout }, 427 | _react2.default.createElement( 428 | _reactNative.View, 429 | _extends({ 430 | ref: 'swipeoutContent', 431 | style: styleContent, 432 | onLayout: this._onLayout 433 | }, this._panResponder.panHandlers), 434 | this.props.children 435 | ), 436 | this._renderButtons(this.props.right, isRightVisible, styleRight), 437 | this._renderButtons(this.props.left, isLeftVisible, styleLeft) 438 | ); 439 | }, 440 | 441 | _onLayout: function _onLayout(event) { 442 | var _event$nativeEvent$la = event.nativeEvent.layout, 443 | width = _event$nativeEvent$la.width, 444 | height = _event$nativeEvent$la.height; 445 | 446 | this.setState({ 447 | contentWidth: width, 448 | contentHeight: height 449 | }); 450 | }, 451 | 452 | _renderButtons: function _renderButtons(buttons, isVisible, style) { 453 | if (buttons && isVisible) { 454 | return _react2.default.createElement( 455 | _reactNative.View, 456 | { style: style }, 457 | buttons.map(this._renderButton) 458 | ); 459 | } else { 460 | return _react2.default.createElement(_reactNative.View, null); 461 | } 462 | }, 463 | 464 | _renderButton: function _renderButton(btn, i) { 465 | var _this5 = this; 466 | 467 | return _react2.default.createElement(SwipeoutBtn, { 468 | backgroundColor: btn.backgroundColor, 469 | color: btn.color, 470 | component: btn.component, 471 | disabled: btn.disabled, 472 | height: this.state.contentHeight, 473 | key: i, 474 | onPress: function onPress() { 475 | return _this5._autoClose(btn); 476 | }, 477 | text: btn.text, 478 | type: btn.type, 479 | underlayColor: btn.underlayColor, 480 | width: this.state.btnWidth 481 | }); 482 | } 483 | }); 484 | 485 | Swipeout.NativeButton = _NativeButton2.default; 486 | Swipeout.SwipeoutButton = SwipeoutBtn; 487 | 488 | exports.default = Swipeout; -------------------------------------------------------------------------------- /dist/styles.js: -------------------------------------------------------------------------------- 1 | 'use strict'; 2 | 3 | Object.defineProperty(exports, "__esModule", { 4 | value: true 5 | }); 6 | 7 | var _reactNative = require('react-native'); 8 | 9 | var styles = _reactNative.StyleSheet.create({ 10 | swipeout: { 11 | backgroundColor: '#dbddde', 12 | overflow: 'hidden' 13 | }, 14 | swipeoutBtnTouchable: { 15 | flex: 1 16 | }, 17 | swipeoutBtn: { 18 | alignItems: 'center', 19 | backgroundColor: '#b6bec0', 20 | flex: 1, 21 | justifyContent: 'center', 22 | overflow: 'hidden' 23 | }, 24 | swipeoutBtnText: { 25 | color: '#fff', 26 | textAlign: 'center' 27 | }, 28 | swipeoutBtns: { 29 | bottom: 0, 30 | flex: 1, 31 | flexDirection: 'row', 32 | position: 'absolute', 33 | right: 0, 34 | top: 0 35 | }, 36 | swipeoutContent: {}, 37 | colorDelete: { 38 | backgroundColor: '#fb3d38' 39 | }, 40 | colorPrimary: { 41 | backgroundColor: '#006fff' 42 | }, 43 | colorSecondary: { 44 | backgroundColor: '#fd9427' 45 | } 46 | }); 47 | 48 | exports.default = styles; -------------------------------------------------------------------------------- /example-0.57.1/.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["module:metro-react-native-babel-preset"] 3 | } 4 | -------------------------------------------------------------------------------- /example-0.57.1/.buckconfig: -------------------------------------------------------------------------------- 1 | 2 | [android] 3 | target = Google Inc.:Google APIs:23 4 | 5 | [maven_repositories] 6 | central = https://repo1.maven.org/maven2 7 | -------------------------------------------------------------------------------- /example-0.57.1/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | ; We fork some components by platform 3 | .*/*[.]android.js 4 | 5 | ; Ignore "BUCK" generated dirs 6 | /\.buckd/ 7 | 8 | ; Ignore unexpected extra "@providesModule" 9 | .*/node_modules/.*/node_modules/fbjs/.* 10 | 11 | ; Ignore duplicate module providers 12 | ; For RN Apps installed via npm, "Libraries" folder is inside 13 | ; "node_modules/react-native" but in the source repo it is in the root 14 | .*/Libraries/react-native/React.js 15 | 16 | ; Ignore polyfills 17 | .*/Libraries/polyfills/.* 18 | 19 | ; Ignore metro 20 | .*/node_modules/metro/.* 21 | 22 | [include] 23 | 24 | [libs] 25 | node_modules/react-native/Libraries/react-native/react-native-interface.js 26 | node_modules/react-native/flow/ 27 | node_modules/react-native/flow-github/ 28 | 29 | [options] 30 | emoji=true 31 | 32 | esproposal.optional_chaining=enable 33 | esproposal.nullish_coalescing=enable 34 | 35 | module.system=haste 36 | module.system.haste.use_name_reducers=true 37 | # get basename 38 | module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' 39 | # strip .js or .js.flow suffix 40 | module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' 41 | # strip .ios suffix 42 | module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' 43 | module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' 44 | module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' 45 | module.system.haste.paths.blacklist=.*/__tests__/.* 46 | module.system.haste.paths.blacklist=.*/__mocks__/.* 47 | module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.* 48 | module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.* 49 | 50 | munge_underscores=true 51 | 52 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' 53 | 54 | module.file_ext=.js 55 | module.file_ext=.jsx 56 | module.file_ext=.json 57 | module.file_ext=.native.js 58 | 59 | suppress_type=$FlowIssue 60 | suppress_type=$FlowFixMe 61 | suppress_type=$FlowFixMeProps 62 | suppress_type=$FlowFixMeState 63 | 64 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 65 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 66 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 67 | suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError 68 | 69 | [version] 70 | ^0.78.0 71 | -------------------------------------------------------------------------------- /example-0.57.1/.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /example-0.57.1/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IntelliJ 26 | # 27 | build/ 28 | .idea 29 | .gradle 30 | local.properties 31 | *.iml 32 | 33 | # node.js 34 | # 35 | node_modules/ 36 | npm-debug.log 37 | yarn-error.log 38 | 39 | # BUCK 40 | buck-out/ 41 | \.buckd/ 42 | *.keystore 43 | 44 | # fastlane 45 | # 46 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the 47 | # screenshots whenever they are needed. 48 | # For more information about the recommended setup visit: 49 | # https://docs.fastlane.tools/best-practices/source-control/ 50 | 51 | */fastlane/report.xml 52 | */fastlane/Preview.html 53 | */fastlane/screenshots 54 | 55 | # Bundle artifact 56 | *.jsbundle 57 | -------------------------------------------------------------------------------- /example-0.57.1/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /example-0.57.1/SwipeoutExample.js: -------------------------------------------------------------------------------- 1 | // include react-native-swipeout 2 | import Swipeout from 'react-native-swipeout'; 3 | // example row data (see for json structure) 4 | import rows from './data'; 5 | // example styles 6 | import styles from './styles'; 7 | 8 | import React, {Component} from 'react'; 9 | import {AppRegistry, StyleSheet, ListView, Text, View, TouchableWithoutFeedback} from 'react-native'; 10 | 11 | // example swipout app 12 | class SwipeoutExample extends Component { 13 | 14 | constructor() { 15 | super(); 16 | 17 | // datasource rerendered when change is made (used to set swipeout to active) 18 | var ds = new ListView.DataSource({rowHasChanged: (row1, row2) => true}); 19 | 20 | this.state = { 21 | dataSource: ds.cloneWithRows(rows), 22 | sectionID: null, 23 | rowID: null, 24 | }; 25 | } 26 | 27 | _renderRow(rowData: string, sectionID: number, rowID: number) { 28 | return ( 29 | { 38 | this.setState({ 39 | sectionID, 40 | rowID, 41 | }) 42 | }} 43 | onClose={() => console.log('===close') } 44 | scroll={event => console.log('scroll event') } 45 | > 46 | console.log('press children')}> 47 | 48 | {rowData.text} 49 | 50 | 51 | 52 | ); 53 | } 54 | 55 | render() { 56 | return ( 57 | 58 | 59 | Swipeout 60 | 66 | 67 | ); 68 | } 69 | 70 | } 71 | 72 | export default SwipeoutExample; 73 | -------------------------------------------------------------------------------- /example-0.57.1/android/app/BUCK: -------------------------------------------------------------------------------- 1 | # To learn about Buck see [Docs](https://buckbuild.com/). 2 | # To run your application with Buck: 3 | # - install Buck 4 | # - `npm start` - to start the packager 5 | # - `cd android` 6 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 7 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 8 | # - `buck install -r android/app` - compile, install and run application 9 | # 10 | 11 | lib_deps = [] 12 | 13 | for jarfile in glob(['libs/*.jar']): 14 | name = 'jars__' + jarfile[jarfile.rindex('/') + 1: jarfile.rindex('.jar')] 15 | lib_deps.append(':' + name) 16 | prebuilt_jar( 17 | name = name, 18 | binary_jar = jarfile, 19 | ) 20 | 21 | for aarfile in glob(['libs/*.aar']): 22 | name = 'aars__' + aarfile[aarfile.rindex('/') + 1: aarfile.rindex('.aar')] 23 | lib_deps.append(':' + name) 24 | android_prebuilt_aar( 25 | name = name, 26 | aar = aarfile, 27 | ) 28 | 29 | android_library( 30 | name = "all-libs", 31 | exported_deps = lib_deps, 32 | ) 33 | 34 | android_library( 35 | name = "app-code", 36 | srcs = glob([ 37 | "src/main/java/**/*.java", 38 | ]), 39 | deps = [ 40 | ":all-libs", 41 | ":build_config", 42 | ":res", 43 | ], 44 | ) 45 | 46 | android_build_config( 47 | name = "build_config", 48 | package = "com.swipeoutexample", 49 | ) 50 | 51 | android_resource( 52 | name = "res", 53 | package = "com.swipeoutexample", 54 | res = "src/main/res", 55 | ) 56 | 57 | android_binary( 58 | name = "app", 59 | keystore = "//android/keystores:debug", 60 | manifest = "src/main/AndroidManifest.xml", 61 | package_type = "debug", 62 | deps = [ 63 | ":app-code", 64 | ], 65 | ) 66 | -------------------------------------------------------------------------------- /example-0.57.1/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation 19 | * entryFile: "index.android.js", 20 | * 21 | * // whether to bundle JS and assets in debug mode 22 | * bundleInDebug: false, 23 | * 24 | * // whether to bundle JS and assets in release mode 25 | * bundleInRelease: true, 26 | * 27 | * // whether to bundle JS and assets in another build variant (if configured). 28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 29 | * // The configuration property can be in the following formats 30 | * // 'bundleIn${productFlavor}${buildType}' 31 | * // 'bundleIn${buildType}' 32 | * // bundleInFreeDebug: true, 33 | * // bundleInPaidRelease: true, 34 | * // bundleInBeta: true, 35 | * 36 | * // whether to disable dev mode in custom build variants (by default only disabled in release) 37 | * // for example: to disable dev mode in the staging build type (if configured) 38 | * devDisabledInStaging: true, 39 | * // The configuration property can be in the following formats 40 | * // 'devDisabledIn${productFlavor}${buildType}' 41 | * // 'devDisabledIn${buildType}' 42 | * 43 | * // the root of your project, i.e. where "package.json" lives 44 | * root: "../../", 45 | * 46 | * // where to put the JS bundle asset in debug mode 47 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 48 | * 49 | * // where to put the JS bundle asset in release mode 50 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 51 | * 52 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 53 | * // require('./image.png')), in debug mode 54 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 55 | * 56 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 57 | * // require('./image.png')), in release mode 58 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 59 | * 60 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 61 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 62 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 63 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 64 | * // for example, you might want to remove it from here. 65 | * inputExcludes: ["android/**", "ios/**"], 66 | * 67 | * // override which node gets called and with what additional arguments 68 | * nodeExecutableAndArgs: ["node"], 69 | * 70 | * // supply additional arguments to the packager 71 | * extraPackagerArgs: [] 72 | * ] 73 | */ 74 | 75 | project.ext.react = [ 76 | entryFile: "index.js" 77 | ] 78 | 79 | apply from: "../../node_modules/react-native/react.gradle" 80 | 81 | /** 82 | * Set this to true to create two separate APKs instead of one: 83 | * - An APK that only works on ARM devices 84 | * - An APK that only works on x86 devices 85 | * The advantage is the size of the APK is reduced by about 4MB. 86 | * Upload all the APKs to the Play Store and people will download 87 | * the correct one based on the CPU architecture of their device. 88 | */ 89 | def enableSeparateBuildPerCPUArchitecture = false 90 | 91 | /** 92 | * Run Proguard to shrink the Java bytecode in release builds. 93 | */ 94 | def enableProguardInReleaseBuilds = false 95 | 96 | android { 97 | compileSdkVersion rootProject.ext.compileSdkVersion 98 | buildToolsVersion rootProject.ext.buildToolsVersion 99 | 100 | defaultConfig { 101 | applicationId "com.swipeoutexample" 102 | minSdkVersion rootProject.ext.minSdkVersion 103 | targetSdkVersion rootProject.ext.targetSdkVersion 104 | versionCode 1 105 | versionName "1.0" 106 | ndk { 107 | abiFilters "armeabi-v7a", "x86" 108 | } 109 | } 110 | splits { 111 | abi { 112 | reset() 113 | enable enableSeparateBuildPerCPUArchitecture 114 | universalApk false // If true, also generate a universal APK 115 | include "armeabi-v7a", "x86" 116 | } 117 | } 118 | buildTypes { 119 | release { 120 | minifyEnabled enableProguardInReleaseBuilds 121 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 122 | } 123 | } 124 | // applicationVariants are e.g. debug, release 125 | applicationVariants.all { variant -> 126 | variant.outputs.each { output -> 127 | // For each separate APK per architecture, set a unique version code as described here: 128 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits 129 | def versionCodes = ["armeabi-v7a":1, "x86":2] 130 | def abi = output.getFilter(OutputFile.ABI) 131 | if (abi != null) { // null for the universal-debug, universal-release variants 132 | output.versionCodeOverride = 133 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 134 | } 135 | } 136 | } 137 | } 138 | 139 | dependencies { 140 | implementation fileTree(dir: "libs", include: ["*.jar"]) 141 | implementation "com.android.support:appcompat-v7:${rootProject.ext.supportLibVersion}" 142 | implementation "com.facebook.react:react-native:+" // From node_modules 143 | } 144 | 145 | // Run this once to be able to run the application with BUCK 146 | // puts all compile dependencies into folder libs for BUCK to use 147 | task copyDownloadableDepsToLibs(type: Copy) { 148 | from configurations.compile 149 | into 'libs' 150 | } 151 | -------------------------------------------------------------------------------- /example-0.57.1/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | -------------------------------------------------------------------------------- /example-0.57.1/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 3 | 4 | 5 | 6 | 7 | 13 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | -------------------------------------------------------------------------------- /example-0.57.1/android/app/src/main/java/com/swipeoutexample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.swipeoutexample; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. 9 | * This is used to schedule rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "swipeoutExample"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example-0.57.1/android/app/src/main/java/com/swipeoutexample/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.swipeoutexample; 2 | 3 | import android.app.Application; 4 | 5 | import com.facebook.react.ReactApplication; 6 | import com.facebook.react.ReactNativeHost; 7 | import com.facebook.react.ReactPackage; 8 | import com.facebook.react.shell.MainReactPackage; 9 | import com.facebook.soloader.SoLoader; 10 | 11 | import java.util.Arrays; 12 | import java.util.List; 13 | 14 | public class MainApplication extends Application implements ReactApplication { 15 | 16 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 17 | @Override 18 | public boolean getUseDeveloperSupport() { 19 | return BuildConfig.DEBUG; 20 | } 21 | 22 | @Override 23 | protected List getPackages() { 24 | return Arrays.asList( 25 | new MainReactPackage() 26 | ); 27 | } 28 | 29 | @Override 30 | protected String getJSMainModuleName() { 31 | return "index"; 32 | } 33 | }; 34 | 35 | @Override 36 | public ReactNativeHost getReactNativeHost() { 37 | return mReactNativeHost; 38 | } 39 | 40 | @Override 41 | public void onCreate() { 42 | super.onCreate(); 43 | SoLoader.init(this, /* native exopackage */ false); 44 | } 45 | } 46 | -------------------------------------------------------------------------------- /example-0.57.1/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dancormier/react-native-swipeout/651d0bf106d2a731f73821990a5ee32d4fd28f2a/example-0.57.1/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example-0.57.1/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dancormier/react-native-swipeout/651d0bf106d2a731f73821990a5ee32d4fd28f2a/example-0.57.1/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example-0.57.1/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dancormier/react-native-swipeout/651d0bf106d2a731f73821990a5ee32d4fd28f2a/example-0.57.1/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example-0.57.1/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dancormier/react-native-swipeout/651d0bf106d2a731f73821990a5ee32d4fd28f2a/example-0.57.1/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example-0.57.1/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dancormier/react-native-swipeout/651d0bf106d2a731f73821990a5ee32d4fd28f2a/example-0.57.1/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example-0.57.1/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dancormier/react-native-swipeout/651d0bf106d2a731f73821990a5ee32d4fd28f2a/example-0.57.1/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example-0.57.1/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dancormier/react-native-swipeout/651d0bf106d2a731f73821990a5ee32d4fd28f2a/example-0.57.1/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example-0.57.1/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dancormier/react-native-swipeout/651d0bf106d2a731f73821990a5ee32d4fd28f2a/example-0.57.1/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example-0.57.1/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dancormier/react-native-swipeout/651d0bf106d2a731f73821990a5ee32d4fd28f2a/example-0.57.1/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example-0.57.1/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dancormier/react-native-swipeout/651d0bf106d2a731f73821990a5ee32d4fd28f2a/example-0.57.1/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example-0.57.1/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | swipeoutExample 3 | 4 | -------------------------------------------------------------------------------- /example-0.57.1/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example-0.57.1/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | ext { 5 | buildToolsVersion = "27.0.3" 6 | minSdkVersion = 16 7 | compileSdkVersion = 27 8 | targetSdkVersion = 26 9 | supportLibVersion = "27.1.1" 10 | } 11 | repositories { 12 | jcenter() 13 | google() 14 | } 15 | dependencies { 16 | classpath 'com.android.tools.build:gradle:3.1.4' 17 | 18 | // NOTE: Do not place your application dependencies here; they belong 19 | // in the individual module build.gradle files 20 | } 21 | } 22 | 23 | allprojects { 24 | repositories { 25 | mavenLocal() 26 | jcenter() 27 | maven { 28 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 29 | url "$rootDir/../node_modules/react-native/android" 30 | } 31 | google() 32 | } 33 | } 34 | 35 | 36 | task wrapper(type: Wrapper) { 37 | gradleVersion = '4.4' 38 | distributionUrl = distributionUrl.replace("bin", "all") 39 | } 40 | -------------------------------------------------------------------------------- /example-0.57.1/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | -------------------------------------------------------------------------------- /example-0.57.1/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dancormier/react-native-swipeout/651d0bf106d2a731f73821990a5ee32d4fd28f2a/example-0.57.1/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example-0.57.1/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-4.4-all.zip 6 | -------------------------------------------------------------------------------- /example-0.57.1/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env sh 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Attempt to set APP_HOME 10 | # Resolve links: $0 may be a link 11 | PRG="$0" 12 | # Need this for relative symlinks. 13 | while [ -h "$PRG" ] ; do 14 | ls=`ls -ld "$PRG"` 15 | link=`expr "$ls" : '.*-> \(.*\)$'` 16 | if expr "$link" : '/.*' > /dev/null; then 17 | PRG="$link" 18 | else 19 | PRG=`dirname "$PRG"`"/$link" 20 | fi 21 | done 22 | SAVED="`pwd`" 23 | cd "`dirname \"$PRG\"`/" >/dev/null 24 | APP_HOME="`pwd -P`" 25 | cd "$SAVED" >/dev/null 26 | 27 | APP_NAME="Gradle" 28 | APP_BASE_NAME=`basename "$0"` 29 | 30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 31 | DEFAULT_JVM_OPTS="" 32 | 33 | # Use the maximum available, or set MAX_FD != -1 to use that value. 34 | MAX_FD="maximum" 35 | 36 | warn () { 37 | echo "$*" 38 | } 39 | 40 | die () { 41 | echo 42 | echo "$*" 43 | echo 44 | exit 1 45 | } 46 | 47 | # OS specific support (must be 'true' or 'false'). 48 | cygwin=false 49 | msys=false 50 | darwin=false 51 | nonstop=false 52 | case "`uname`" in 53 | CYGWIN* ) 54 | cygwin=true 55 | ;; 56 | Darwin* ) 57 | darwin=true 58 | ;; 59 | MINGW* ) 60 | msys=true 61 | ;; 62 | NONSTOP* ) 63 | nonstop=true 64 | ;; 65 | esac 66 | 67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 68 | 69 | # Determine the Java command to use to start the JVM. 70 | if [ -n "$JAVA_HOME" ] ; then 71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 72 | # IBM's JDK on AIX uses strange locations for the executables 73 | JAVACMD="$JAVA_HOME/jre/sh/java" 74 | else 75 | JAVACMD="$JAVA_HOME/bin/java" 76 | fi 77 | if [ ! -x "$JAVACMD" ] ; then 78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 79 | 80 | Please set the JAVA_HOME variable in your environment to match the 81 | location of your Java installation." 82 | fi 83 | else 84 | JAVACMD="java" 85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 86 | 87 | Please set the JAVA_HOME variable in your environment to match the 88 | location of your Java installation." 89 | fi 90 | 91 | # Increase the maximum file descriptors if we can. 92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then 93 | MAX_FD_LIMIT=`ulimit -H -n` 94 | if [ $? -eq 0 ] ; then 95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 96 | MAX_FD="$MAX_FD_LIMIT" 97 | fi 98 | ulimit -n $MAX_FD 99 | if [ $? -ne 0 ] ; then 100 | warn "Could not set maximum file descriptor limit: $MAX_FD" 101 | fi 102 | else 103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 104 | fi 105 | fi 106 | 107 | # For Darwin, add options to specify how the application appears in the dock 108 | if $darwin; then 109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 110 | fi 111 | 112 | # For Cygwin, switch paths to Windows format before running java 113 | if $cygwin ; then 114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 116 | JAVACMD=`cygpath --unix "$JAVACMD"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Escape application args 158 | save () { 159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done 160 | echo " " 161 | } 162 | APP_ARGS=$(save "$@") 163 | 164 | # Collect all arguments for the java command, following the shell quoting and substitution rules 165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS" 166 | 167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong 168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then 169 | cd "$(dirname "$0")" 170 | fi 171 | 172 | exec "$JAVACMD" "$@" 173 | -------------------------------------------------------------------------------- /example-0.57.1/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | set DIRNAME=%~dp0 12 | if "%DIRNAME%" == "" set DIRNAME=. 13 | set APP_BASE_NAME=%~n0 14 | set APP_HOME=%DIRNAME% 15 | 16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 17 | set DEFAULT_JVM_OPTS= 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windows variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | 53 | :win9xME_args 54 | @rem Slurp the command line arguments. 55 | set CMD_LINE_ARGS= 56 | set _SKIP=2 57 | 58 | :win9xME_args_slurp 59 | if "x%~1" == "x" goto execute 60 | 61 | set CMD_LINE_ARGS=%* 62 | 63 | :execute 64 | @rem Setup the command line 65 | 66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 67 | 68 | @rem Execute Gradle 69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 70 | 71 | :end 72 | @rem End local scope for the variables with windows NT shell 73 | if "%ERRORLEVEL%"=="0" goto mainEnd 74 | 75 | :fail 76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 77 | rem the _cmd.exe /c_ return code! 78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 79 | exit /b 1 80 | 81 | :mainEnd 82 | if "%OS%"=="Windows_NT" endlocal 83 | 84 | :omega 85 | -------------------------------------------------------------------------------- /example-0.57.1/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = "debug", 3 | properties = "debug.keystore.properties", 4 | store = "debug.keystore", 5 | visibility = [ 6 | "PUBLIC", 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /example-0.57.1/android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /example-0.57.1/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'swipeoutExample' 2 | 3 | include ':app' 4 | -------------------------------------------------------------------------------- /example-0.57.1/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swipeoutExample", 3 | "displayName": "swipeoutExample" 4 | } -------------------------------------------------------------------------------- /example-0.57.1/data.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {Image} from 'react-native'; 3 | 4 | var btnsDefault = [ { text: 'Button' } ]; 5 | 6 | var btnsTypes = [ 7 | { text: 'Primary', type: 'primary', }, 8 | { text: 'Secondary', type: 'secondary', }, 9 | { text: 'Delete', type: 'delete', } 10 | ]; 11 | 12 | var rows = [ 13 | { 14 | text: "Basic Example", 15 | right: btnsDefault, 16 | }, { 17 | text: "onPress Callback", 18 | right: [ 19 | { 20 | text: 'Press Me', 21 | onPress: function(){ alert('button pressed') }, 22 | type: 'primary', 23 | } 24 | ], 25 | }, { 26 | text: "Button Types", 27 | right: btnsTypes, 28 | }, { 29 | text: "Button with custom styling", 30 | right: [ 31 | { 32 | text: 'Button', 33 | backgroundColor: '#4fba8a', 34 | color: '#17807a', 35 | underlayColor: "#006fff", 36 | } 37 | ], 38 | }, 39 | { 40 | text: "Overswipe background color (drag me far)", 41 | right: btnsDefault, 42 | backgroundColor: '#006fff', 43 | }, { 44 | text: "Swipeout autoClose={true}", 45 | right: btnsDefault, 46 | autoClose: true, 47 | }, { 48 | text: "Five buttons (full-width) + autoClose={true}", 49 | right: [ 50 | { text: 'One'}, 51 | { text: 'Two'}, 52 | { text: 'Three' }, 53 | { text: 'Four' }, 54 | { text: 'Five' } 55 | ], 56 | autoClose: true, 57 | }, { 58 | text: "Custom button component", 59 | right: [ 60 | { 61 | component: 62 | } 63 | ], 64 | }, { 65 | text: "Swipe me right (buttons on left side)", 66 | left: btnsDefault, 67 | }, { 68 | text: "Buttons on both sides", 69 | left: btnsTypes, 70 | right: btnsTypes, 71 | }, 72 | ]; 73 | 74 | export default rows; 75 | -------------------------------------------------------------------------------- /example-0.57.1/index.js: -------------------------------------------------------------------------------- 1 | /** @format */ 2 | 3 | import {AppRegistry} from 'react-native'; 4 | import {name as appName} from './app.json'; 5 | import SwipeoutExample from './SwipeoutExample'; 6 | 7 | AppRegistry.registerComponent(appName, () => SwipeoutExample); 8 | -------------------------------------------------------------------------------- /example-0.57.1/ios/swipeoutExample-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /example-0.57.1/ios/swipeoutExample-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /example-0.57.1/ios/swipeoutExample.xcodeproj/xcshareddata/xcschemes/swipeoutExample-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /example-0.57.1/ios/swipeoutExample.xcodeproj/xcshareddata/xcschemes/swipeoutExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /example-0.57.1/ios/swipeoutExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | @interface AppDelegate : UIResponder 11 | 12 | @property (nonatomic, strong) UIWindow *window; 13 | 14 | @end 15 | -------------------------------------------------------------------------------- /example-0.57.1/ios/swipeoutExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import "AppDelegate.h" 9 | 10 | #import 11 | #import 12 | 13 | @implementation AppDelegate 14 | 15 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 16 | { 17 | NSURL *jsCodeLocation; 18 | 19 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index" fallbackResource:nil]; 20 | 21 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 22 | moduleName:@"swipeoutExample" 23 | initialProperties:nil 24 | launchOptions:launchOptions]; 25 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 26 | 27 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 28 | UIViewController *rootViewController = [UIViewController new]; 29 | rootViewController.view = rootView; 30 | self.window.rootViewController = rootViewController; 31 | [self.window makeKeyAndVisible]; 32 | return YES; 33 | } 34 | 35 | @end 36 | -------------------------------------------------------------------------------- /example-0.57.1/ios/swipeoutExample/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /example-0.57.1/ios/swipeoutExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /example-0.57.1/ios/swipeoutExample/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /example-0.57.1/ios/swipeoutExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | swipeoutExample 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | $(PRODUCT_BUNDLE_IDENTIFIER) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | NSLocationWhenInUseUsageDescription 28 | 29 | UILaunchStoryboardName 30 | LaunchScreen 31 | UIRequiredDeviceCapabilities 32 | 33 | armv7 34 | 35 | UISupportedInterfaceOrientations 36 | 37 | UIInterfaceOrientationPortrait 38 | UIInterfaceOrientationLandscapeLeft 39 | UIInterfaceOrientationLandscapeRight 40 | 41 | UIViewControllerBasedStatusBarAppearance 42 | 43 | NSLocationWhenInUseUsageDescription 44 | 45 | NSAppTransportSecurity 46 | 47 | 48 | NSAllowsArbitraryLoads 49 | 50 | NSExceptionDomains 51 | 52 | localhost 53 | 54 | NSExceptionAllowsInsecureHTTPLoads 55 | 56 | 57 | 58 | 59 | 60 | 61 | -------------------------------------------------------------------------------- /example-0.57.1/ios/swipeoutExample/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | 10 | #import "AppDelegate.h" 11 | 12 | int main(int argc, char * argv[]) { 13 | @autoreleasepool { 14 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /example-0.57.1/ios/swipeoutExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | $(PRODUCT_BUNDLE_IDENTIFIER) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /example-0.57.1/ios/swipeoutExampleTests/swipeoutExampleTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * 4 | * This source code is licensed under the MIT license found in the 5 | * LICENSE file in the root directory of this source tree. 6 | */ 7 | 8 | #import 9 | #import 10 | 11 | #import 12 | #import 13 | 14 | #define TIMEOUT_SECONDS 600 15 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 16 | 17 | @interface swipeoutExampleTests : XCTestCase 18 | 19 | @end 20 | 21 | @implementation swipeoutExampleTests 22 | 23 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 24 | { 25 | if (test(view)) { 26 | return YES; 27 | } 28 | for (UIView *subview in [view subviews]) { 29 | if ([self findSubviewInView:subview matching:test]) { 30 | return YES; 31 | } 32 | } 33 | return NO; 34 | } 35 | 36 | - (void)testRendersWelcomeScreen 37 | { 38 | UIViewController *vc = [[[RCTSharedApplication() delegate] window] rootViewController]; 39 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 40 | BOOL foundElement = NO; 41 | 42 | __block NSString *redboxError = nil; 43 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 44 | if (level >= RCTLogLevelError) { 45 | redboxError = message; 46 | } 47 | }); 48 | 49 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 50 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 51 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 52 | 53 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 54 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 55 | return YES; 56 | } 57 | return NO; 58 | }]; 59 | } 60 | 61 | RCTSetLogFunction(RCTDefaultLogFunction); 62 | 63 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 64 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 65 | } 66 | 67 | 68 | @end 69 | -------------------------------------------------------------------------------- /example-0.57.1/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swipeoutExample", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "ios": "react-native run-ios", 7 | "android": "react-native run-android", 8 | "start": "watchman watch-del-all; node node_modules/react-native/local-cli/cli.js start --reset-cache", 9 | "test": "jest", 10 | "clear": "npm cache clear --force; watchman watch-del-all;" 11 | }, 12 | "dependencies": { 13 | "@babel/runtime": "7.0.0-beta.55", 14 | "react": "16.5.0", 15 | "react-native": "0.57.1", 16 | "react-native-swipeout": "2.3.6" 17 | }, 18 | "devDependencies": { 19 | "babel-jest": "23.6.0", 20 | "jest": "23.6.0", 21 | "metro-react-native-babel-preset": "0.46.0", 22 | "react-test-renderer": "16.5.0" 23 | }, 24 | "jest": { 25 | "preset": "react-native" 26 | } 27 | } 28 | -------------------------------------------------------------------------------- /example-0.57.1/styles.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | 4 | var styles = StyleSheet.create({ 5 | container: { 6 | backgroundColor: '#f2f2f2', 7 | flex: 1, 8 | }, 9 | listview: { 10 | flex: 1, 11 | }, 12 | li: { 13 | backgroundColor: '#fff', 14 | borderBottomColor: '#eee', 15 | borderColor: 'transparent', 16 | borderWidth: 1, 17 | paddingLeft: 16, 18 | paddingTop: 14, 19 | paddingBottom: 16, 20 | }, 21 | liContainer: { 22 | flex: 2, 23 | }, 24 | liText: { 25 | color: '#333', 26 | fontSize: 16, 27 | }, 28 | navbar: { 29 | alignItems: 'center', 30 | backgroundColor: '#fff', 31 | borderBottomColor: '#eee', 32 | borderColor: 'transparent', 33 | borderWidth: 1, 34 | justifyContent: 'center', 35 | height: 44, 36 | }, 37 | navbarTitle: { 38 | color: '#444', 39 | fontSize: 16, 40 | fontWeight: "500", 41 | }, 42 | statusbar: { 43 | backgroundColor: '#fff', 44 | height: 22, 45 | } 46 | }) 47 | 48 | module.exports = styles 49 | -------------------------------------------------------------------------------- /example/.flowconfig: -------------------------------------------------------------------------------- 1 | [ignore] 2 | 3 | # We fork some components by platform. 4 | .*/*.web.js 5 | .*/*.android.js 6 | 7 | # Some modules have their own node_modules with overlap 8 | .*/node_modules/node-haste/.* 9 | 10 | # Ugh 11 | .*/node_modules/babel.* 12 | .*/node_modules/babylon.* 13 | .*/node_modules/invariant.* 14 | 15 | # Ignore react and fbjs where there are overlaps, but don't ignore 16 | # anything that react-native relies on 17 | .*/node_modules/fbjs/lib/Map.js 18 | .*/node_modules/fbjs/lib/fetch.js 19 | .*/node_modules/fbjs/lib/ExecutionEnvironment.js 20 | .*/node_modules/fbjs/lib/ErrorUtils.js 21 | 22 | # Flow has a built-in definition for the 'react' module which we prefer to use 23 | # over the currently-untyped source 24 | .*/node_modules/react/react.js 25 | .*/node_modules/react/lib/React.js 26 | .*/node_modules/react/lib/ReactDOM.js 27 | 28 | .*/__mocks__/.* 29 | .*/__tests__/.* 30 | 31 | .*/commoner/test/source/widget/share.js 32 | 33 | # Ignore commoner tests 34 | .*/node_modules/commoner/test/.* 35 | 36 | # See https://github.com/facebook/flow/issues/442 37 | .*/react-tools/node_modules/commoner/lib/reader.js 38 | 39 | # Ignore jest 40 | .*/node_modules/jest-cli/.* 41 | 42 | # Ignore Website 43 | .*/website/.* 44 | 45 | [include] 46 | 47 | [libs] 48 | node_modules/react-native/Libraries/react-native/react-native-interface.js 49 | 50 | [options] 51 | module.system=haste 52 | 53 | esproposal.class_static_fields=enable 54 | esproposal.class_instance_fields=enable 55 | 56 | munge_underscores=true 57 | 58 | module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub' 59 | module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\)$' -> 'RelativeImageStub' 60 | 61 | suppress_type=$FlowIssue 62 | suppress_type=$FlowFixMe 63 | suppress_type=$FixMe 64 | 65 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(2[0-1]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) 66 | suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(2[0-1]\\|1[0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ 67 | suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy 68 | 69 | [version] 70 | 0.21.0 71 | -------------------------------------------------------------------------------- /example/.gitignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | project.xcworkspace 24 | 25 | # Android/IJ 26 | # 27 | .idea 28 | .gradle 29 | local.properties 30 | 31 | # node.js 32 | # 33 | node_modules/ 34 | npm-debug.log 35 | -------------------------------------------------------------------------------- /example/.npmignore: -------------------------------------------------------------------------------- 1 | # OSX 2 | # 3 | .DS_Store 4 | 5 | # Xcode 6 | # 7 | build/ 8 | *.pbxuser 9 | !default.pbxuser 10 | *.mode1v3 11 | !default.mode1v3 12 | *.mode2v3 13 | !default.mode2v3 14 | *.perspectivev3 15 | !default.perspectivev3 16 | xcuserdata 17 | *.xccheckout 18 | *.moved-aside 19 | DerivedData 20 | *.hmap 21 | *.ipa 22 | *.xcuserstate 23 | 24 | # node.js 25 | # 26 | node_modules/ 27 | npm-debug.log 28 | -------------------------------------------------------------------------------- /example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} -------------------------------------------------------------------------------- /example/SwipeoutExample.js: -------------------------------------------------------------------------------- 1 | // include react-native-swipeout 2 | import Swipeout from 'react-native-swipeout'; 3 | // example row data (see for json structure) 4 | import rows from './data'; 5 | // example styles 6 | import styles from './styles'; 7 | 8 | import React, {Component} from 'react'; 9 | import {AppRegistry, StyleSheet, ListView, Text, View, TouchableWithoutFeedback} from 'react-native'; 10 | 11 | // example swipout app 12 | class SwipeoutExample extends Component { 13 | 14 | constructor() { 15 | super(); 16 | 17 | // datasource rerendered when change is made (used to set swipeout to active) 18 | var ds = new ListView.DataSource({rowHasChanged: (row1, row2) => true}); 19 | 20 | this.state = { 21 | dataSource: ds.cloneWithRows(rows), 22 | sectionID: null, 23 | rowID: null, 24 | }; 25 | } 26 | 27 | _renderRow(rowData: string, sectionID: number, rowID: number) { 28 | return ( 29 | { 38 | this.setState({ 39 | sectionID, 40 | rowID, 41 | }) 42 | }} 43 | onClose={() => console.log('===close') } 44 | scroll={event => console.log('scroll event') } 45 | > 46 | console.log('press children')}> 47 | 48 | {rowData.text} 49 | 50 | 51 | 52 | ); 53 | } 54 | 55 | render() { 56 | return ( 57 | 58 | 59 | Swipeout 60 | 66 | 67 | ); 68 | } 69 | 70 | } 71 | 72 | export default SwipeoutExample; 73 | -------------------------------------------------------------------------------- /example/android/app/BUCK: -------------------------------------------------------------------------------- 1 | import re 2 | 3 | # To learn about Buck see [Docs](https://buckbuild.com/). 4 | # To run your application with Buck: 5 | # - install Buck 6 | # - `npm start` - to start the packager 7 | # - `cd android` 8 | # - `keytool -genkey -v -keystore keystores/debug.keystore -storepass android -alias androiddebugkey -keypass android -dname "CN=Android Debug,O=Android,C=US"` 9 | # - `./gradlew :app:copyDownloadableDepsToLibs` - make all Gradle compile dependencies available to Buck 10 | # - `buck install -r android/app` - compile, install and run application 11 | # 12 | 13 | lib_deps = [] 14 | for jarfile in glob(['libs/*.jar']): 15 | name = 'jars__' + re.sub(r'^.*/([^/]+)\.jar$', r'\1', jarfile) 16 | lib_deps.append(':' + name) 17 | prebuilt_jar( 18 | name = name, 19 | binary_jar = jarfile, 20 | ) 21 | 22 | for aarfile in glob(['libs/*.aar']): 23 | name = 'aars__' + re.sub(r'^.*/([^/]+)\.aar$', r'\1', aarfile) 24 | lib_deps.append(':' + name) 25 | android_prebuilt_aar( 26 | name = name, 27 | aar = aarfile, 28 | ) 29 | 30 | android_library( 31 | name = 'all-libs', 32 | exported_deps = lib_deps 33 | ) 34 | 35 | android_library( 36 | name = 'app-code', 37 | srcs = glob([ 38 | 'src/main/java/**/*.java', 39 | ]), 40 | deps = [ 41 | ':all-libs', 42 | ':build_config', 43 | ':res', 44 | ], 45 | ) 46 | 47 | android_build_config( 48 | name = 'build_config', 49 | package = 'com.swipeoutexample', 50 | ) 51 | 52 | android_resource( 53 | name = 'res', 54 | res = 'src/main/res', 55 | package = 'com.swipeoutexample', 56 | ) 57 | 58 | android_binary( 59 | name = 'app', 60 | package_type = 'debug', 61 | manifest = 'src/main/AndroidManifest.xml', 62 | keystore = '//android/keystores:debug', 63 | deps = [ 64 | ':app-code', 65 | ], 66 | ) 67 | -------------------------------------------------------------------------------- /example/android/app/build.gradle: -------------------------------------------------------------------------------- 1 | apply plugin: "com.android.application" 2 | 3 | import com.android.build.OutputFile 4 | 5 | /** 6 | * The react.gradle file registers a task for each build variant (e.g. bundleDebugJsAndAssets 7 | * and bundleReleaseJsAndAssets). 8 | * These basically call `react-native bundle` with the correct arguments during the Android build 9 | * cycle. By default, bundleDebugJsAndAssets is skipped, as in debug/dev mode we prefer to load the 10 | * bundle directly from the development server. Below you can see all the possible configurations 11 | * and their defaults. If you decide to add a configuration block, make sure to add it before the 12 | * `apply from: "../../node_modules/react-native/react.gradle"` line. 13 | * 14 | * project.ext.react = [ 15 | * // the name of the generated asset file containing your JS bundle 16 | * bundleAssetName: "index.android.bundle", 17 | * 18 | * // the entry file for bundle generation 19 | * entryFile: "index.android.js", 20 | * 21 | * // whether to bundle JS and assets in debug mode 22 | * bundleInDebug: false, 23 | * 24 | * // whether to bundle JS and assets in release mode 25 | * bundleInRelease: true, 26 | * 27 | * // whether to bundle JS and assets in another build variant (if configured). 28 | * // See http://tools.android.com/tech-docs/new-build-system/user-guide#TOC-Build-Variants 29 | * // The configuration property can be in the following formats 30 | * // 'bundleIn${productFlavor}${buildType}' 31 | * // 'bundleIn${buildType}' 32 | * // bundleInFreeDebug: true, 33 | * // bundleInPaidRelease: true, 34 | * // bundleInBeta: true, 35 | * 36 | * // the root of your project, i.e. where "package.json" lives 37 | * root: "../../", 38 | * 39 | * // where to put the JS bundle asset in debug mode 40 | * jsBundleDirDebug: "$buildDir/intermediates/assets/debug", 41 | * 42 | * // where to put the JS bundle asset in release mode 43 | * jsBundleDirRelease: "$buildDir/intermediates/assets/release", 44 | * 45 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 46 | * // require('./image.png')), in debug mode 47 | * resourcesDirDebug: "$buildDir/intermediates/res/merged/debug", 48 | * 49 | * // where to put drawable resources / React Native assets, e.g. the ones you use via 50 | * // require('./image.png')), in release mode 51 | * resourcesDirRelease: "$buildDir/intermediates/res/merged/release", 52 | * 53 | * // by default the gradle tasks are skipped if none of the JS files or assets change; this means 54 | * // that we don't look at files in android/ or ios/ to determine whether the tasks are up to 55 | * // date; if you have any other folders that you want to ignore for performance reasons (gradle 56 | * // indexes the entire tree), add them here. Alternatively, if you have JS files in android/ 57 | * // for example, you might want to remove it from here. 58 | * inputExcludes: ["android/**", "ios/**"], 59 | * 60 | * // override which node gets called and with what additional arguments 61 | * nodeExecutableAndArgs: ["node"] 62 | * 63 | * // supply additional arguments to the packager 64 | * extraPackagerArgs: [] 65 | * ] 66 | */ 67 | 68 | apply from: "../../node_modules/react-native/react.gradle" 69 | 70 | /** 71 | * Set this to true to create two separate APKs instead of one: 72 | * - An APK that only works on ARM devices 73 | * - An APK that only works on x86 devices 74 | * The advantage is the size of the APK is reduced by about 4MB. 75 | * Upload all the APKs to the Play Store and people will download 76 | * the correct one based on the CPU architecture of their device. 77 | */ 78 | def enableSeparateBuildPerCPUArchitecture = false 79 | 80 | /** 81 | * Run Proguard to shrink the Java bytecode in release builds. 82 | */ 83 | def enableProguardInReleaseBuilds = false 84 | 85 | android { 86 | compileSdkVersion 23 87 | buildToolsVersion "23.0.1" 88 | 89 | defaultConfig { 90 | applicationId "com.swipeoutexample" 91 | minSdkVersion 16 92 | targetSdkVersion 22 93 | versionCode 1 94 | versionName "1.0" 95 | ndk { 96 | abiFilters "armeabi-v7a", "x86" 97 | } 98 | } 99 | splits { 100 | abi { 101 | reset() 102 | enable enableSeparateBuildPerCPUArchitecture 103 | universalApk false // If true, also generate a universal APK 104 | include "armeabi-v7a", "x86" 105 | } 106 | } 107 | buildTypes { 108 | release { 109 | minifyEnabled enableProguardInReleaseBuilds 110 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro" 111 | } 112 | } 113 | // applicationVariants are e.g. debug, release 114 | applicationVariants.all { variant -> 115 | variant.outputs.each { output -> 116 | // For each separate APK per architecture, set a unique version code as described here: 117 | // http://tools.android.com/tech-docs/new-build-system/user-guide/apk-splits 118 | def versionCodes = ["armeabi-v7a":1, "x86":2] 119 | def abi = output.getFilter(OutputFile.ABI) 120 | if (abi != null) { // null for the universal-debug, universal-release variants 121 | output.versionCodeOverride = 122 | versionCodes.get(abi) * 1048576 + defaultConfig.versionCode 123 | } 124 | } 125 | } 126 | } 127 | 128 | dependencies { 129 | compile fileTree(dir: "libs", include: ["*.jar"]) 130 | compile "com.android.support:appcompat-v7:23.0.1" 131 | compile "com.facebook.react:react-native:+" // From node_modules 132 | } 133 | 134 | // Run this once to be able to run the application with BUCK 135 | // puts all compile dependencies into folder libs for BUCK to use 136 | task copyDownloadableDepsToLibs(type: Copy) { 137 | from configurations.compile 138 | into 'libs' 139 | } 140 | -------------------------------------------------------------------------------- /example/android/app/proguard-rules.pro: -------------------------------------------------------------------------------- 1 | # Add project specific ProGuard rules here. 2 | # By default, the flags in this file are appended to flags specified 3 | # in /usr/local/Cellar/android-sdk/24.3.3/tools/proguard/proguard-android.txt 4 | # You can edit the include path and order by changing the proguardFiles 5 | # directive in build.gradle. 6 | # 7 | # For more details, see 8 | # http://developer.android.com/guide/developing/tools/proguard.html 9 | 10 | # Add any project specific keep options here: 11 | 12 | # If your project uses WebView with JS, uncomment the following 13 | # and specify the fully qualified class name to the JavaScript interface 14 | # class: 15 | #-keepclassmembers class fqcn.of.javascript.interface.for.webview { 16 | # public *; 17 | #} 18 | 19 | # Disabling obfuscation is useful if you collect stack traces from production crashes 20 | # (unless you are using a system that supports de-obfuscate the stack traces). 21 | -dontobfuscate 22 | 23 | # React Native 24 | 25 | # Keep our interfaces so they can be used by other ProGuard rules. 26 | # See http://sourceforge.net/p/proguard/bugs/466/ 27 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.DoNotStrip 28 | -keep,allowobfuscation @interface com.facebook.proguard.annotations.KeepGettersAndSetters 29 | -keep,allowobfuscation @interface com.facebook.common.internal.DoNotStrip 30 | 31 | # Do not strip any method/class that is annotated with @DoNotStrip 32 | -keep @com.facebook.proguard.annotations.DoNotStrip class * 33 | -keep @com.facebook.common.internal.DoNotStrip class * 34 | -keepclassmembers class * { 35 | @com.facebook.proguard.annotations.DoNotStrip *; 36 | @com.facebook.common.internal.DoNotStrip *; 37 | } 38 | 39 | -keepclassmembers @com.facebook.proguard.annotations.KeepGettersAndSetters class * { 40 | void set*(***); 41 | *** get*(); 42 | } 43 | 44 | -keep class * extends com.facebook.react.bridge.JavaScriptModule { *; } 45 | -keep class * extends com.facebook.react.bridge.NativeModule { *; } 46 | -keepclassmembers,includedescriptorclasses class * { native ; } 47 | -keepclassmembers class * { @com.facebook.react.uimanager.UIProp ; } 48 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactProp ; } 49 | -keepclassmembers class * { @com.facebook.react.uimanager.annotations.ReactPropGroup ; } 50 | 51 | -dontwarn com.facebook.react.** 52 | 53 | # okhttp 54 | 55 | -keepattributes Signature 56 | -keepattributes *Annotation* 57 | -keep class okhttp3.** { *; } 58 | -keep interface okhttp3.** { *; } 59 | -dontwarn okhttp3.** 60 | 61 | # okio 62 | 63 | -keep class sun.misc.Unsafe { *; } 64 | -dontwarn java.nio.file.* 65 | -dontwarn org.codehaus.mojo.animal_sniffer.IgnoreJRERequirement 66 | -dontwarn okio.** 67 | -------------------------------------------------------------------------------- /example/android/app/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 5 | 6 | 7 | 8 | 9 | 12 | 13 | 19 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 32 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/swipeoutexample/MainActivity.java: -------------------------------------------------------------------------------- 1 | package com.swipeoutexample; 2 | 3 | import com.facebook.react.ReactActivity; 4 | 5 | public class MainActivity extends ReactActivity { 6 | 7 | /** 8 | * Returns the name of the main component registered from JavaScript. 9 | * This is used to schedule rendering of the component. 10 | */ 11 | @Override 12 | protected String getMainComponentName() { 13 | return "swipeoutExample"; 14 | } 15 | } 16 | -------------------------------------------------------------------------------- /example/android/app/src/main/java/com/swipeoutexample/MainApplication.java: -------------------------------------------------------------------------------- 1 | package com.swipeoutexample; 2 | 3 | import android.app.Application; 4 | import android.util.Log; 5 | 6 | import com.facebook.react.ReactApplication; 7 | import com.facebook.react.ReactInstanceManager; 8 | import com.facebook.react.ReactNativeHost; 9 | import com.facebook.react.ReactPackage; 10 | import com.facebook.react.shell.MainReactPackage; 11 | import com.facebook.soloader.SoLoader; 12 | 13 | import java.util.Arrays; 14 | import java.util.List; 15 | 16 | public class MainApplication extends Application implements ReactApplication { 17 | 18 | private final ReactNativeHost mReactNativeHost = new ReactNativeHost(this) { 19 | @Override 20 | public boolean getUseDeveloperSupport() { 21 | return BuildConfig.DEBUG; 22 | } 23 | 24 | @Override 25 | protected List getPackages() { 26 | return Arrays.asList( 27 | new MainReactPackage() 28 | ); 29 | } 30 | }; 31 | 32 | @Override 33 | public ReactNativeHost getReactNativeHost() { 34 | return mReactNativeHost; 35 | } 36 | 37 | @Override 38 | public void onCreate() { 39 | super.onCreate(); 40 | SoLoader.init(this, /* native exopackage */ false); 41 | } 42 | } 43 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dancormier/react-native-swipeout/651d0bf106d2a731f73821990a5ee32d4fd28f2a/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dancormier/react-native-swipeout/651d0bf106d2a731f73821990a5ee32d4fd28f2a/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dancormier/react-native-swipeout/651d0bf106d2a731f73821990a5ee32d4fd28f2a/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dancormier/react-native-swipeout/651d0bf106d2a731f73821990a5ee32d4fd28f2a/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | swipeoutExample 3 | 4 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/styles.xml: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 7 | 8 | 9 | -------------------------------------------------------------------------------- /example/android/build.gradle: -------------------------------------------------------------------------------- 1 | // Top-level build file where you can add configuration options common to all sub-projects/modules. 2 | 3 | buildscript { 4 | repositories { 5 | jcenter() 6 | } 7 | dependencies { 8 | classpath 'com.android.tools.build:gradle:1.3.1' 9 | 10 | // NOTE: Do not place your application dependencies here; they belong 11 | // in the individual module build.gradle files 12 | } 13 | } 14 | 15 | allprojects { 16 | repositories { 17 | mavenLocal() 18 | jcenter() 19 | maven { 20 | // All of React Native (JS, Obj-C sources, Android binaries) is installed from npm 21 | url "$rootDir/../node_modules/react-native/android" 22 | } 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /example/android/gradle.properties: -------------------------------------------------------------------------------- 1 | # Project-wide Gradle settings. 2 | 3 | # IDE (e.g. Android Studio) users: 4 | # Gradle settings configured through the IDE *will override* 5 | # any settings specified in this file. 6 | 7 | # For more details on how to configure your build environment visit 8 | # http://www.gradle.org/docs/current/userguide/build_environment.html 9 | 10 | # Specifies the JVM arguments used for the daemon process. 11 | # The setting is particularly useful for tweaking memory settings. 12 | # Default value: -Xmx10248m -XX:MaxPermSize=256m 13 | # org.gradle.jvmargs=-Xmx2048m -XX:MaxPermSize=512m -XX:+HeapDumpOnOutOfMemoryError -Dfile.encoding=UTF-8 14 | 15 | # When configured, Gradle will run in incubating parallel mode. 16 | # This option should only be used with decoupled projects. More details, visit 17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects 18 | # org.gradle.parallel=true 19 | 20 | android.useDeprecatedNdk=true 21 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/dancormier/react-native-swipeout/651d0bf106d2a731f73821990a5ee32d4fd28f2a/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.properties: -------------------------------------------------------------------------------- 1 | distributionBase=GRADLE_USER_HOME 2 | distributionPath=wrapper/dists 3 | zipStoreBase=GRADLE_USER_HOME 4 | zipStorePath=wrapper/dists 5 | distributionUrl=https\://services.gradle.org/distributions/gradle-2.4-all.zip 6 | -------------------------------------------------------------------------------- /example/android/gradlew: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | ############################################################################## 4 | ## 5 | ## Gradle start up script for UN*X 6 | ## 7 | ############################################################################## 8 | 9 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 10 | DEFAULT_JVM_OPTS="" 11 | 12 | APP_NAME="Gradle" 13 | APP_BASE_NAME=`basename "$0"` 14 | 15 | # Use the maximum available, or set MAX_FD != -1 to use that value. 16 | MAX_FD="maximum" 17 | 18 | warn ( ) { 19 | echo "$*" 20 | } 21 | 22 | die ( ) { 23 | echo 24 | echo "$*" 25 | echo 26 | exit 1 27 | } 28 | 29 | # OS specific support (must be 'true' or 'false'). 30 | cygwin=false 31 | msys=false 32 | darwin=false 33 | case "`uname`" in 34 | CYGWIN* ) 35 | cygwin=true 36 | ;; 37 | Darwin* ) 38 | darwin=true 39 | ;; 40 | MINGW* ) 41 | msys=true 42 | ;; 43 | esac 44 | 45 | # For Cygwin, ensure paths are in UNIX format before anything is touched. 46 | if $cygwin ; then 47 | [ -n "$JAVA_HOME" ] && JAVA_HOME=`cygpath --unix "$JAVA_HOME"` 48 | fi 49 | 50 | # Attempt to set APP_HOME 51 | # Resolve links: $0 may be a link 52 | PRG="$0" 53 | # Need this for relative symlinks. 54 | while [ -h "$PRG" ] ; do 55 | ls=`ls -ld "$PRG"` 56 | link=`expr "$ls" : '.*-> \(.*\)$'` 57 | if expr "$link" : '/.*' > /dev/null; then 58 | PRG="$link" 59 | else 60 | PRG=`dirname "$PRG"`"/$link" 61 | fi 62 | done 63 | SAVED="`pwd`" 64 | cd "`dirname \"$PRG\"`/" >&- 65 | APP_HOME="`pwd -P`" 66 | cd "$SAVED" >&- 67 | 68 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar 69 | 70 | # Determine the Java command to use to start the JVM. 71 | if [ -n "$JAVA_HOME" ] ; then 72 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then 73 | # IBM's JDK on AIX uses strange locations for the executables 74 | JAVACMD="$JAVA_HOME/jre/sh/java" 75 | else 76 | JAVACMD="$JAVA_HOME/bin/java" 77 | fi 78 | if [ ! -x "$JAVACMD" ] ; then 79 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME 80 | 81 | Please set the JAVA_HOME variable in your environment to match the 82 | location of your Java installation." 83 | fi 84 | else 85 | JAVACMD="java" 86 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 87 | 88 | Please set the JAVA_HOME variable in your environment to match the 89 | location of your Java installation." 90 | fi 91 | 92 | # Increase the maximum file descriptors if we can. 93 | if [ "$cygwin" = "false" -a "$darwin" = "false" ] ; then 94 | MAX_FD_LIMIT=`ulimit -H -n` 95 | if [ $? -eq 0 ] ; then 96 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then 97 | MAX_FD="$MAX_FD_LIMIT" 98 | fi 99 | ulimit -n $MAX_FD 100 | if [ $? -ne 0 ] ; then 101 | warn "Could not set maximum file descriptor limit: $MAX_FD" 102 | fi 103 | else 104 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT" 105 | fi 106 | fi 107 | 108 | # For Darwin, add options to specify how the application appears in the dock 109 | if $darwin; then 110 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\"" 111 | fi 112 | 113 | # For Cygwin, switch paths to Windows format before running java 114 | if $cygwin ; then 115 | APP_HOME=`cygpath --path --mixed "$APP_HOME"` 116 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"` 117 | 118 | # We build the pattern for arguments to be converted via cygpath 119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null` 120 | SEP="" 121 | for dir in $ROOTDIRSRAW ; do 122 | ROOTDIRS="$ROOTDIRS$SEP$dir" 123 | SEP="|" 124 | done 125 | OURCYGPATTERN="(^($ROOTDIRS))" 126 | # Add a user-defined pattern to the cygpath arguments 127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then 128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)" 129 | fi 130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh 131 | i=0 132 | for arg in "$@" ; do 133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -` 134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option 135 | 136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition 137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"` 138 | else 139 | eval `echo args$i`="\"$arg\"" 140 | fi 141 | i=$((i+1)) 142 | done 143 | case $i in 144 | (0) set -- ;; 145 | (1) set -- "$args0" ;; 146 | (2) set -- "$args0" "$args1" ;; 147 | (3) set -- "$args0" "$args1" "$args2" ;; 148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;; 149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;; 150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;; 151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;; 152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;; 153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;; 154 | esac 155 | fi 156 | 157 | # Split up the JVM_OPTS And GRADLE_OPTS values into an array, following the shell quoting and substitution rules 158 | function splitJvmOpts() { 159 | JVM_OPTS=("$@") 160 | } 161 | eval splitJvmOpts $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS 162 | JVM_OPTS[${#JVM_OPTS[*]}]="-Dorg.gradle.appname=$APP_BASE_NAME" 163 | 164 | exec "$JAVACMD" "${JVM_OPTS[@]}" -classpath "$CLASSPATH" org.gradle.wrapper.GradleWrapperMain "$@" 165 | -------------------------------------------------------------------------------- /example/android/gradlew.bat: -------------------------------------------------------------------------------- 1 | @if "%DEBUG%" == "" @echo off 2 | @rem ########################################################################## 3 | @rem 4 | @rem Gradle startup script for Windows 5 | @rem 6 | @rem ########################################################################## 7 | 8 | @rem Set local scope for the variables with windows NT shell 9 | if "%OS%"=="Windows_NT" setlocal 10 | 11 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script. 12 | set DEFAULT_JVM_OPTS= 13 | 14 | set DIRNAME=%~dp0 15 | if "%DIRNAME%" == "" set DIRNAME=. 16 | set APP_BASE_NAME=%~n0 17 | set APP_HOME=%DIRNAME% 18 | 19 | @rem Find java.exe 20 | if defined JAVA_HOME goto findJavaFromJavaHome 21 | 22 | set JAVA_EXE=java.exe 23 | %JAVA_EXE% -version >NUL 2>&1 24 | if "%ERRORLEVEL%" == "0" goto init 25 | 26 | echo. 27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 28 | echo. 29 | echo Please set the JAVA_HOME variable in your environment to match the 30 | echo location of your Java installation. 31 | 32 | goto fail 33 | 34 | :findJavaFromJavaHome 35 | set JAVA_HOME=%JAVA_HOME:"=% 36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe 37 | 38 | if exist "%JAVA_EXE%" goto init 39 | 40 | echo. 41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 42 | echo. 43 | echo Please set the JAVA_HOME variable in your environment to match the 44 | echo location of your Java installation. 45 | 46 | goto fail 47 | 48 | :init 49 | @rem Get command-line arguments, handling Windowz variants 50 | 51 | if not "%OS%" == "Windows_NT" goto win9xME_args 52 | if "%@eval[2+2]" == "4" goto 4NT_args 53 | 54 | :win9xME_args 55 | @rem Slurp the command line arguments. 56 | set CMD_LINE_ARGS= 57 | set _SKIP=2 58 | 59 | :win9xME_args_slurp 60 | if "x%~1" == "x" goto execute 61 | 62 | set CMD_LINE_ARGS=%* 63 | goto execute 64 | 65 | :4NT_args 66 | @rem Get arguments from the 4NT Shell from JP Software 67 | set CMD_LINE_ARGS=%$ 68 | 69 | :execute 70 | @rem Setup the command line 71 | 72 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar 73 | 74 | @rem Execute Gradle 75 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS% 76 | 77 | :end 78 | @rem End local scope for the variables with windows NT shell 79 | if "%ERRORLEVEL%"=="0" goto mainEnd 80 | 81 | :fail 82 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of 83 | rem the _cmd.exe /c_ return code! 84 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1 85 | exit /b 1 86 | 87 | :mainEnd 88 | if "%OS%"=="Windows_NT" endlocal 89 | 90 | :omega 91 | -------------------------------------------------------------------------------- /example/android/keystores/BUCK: -------------------------------------------------------------------------------- 1 | keystore( 2 | name = 'debug', 3 | store = 'debug.keystore', 4 | properties = 'debug.keystore.properties', 5 | visibility = [ 6 | 'PUBLIC', 7 | ], 8 | ) 9 | -------------------------------------------------------------------------------- /example/android/keystores/debug.keystore.properties: -------------------------------------------------------------------------------- 1 | key.store=debug.keystore 2 | key.alias=androiddebugkey 3 | key.store.password=android 4 | key.alias.password=android 5 | -------------------------------------------------------------------------------- /example/android/settings.gradle: -------------------------------------------------------------------------------- 1 | rootProject.name = 'swipeoutExample' 2 | 3 | include ':app' 4 | -------------------------------------------------------------------------------- /example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swipeoutExample", 3 | "displayName": "swipeoutExample" 4 | } -------------------------------------------------------------------------------- /example/data.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import {Image} from 'react-native'; 3 | 4 | var btnsDefault = [ { text: 'Button' } ]; 5 | 6 | var btnsTypes = [ 7 | { text: 'Primary', type: 'primary', }, 8 | { text: 'Secondary', type: 'secondary', }, 9 | { text: 'Delete', type: 'delete', } 10 | ]; 11 | 12 | var rows = [ 13 | { 14 | text: "Basic Example", 15 | right: btnsDefault, 16 | }, { 17 | text: "onPress Callback", 18 | right: [ 19 | { 20 | text: 'Press Me', 21 | onPress: function(){ alert('button pressed') }, 22 | type: 'primary', 23 | } 24 | ], 25 | }, { 26 | text: "Button Types", 27 | right: btnsTypes, 28 | }, { 29 | text: "Button with custom styling", 30 | right: [ 31 | { 32 | text: 'Button', 33 | backgroundColor: '#4fba8a', 34 | color: '#17807a', 35 | underlayColor: "#006fff", 36 | } 37 | ], 38 | }, 39 | { 40 | text: "Overswipe background color (drag me far)", 41 | right: btnsDefault, 42 | backgroundColor: '#006fff', 43 | }, { 44 | text: "Swipeout autoClose={true}", 45 | right: btnsDefault, 46 | autoClose: true, 47 | }, { 48 | text: "Five buttons (full-width) + autoClose={true}", 49 | right: [ 50 | { text: 'One'}, 51 | { text: 'Two'}, 52 | { text: 'Three' }, 53 | { text: 'Four' }, 54 | { text: 'Five' } 55 | ], 56 | autoClose: true, 57 | }, { 58 | text: "Custom button component", 59 | right: [ 60 | { 61 | component: 62 | } 63 | ], 64 | }, { 65 | text: "Swipe me right (buttons on left side)", 66 | left: btnsDefault, 67 | }, { 68 | text: "Buttons on both sides", 69 | left: btnsTypes, 70 | right: btnsTypes, 71 | }, 72 | ]; 73 | 74 | export default rows; 75 | -------------------------------------------------------------------------------- /example/index.android.js: -------------------------------------------------------------------------------- 1 | import SwipeoutExample from './SwipeoutExample'; 2 | import { 3 | AppRegistry, 4 | } from 'react-native'; 5 | 6 | AppRegistry.registerComponent('swipeoutExample', () => SwipeoutExample); 7 | -------------------------------------------------------------------------------- /example/index.ios.js: -------------------------------------------------------------------------------- 1 | import SwipeoutExample from './SwipeoutExample'; 2 | import { 3 | AppRegistry, 4 | } from 'react-native'; 5 | 6 | AppRegistry.registerComponent('swipeoutExample', () => SwipeoutExample); 7 | -------------------------------------------------------------------------------- /example/ios/swipeoutExample-tvOS/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | APPL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | LSRequiresIPhoneOS 24 | 25 | UILaunchStoryboardName 26 | LaunchScreen 27 | UIRequiredDeviceCapabilities 28 | 29 | armv7 30 | 31 | UISupportedInterfaceOrientations 32 | 33 | UIInterfaceOrientationPortrait 34 | UIInterfaceOrientationLandscapeLeft 35 | UIInterfaceOrientationLandscapeRight 36 | 37 | UIViewControllerBasedStatusBarAppearance 38 | 39 | NSLocationWhenInUseUsageDescription 40 | 41 | NSAppTransportSecurity 42 | 43 | 44 | NSExceptionDomains 45 | 46 | localhost 47 | 48 | NSExceptionAllowsInsecureHTTPLoads 49 | 50 | 51 | 52 | 53 | 54 | 55 | -------------------------------------------------------------------------------- /example/ios/swipeoutExample-tvOSTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /example/ios/swipeoutExample.xcodeproj/xcshareddata/xcschemes/swipeoutExample-tvOS.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /example/ios/swipeoutExample.xcodeproj/xcshareddata/xcschemes/swipeoutExample.xcscheme: -------------------------------------------------------------------------------- 1 | 2 | 5 | 8 | 9 | 15 | 21 | 22 | 23 | 29 | 35 | 36 | 37 | 43 | 49 | 50 | 51 | 52 | 53 | 58 | 59 | 61 | 67 | 68 | 69 | 70 | 71 | 77 | 78 | 79 | 80 | 81 | 82 | 92 | 94 | 100 | 101 | 102 | 103 | 104 | 105 | 111 | 113 | 119 | 120 | 121 | 122 | 124 | 125 | 128 | 129 | 130 | -------------------------------------------------------------------------------- /example/ios/swipeoutExample/AppDelegate.h: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | @interface AppDelegate : UIResponder 13 | 14 | @property (nonatomic, strong) UIWindow *window; 15 | 16 | @end 17 | -------------------------------------------------------------------------------- /example/ios/swipeoutExample/AppDelegate.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import "AppDelegate.h" 11 | 12 | #import 13 | #import 14 | 15 | @implementation AppDelegate 16 | 17 | - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions 18 | { 19 | NSURL *jsCodeLocation; 20 | 21 | jsCodeLocation = [[RCTBundleURLProvider sharedSettings] jsBundleURLForBundleRoot:@"index.ios" fallbackResource:nil]; 22 | 23 | RCTRootView *rootView = [[RCTRootView alloc] initWithBundleURL:jsCodeLocation 24 | moduleName:@"swipeoutExample" 25 | initialProperties:nil 26 | launchOptions:launchOptions]; 27 | rootView.backgroundColor = [[UIColor alloc] initWithRed:1.0f green:1.0f blue:1.0f alpha:1]; 28 | 29 | self.window = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds]; 30 | UIViewController *rootViewController = [UIViewController new]; 31 | rootViewController.view = rootView; 32 | self.window.rootViewController = rootViewController; 33 | [self.window makeKeyAndVisible]; 34 | return YES; 35 | } 36 | 37 | @end 38 | -------------------------------------------------------------------------------- /example/ios/swipeoutExample/Base.lproj/LaunchScreen.xib: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 21 | 27 | 28 | 29 | 30 | 31 | 32 | 33 | 34 | 35 | 36 | 37 | 38 | 39 | 40 | 41 | 42 | 43 | -------------------------------------------------------------------------------- /example/ios/swipeoutExample/Images.xcassets/AppIcon.appiconset/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "images" : [ 3 | { 4 | "idiom" : "iphone", 5 | "size" : "29x29", 6 | "scale" : "2x" 7 | }, 8 | { 9 | "idiom" : "iphone", 10 | "size" : "29x29", 11 | "scale" : "3x" 12 | }, 13 | { 14 | "idiom" : "iphone", 15 | "size" : "40x40", 16 | "scale" : "2x" 17 | }, 18 | { 19 | "idiom" : "iphone", 20 | "size" : "40x40", 21 | "scale" : "3x" 22 | }, 23 | { 24 | "idiom" : "iphone", 25 | "size" : "60x60", 26 | "scale" : "2x" 27 | }, 28 | { 29 | "idiom" : "iphone", 30 | "size" : "60x60", 31 | "scale" : "3x" 32 | } 33 | ], 34 | "info" : { 35 | "version" : 1, 36 | "author" : "xcode" 37 | } 38 | } -------------------------------------------------------------------------------- /example/ios/swipeoutExample/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleDisplayName 8 | swipeoutExample 9 | CFBundleExecutable 10 | $(EXECUTABLE_NAME) 11 | CFBundleIdentifier 12 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 13 | CFBundleInfoDictionaryVersion 14 | 6.0 15 | CFBundleName 16 | $(PRODUCT_NAME) 17 | CFBundlePackageType 18 | APPL 19 | CFBundleShortVersionString 20 | 1.0 21 | CFBundleSignature 22 | ???? 23 | CFBundleVersion 24 | 1 25 | LSRequiresIPhoneOS 26 | 27 | UILaunchStoryboardName 28 | LaunchScreen 29 | UIRequiredDeviceCapabilities 30 | 31 | armv7 32 | 33 | UISupportedInterfaceOrientations 34 | 35 | UIInterfaceOrientationPortrait 36 | UIInterfaceOrientationLandscapeLeft 37 | UIInterfaceOrientationLandscapeRight 38 | 39 | UIViewControllerBasedStatusBarAppearance 40 | 41 | NSLocationWhenInUseUsageDescription 42 | 43 | NSAppTransportSecurity 44 | 45 | 46 | NSExceptionDomains 47 | 48 | localhost 49 | 50 | NSExceptionAllowsInsecureHTTPLoads 51 | 52 | 53 | 54 | 55 | 56 | 57 | -------------------------------------------------------------------------------- /example/ios/swipeoutExample/main.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | 12 | #import "AppDelegate.h" 13 | 14 | int main(int argc, char * argv[]) { 15 | @autoreleasepool { 16 | return UIApplicationMain(argc, argv, nil, NSStringFromClass([AppDelegate class])); 17 | } 18 | } 19 | -------------------------------------------------------------------------------- /example/ios/swipeoutExampleTests/Info.plist: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | CFBundleDevelopmentRegion 6 | en 7 | CFBundleExecutable 8 | $(EXECUTABLE_NAME) 9 | CFBundleIdentifier 10 | org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier) 11 | CFBundleInfoDictionaryVersion 12 | 6.0 13 | CFBundleName 14 | $(PRODUCT_NAME) 15 | CFBundlePackageType 16 | BNDL 17 | CFBundleShortVersionString 18 | 1.0 19 | CFBundleSignature 20 | ???? 21 | CFBundleVersion 22 | 1 23 | 24 | 25 | -------------------------------------------------------------------------------- /example/ios/swipeoutExampleTests/swipeoutExampleTests.m: -------------------------------------------------------------------------------- 1 | /** 2 | * Copyright (c) 2015-present, Facebook, Inc. 3 | * All rights reserved. 4 | * 5 | * This source code is licensed under the BSD-style license found in the 6 | * LICENSE file in the root directory of this source tree. An additional grant 7 | * of patent rights can be found in the PATENTS file in the same directory. 8 | */ 9 | 10 | #import 11 | #import 12 | 13 | #import 14 | #import 15 | 16 | #define TIMEOUT_SECONDS 600 17 | #define TEXT_TO_LOOK_FOR @"Welcome to React Native!" 18 | 19 | @interface swipeoutExampleTests : XCTestCase 20 | 21 | @end 22 | 23 | @implementation swipeoutExampleTests 24 | 25 | - (BOOL)findSubviewInView:(UIView *)view matching:(BOOL(^)(UIView *view))test 26 | { 27 | if (test(view)) { 28 | return YES; 29 | } 30 | for (UIView *subview in [view subviews]) { 31 | if ([self findSubviewInView:subview matching:test]) { 32 | return YES; 33 | } 34 | } 35 | return NO; 36 | } 37 | 38 | - (void)testRendersWelcomeScreen 39 | { 40 | UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController]; 41 | NSDate *date = [NSDate dateWithTimeIntervalSinceNow:TIMEOUT_SECONDS]; 42 | BOOL foundElement = NO; 43 | 44 | __block NSString *redboxError = nil; 45 | RCTSetLogFunction(^(RCTLogLevel level, RCTLogSource source, NSString *fileName, NSNumber *lineNumber, NSString *message) { 46 | if (level >= RCTLogLevelError) { 47 | redboxError = message; 48 | } 49 | }); 50 | 51 | while ([date timeIntervalSinceNow] > 0 && !foundElement && !redboxError) { 52 | [[NSRunLoop mainRunLoop] runMode:NSDefaultRunLoopMode beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 53 | [[NSRunLoop mainRunLoop] runMode:NSRunLoopCommonModes beforeDate:[NSDate dateWithTimeIntervalSinceNow:0.1]]; 54 | 55 | foundElement = [self findSubviewInView:vc.view matching:^BOOL(UIView *view) { 56 | if ([view.accessibilityLabel isEqualToString:TEXT_TO_LOOK_FOR]) { 57 | return YES; 58 | } 59 | return NO; 60 | }]; 61 | } 62 | 63 | RCTSetLogFunction(RCTDefaultLogFunction); 64 | 65 | XCTAssertNil(redboxError, @"RedBox error: %@", redboxError); 66 | XCTAssertTrue(foundElement, @"Couldn't find element with text '%@' in %d seconds", TEXT_TO_LOOK_FOR, TIMEOUT_SECONDS); 67 | } 68 | 69 | 70 | @end 71 | -------------------------------------------------------------------------------- /example/package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "swipeoutExample", 3 | "version": "0.0.1", 4 | "private": true, 5 | "scripts": { 6 | "start": "node node_modules/react-native/local-cli/cli.js start" 7 | }, 8 | "dependencies": { 9 | "react": "~15.4.0", 10 | "react-native": "0.41.2", 11 | "react-native-swipeout": "file:../" 12 | }, 13 | "devDependencies": { 14 | "babel-preset-react-native": "1.9.1" 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /example/styles.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import { StyleSheet } from 'react-native'; 3 | 4 | var styles = StyleSheet.create({ 5 | container: { 6 | backgroundColor: '#f2f2f2', 7 | flex: 1, 8 | }, 9 | listview: { 10 | flex: 1, 11 | }, 12 | li: { 13 | backgroundColor: '#fff', 14 | borderBottomColor: '#eee', 15 | borderColor: 'transparent', 16 | borderWidth: 1, 17 | paddingLeft: 16, 18 | paddingTop: 14, 19 | paddingBottom: 16, 20 | }, 21 | liContainer: { 22 | flex: 2, 23 | }, 24 | liText: { 25 | color: '#333', 26 | fontSize: 16, 27 | }, 28 | navbar: { 29 | alignItems: 'center', 30 | backgroundColor: '#fff', 31 | borderBottomColor: '#eee', 32 | borderColor: 'transparent', 33 | borderWidth: 1, 34 | justifyContent: 'center', 35 | height: 44, 36 | }, 37 | navbarTitle: { 38 | color: '#444', 39 | fontSize: 16, 40 | fontWeight: "500", 41 | }, 42 | statusbar: { 43 | backgroundColor: '#fff', 44 | height: 22, 45 | } 46 | }) 47 | 48 | module.exports = styles 49 | -------------------------------------------------------------------------------- /index.d.ts: -------------------------------------------------------------------------------- 1 | import * as React from 'react'; 2 | 3 | declare module 'react-native-swipeout' { 4 | export interface SwipeoutButtonProperties { 5 | backgroundColor?: string; 6 | color?: string; 7 | component?: JSX.Element; 8 | onPress?(): void; 9 | text?: React.ReactNode; 10 | type?: 'default'|'delete'|'primary'|'secondary'; 11 | underlayColor?: string; 12 | disabled?: boolean; 13 | } 14 | 15 | export interface SwipeoutProperties { 16 | autoClose?: boolean; 17 | backgroundColor?: string; 18 | close?: boolean; 19 | disabled?: boolean; 20 | left?: SwipeoutButtonProperties[]; 21 | onOpen?(sectionId: number, rowId: number, direction: string): void; 22 | onClose?(sectionId: number, rowId: number, direction: string): void; 23 | right?: SwipeoutButtonProperties[]; 24 | scroll?(scrollEnabled: boolean): void; 25 | style?: Object; 26 | sensitivity?: number; 27 | buttonWidth?: number; 28 | rowId?: number; 29 | sectionId?: number; 30 | openRight?: boolean; 31 | openLeft?: boolean; 32 | } 33 | 34 | export default class Swipeout extends React.Component {} 35 | } 36 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "react-native-swipeout", 3 | "version": "2.3.6", 4 | "description": "iOS-style swipeout buttons behind component", 5 | "main": "dist/index.js", 6 | "types": "index.d.ts", 7 | "scripts": { 8 | "build": "rm -rf dist && cross-env BABEL_ENV=commonjs babel src --out-dir dist", 9 | "test": "echo \"Error: no test specified\" && exit 1" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git@github.com:dancormier/react-native-swipeout.git" 14 | }, 15 | "keywords": [ 16 | "react-native", 17 | "react-component", 18 | "ios", 19 | "swipeout", 20 | "button", 21 | "swipe", 22 | "ui" 23 | ], 24 | "author": "Dan Cormier", 25 | "license": "MIT", 26 | "bugs": { 27 | "url": "https://github.com/dancormier/react-native-swipeout/issues" 28 | }, 29 | "homepage": "https://github.com/dancormier/react-native-swipeout", 30 | "dependencies": { 31 | "create-react-class": "^15.6.0", 32 | "prop-types": "^15.5.10", 33 | "react-tween-state": "^0.1.5" 34 | }, 35 | "devDependencies": { 36 | "babel-cli": "^6.11.4", 37 | "babel-eslint": "^8.0.0", 38 | "babel-preset-es2015": "^6.24.1", 39 | "babel-preset-react": "^6.24.1", 40 | "babel-preset-stage-2": "^6.24.1", 41 | "cross-env": "^5.0.5" 42 | } 43 | } 44 | -------------------------------------------------------------------------------- /src/NativeButton.js: -------------------------------------------------------------------------------- 1 | import React from 'react'; 2 | import PropTypes from 'prop-types'; 3 | import createReactClass from 'create-react-class'; 4 | 5 | import { 6 | TouchableWithoutFeedback, 7 | TouchableNativeFeedback, 8 | TouchableHighlight, 9 | Text, 10 | StyleSheet, 11 | Platform, 12 | View, 13 | } from 'react-native'; 14 | 15 | const styles = StyleSheet.create({ 16 | button: { 17 | flexDirection: 'row', 18 | alignSelf: 'stretch', 19 | justifyContent: 'center', 20 | }, 21 | textButton: { 22 | fontSize: 14, 23 | alignSelf: 'center', 24 | }, 25 | opacity: { 26 | opacity: 0.8, 27 | }, 28 | }); 29 | 30 | const NativeButton = createReactClass({ 31 | 32 | propTypes: { 33 | // Extract parent props 34 | ...TouchableWithoutFeedback.propTypes, 35 | textStyle: PropTypes.any, 36 | disabledStyle: PropTypes.any, 37 | children: PropTypes.node.isRequired, 38 | underlayColor: PropTypes.string, 39 | background: PropTypes.any, 40 | }, 41 | 42 | statics: { 43 | isAndroid: (Platform.OS === 'android'), 44 | }, 45 | 46 | getDefaultProps: function () { 47 | return { 48 | textStyle: null, 49 | disabledStyle: null, 50 | underlayColor: null, 51 | }; 52 | }, 53 | 54 | _renderText: function () { 55 | // If children is not a string don't wrapp it in a Text component 56 | if (typeof this.props.children !== 'string') { 57 | return this.props.children; 58 | } 59 | 60 | return ( 61 | 62 | {this.props.children} 63 | 64 | ); 65 | }, 66 | 67 | render: function () { 68 | const disabledStyle = this.props.disabled ? (this.props.disabledStyle || styles.opacity) : {}; 69 | 70 | // Extract Button props 71 | let buttonProps = { 72 | accessibilityComponentType: this.props.accessibilityComponentType, 73 | accessibilityTraits: this.props.accessibilityTraits, 74 | accessible: this.props.accessible, 75 | delayLongPress: this.props.delayLongPress, 76 | delayPressIn: this.props.delayPressIn, 77 | delayPressOut: this.props.delayPressOut, 78 | disabled: this.props.disabled, 79 | hitSlop: this.props.hitSlop, 80 | onLayout: this.props.onLayout, 81 | onPress: this.props.onPress, 82 | onPressIn: this.props.onPressIn, 83 | onPressOut: this.props.onPressOut, 84 | onLongPress: this.props.onLongPress, 85 | pressRetentionOffset: this.props.pressRetentionOffset, 86 | }; 87 | 88 | // Render Native Android Button 89 | if (NativeButton.isAndroid) { 90 | buttonProps = Object.assign(buttonProps, { 91 | background: this.props.background || TouchableNativeFeedback.SelectableBackground(), 92 | }); 93 | 94 | return ( 95 | 97 | 98 | {this._renderText()} 99 | 100 | 101 | ); 102 | } 103 | 104 | // Render default button 105 | return ( 106 | 110 | {this._renderText()} 111 | 112 | ); 113 | } 114 | }); 115 | 116 | export default NativeButton; 117 | -------------------------------------------------------------------------------- /src/index.js: -------------------------------------------------------------------------------- 1 | import tweenState from 'react-tween-state'; 2 | import NativeButton from './NativeButton'; 3 | import styles from './styles'; 4 | 5 | import React, { 6 | Component, 7 | } from 'react'; 8 | import PropTypes from 'prop-types'; 9 | import createReactClass from 'create-react-class'; 10 | 11 | import { 12 | PanResponder, 13 | TouchableHighlight, 14 | StyleSheet, 15 | Text, 16 | View, 17 | ViewPropTypes, 18 | } from 'react-native'; 19 | 20 | const SwipeoutBtn = createReactClass({ 21 | 22 | propTypes: { 23 | backgroundColor: PropTypes.string, 24 | color: PropTypes.string, 25 | component: PropTypes.node, 26 | onPress: PropTypes.func, 27 | text: PropTypes.node, 28 | type: PropTypes.string, 29 | underlayColor: PropTypes.string, 30 | }, 31 | 32 | getDefaultProps: function () { 33 | return { 34 | backgroundColor: null, 35 | color: null, 36 | component: null, 37 | underlayColor: null, 38 | height: 0, 39 | onPress: null, 40 | disabled: false, 41 | text: 'Click me', 42 | type: '', 43 | width: 0, 44 | }; 45 | }, 46 | 47 | render: function () { 48 | var btn = this.props; 49 | 50 | var styleSwipeoutBtn = [styles.swipeoutBtn]; 51 | 52 | // apply "type" styles (delete || primary || secondary) 53 | if (btn.type === 'delete') styleSwipeoutBtn.push(styles.colorDelete); 54 | else if (btn.type === 'primary') styleSwipeoutBtn.push(styles.colorPrimary); 55 | else if (btn.type === 'secondary') styleSwipeoutBtn.push(styles.colorSecondary); 56 | 57 | // apply background color 58 | if (btn.backgroundColor) styleSwipeoutBtn.push([{ backgroundColor: btn.backgroundColor }]); 59 | 60 | styleSwipeoutBtn.push([{ 61 | height: btn.height, 62 | width: btn.width, 63 | }]); 64 | 65 | var styleSwipeoutBtnComponent = []; 66 | 67 | // set button dimensions 68 | styleSwipeoutBtnComponent.push([{ 69 | height: btn.height, 70 | width: btn.width, 71 | }]); 72 | 73 | var styleSwipeoutBtnText = [styles.swipeoutBtnText]; 74 | 75 | // apply text color 76 | if (btn.color) styleSwipeoutBtnText.push({color: btn.color }); 77 | 78 | return ( 79 | 85 | { 86 | (btn.component ? 87 | {btn.component} 88 | : 89 | btn.text 90 | ) 91 | } 92 | 93 | ); 94 | } 95 | }); 96 | 97 | const Swipeout = createReactClass({ 98 | mixins: [tweenState.Mixin], 99 | 100 | propTypes: { 101 | autoClose: PropTypes.bool, 102 | backgroundColor: PropTypes.string, 103 | close: PropTypes.bool, 104 | left: PropTypes.array, 105 | onOpen: PropTypes.func, 106 | onClose: PropTypes.func, 107 | right: PropTypes.array, 108 | scroll: PropTypes.func, 109 | style: (ViewPropTypes || View.propTypes).style, 110 | sensitivity: PropTypes.number, 111 | buttonWidth: PropTypes.number, 112 | disabled: PropTypes.bool, 113 | }, 114 | 115 | getDefaultProps: function () { 116 | return { 117 | disabled: false, 118 | rowID: -1, 119 | sectionID: -1, 120 | sensitivity: 50, 121 | }; 122 | }, 123 | 124 | getInitialState: function () { 125 | return { 126 | autoClose: this.props.autoClose || false, 127 | btnWidth: 0, 128 | btnsLeftWidth: 0, 129 | btnsRightWidth: 0, 130 | contentHeight: 0, 131 | contentPos: 0, 132 | contentWidth: 0, 133 | openedRight: false, 134 | swiping: false, 135 | tweenDuration: 160, 136 | timeStart: null, 137 | }; 138 | }, 139 | 140 | componentWillMount: function () { 141 | this._panResponder = PanResponder.create({ 142 | onStartShouldSetPanResponder: (event, gestureState) => true, 143 | onStartShouldSetPanResponderCapture: (event, gestureState) => 144 | this.state.openedLeft || this.state.openedRight, 145 | onMoveShouldSetPanResponderCapture: (event, gestureState) => 146 | Math.abs(gestureState.dx) > this.props.sensitivity && 147 | Math.abs(gestureState.dy) <= this.props.sensitivity, 148 | onPanResponderGrant: this._handlePanResponderGrant, 149 | onPanResponderMove: this._handlePanResponderMove, 150 | onPanResponderRelease: this._handlePanResponderEnd, 151 | onPanResponderTerminate: this._handlePanResponderEnd, 152 | onShouldBlockNativeResponder: (event, gestureState) => false, 153 | onPanResponderTerminationRequest: () => false, 154 | }); 155 | }, 156 | 157 | componentWillReceiveProps: function (nextProps) { 158 | if (nextProps.close) this._close(); 159 | if (nextProps.openRight) this._openRight(); 160 | if (nextProps.openLeft) this._openLeft(); 161 | }, 162 | 163 | _handlePanResponderGrant: function (e: Object, gestureState: Object) { 164 | if (this.props.disabled) return; 165 | if (!this.state.openedLeft && !this.state.openedRight) { 166 | this._callOnOpen(); 167 | } else { 168 | this._callOnClose(); 169 | } 170 | this.swipeoutContent.measure((ox, oy, width, height) => { 171 | let buttonWidth = this.props.buttonWidth || (width / 5); 172 | this.setState({ 173 | btnWidth: buttonWidth, 174 | btnsLeftWidth: this.props.left ? buttonWidth * this.props.left.length : 0, 175 | btnsRightWidth: this.props.right ? buttonWidth * this.props.right.length : 0, 176 | swiping: true, 177 | timeStart: (new Date()).getTime(), 178 | }); 179 | }); 180 | }, 181 | 182 | _handlePanResponderMove: function (e: Object, gestureState: Object) { 183 | if (this.props.disabled) return; 184 | var posX = gestureState.dx; 185 | var posY = gestureState.dy; 186 | var leftWidth = this.state.btnsLeftWidth; 187 | var rightWidth = this.state.btnsRightWidth; 188 | if (this.state.openedRight) var posX = gestureState.dx - rightWidth; 189 | else if (this.state.openedLeft) var posX = gestureState.dx + leftWidth; 190 | 191 | // prevent scroll if moveX is true 192 | var moveX = Math.abs(posX) > Math.abs(posY); 193 | if (this.props.scroll) { 194 | if (moveX) this.props.scroll(false); 195 | else this.props.scroll(true); 196 | } 197 | if (this.state.swiping) { 198 | // move content to reveal swipeout 199 | if (posX < 0 && this.props.right) { 200 | this.setState({ contentPos: Math.min(posX, 0) }) 201 | } else if (posX > 0 && this.props.left) { 202 | this.setState({ contentPos: Math.max(posX, 0) }) 203 | }; 204 | } 205 | }, 206 | 207 | _handlePanResponderEnd: function (e: Object, gestureState: Object) { 208 | if (this.props.disabled) return; 209 | var posX = gestureState.dx; 210 | var contentPos = this.state.contentPos; 211 | var contentWidth = this.state.contentWidth; 212 | var btnsLeftWidth = this.state.btnsLeftWidth; 213 | var btnsRightWidth = this.state.btnsRightWidth; 214 | 215 | // minimum threshold to open swipeout 216 | var openX = contentWidth * 0.33; 217 | 218 | // should open swipeout 219 | var openLeft = posX > openX || posX > btnsLeftWidth / 2; 220 | var openRight = posX < -openX || posX < -btnsRightWidth / 2; 221 | 222 | // account for open swipeouts 223 | if (this.state.openedRight) var openRight = posX - openX < -openX; 224 | if (this.state.openedLeft) var openLeft = posX + openX > openX; 225 | 226 | // reveal swipeout on quick swipe 227 | var timeDiff = (new Date()).getTime() - this.state.timeStart < 200; 228 | if (timeDiff) { 229 | var openRight = posX < -openX / 10 && !this.state.openedLeft; 230 | var openLeft = posX > openX / 10 && !this.state.openedRight; 231 | } 232 | 233 | if (this.state.swiping) { 234 | if (openRight && contentPos < 0 && posX < 0) { 235 | this._open(-btnsRightWidth, 'right'); 236 | } else if (openLeft && contentPos > 0 && posX > 0) { 237 | this._open(btnsLeftWidth, 'left'); 238 | } else { 239 | this._close(); 240 | } 241 | } 242 | 243 | // Allow scroll 244 | if (this.props.scroll) this.props.scroll(true); 245 | }, 246 | 247 | _tweenContent: function (state, endValue) { 248 | this.tweenState(state, { 249 | easing: tweenState.easingTypes.easeInOutQuad, 250 | duration: endValue === 0 ? this.state.tweenDuration * 1.5 : this.state.tweenDuration, 251 | endValue: endValue, 252 | }); 253 | }, 254 | 255 | _rubberBandEasing: function (value, limit) { 256 | if (value < 0 && value < limit) return limit - Math.pow(limit - value, 0.85); 257 | else if (value > 0 && value > limit) return limit + Math.pow(value - limit, 0.85); 258 | return value; 259 | }, 260 | 261 | // close swipeout on button press 262 | _autoClose: function (btn) { 263 | if (this.state.autoClose) this._close(); 264 | var onPress = btn.onPress; 265 | if (onPress) onPress(); 266 | }, 267 | 268 | _open: function (contentPos, direction) { 269 | const left = direction === 'left'; 270 | const { sectionID, rowID, onOpen } = this.props; 271 | onOpen && onOpen(sectionID, rowID, direction); 272 | this._tweenContent('contentPos', contentPos); 273 | this.setState({ 274 | contentPos, 275 | openedLeft: left, 276 | openedRight: !left, 277 | swiping: false, 278 | }); 279 | }, 280 | 281 | _close: function () { 282 | const { sectionID, rowID, onClose } = this.props; 283 | if (onClose && (this.state.openedLeft || this.state.openedRight)) { 284 | const direction = this.state.openedRight ? 'right' : 'left'; 285 | onClose(sectionID, rowID, direction); 286 | } 287 | this._tweenContent('contentPos', 0); 288 | this._callOnClose(); 289 | this.setState({ 290 | openedRight: false, 291 | openedLeft: false, 292 | swiping: false, 293 | }); 294 | }, 295 | 296 | _callOnClose: function () { 297 | if (this.props.onClose) this.props.onClose(this.props.sectionID, this.props.rowID); 298 | }, 299 | 300 | _callOnOpen: function () { 301 | if (this.props.onOpen) this.props.onOpen(this.props.sectionID, this.props.rowID); 302 | }, 303 | 304 | _openRight: function () { 305 | this.swipeoutContent.measure((ox, oy, width, height) => { 306 | let btnWidth = this.props.buttonWidth || (width / 5); 307 | 308 | this.setState({ 309 | btnWidth, 310 | btnsRightWidth: this.props.right ? btnWidth * this.props.right.length : 0, 311 | }, () => { 312 | this._tweenContent('contentPos', -this.state.btnsRightWidth); 313 | this._callOnOpen(); 314 | this.setState({ 315 | contentPos: -this.state.btnsRightWidth, 316 | openedLeft: false, 317 | openedRight: true, 318 | swiping: false 319 | }); 320 | }); 321 | }); 322 | }, 323 | 324 | _openLeft: function () { 325 | this.swipeoutContent.measure((ox, oy, width, height) => { 326 | let btnWidth = this.props.buttonWidth || (width / 5); 327 | 328 | this.setState({ 329 | btnWidth, 330 | btnsLeftWidth: this.props.left ? btnWidth * this.props.left.length : 0, 331 | }, () => { 332 | this._tweenContent('contentPos', this.state.btnsLeftWidth); 333 | this._callOnOpen(); 334 | this.setState({ 335 | contentPos: this.state.btnsLeftWidth, 336 | openedLeft: true, 337 | openedRight: false, 338 | swiping: false 339 | }); 340 | }); 341 | }); 342 | }, 343 | 344 | render: function () { 345 | var contentWidth = this.state.contentWidth; 346 | var posX = this.getTweeningValue('contentPos'); 347 | 348 | var styleSwipeout = [styles.swipeout, this.props.style]; 349 | if (this.props.backgroundColor) { 350 | styleSwipeout.push([{ backgroundColor: this.props.backgroundColor }]); 351 | } 352 | 353 | var limit = -this.state.btnsRightWidth; 354 | if (posX > 0) var limit = this.state.btnsLeftWidth; 355 | 356 | var styleLeftPos = { 357 | left: { 358 | left: 0, 359 | overflow: 'hidden', 360 | width: Math.min(limit * (posX / limit), limit), 361 | }, 362 | }; 363 | var styleRightPos = { 364 | right: { 365 | left: Math.abs(contentWidth + Math.max(limit, posX)), 366 | right: 0, 367 | }, 368 | }; 369 | var styleContentPos = { 370 | content: { 371 | transform: [{ translateX: this._rubberBandEasing(posX, limit) }], 372 | }, 373 | }; 374 | 375 | var styleContent = [styles.swipeoutContent]; 376 | styleContent.push(styleContentPos.content); 377 | 378 | var styleRight = [styles.swipeoutBtns]; 379 | styleRight.push(styleRightPos.right); 380 | 381 | var styleLeft = [styles.swipeoutBtns]; 382 | styleLeft.push(styleLeftPos.left); 383 | 384 | var isRightVisible = posX < 0; 385 | var isLeftVisible = posX > 0; 386 | 387 | return ( 388 | 389 | this.swipeoutContent = node} 391 | style={styleContent} 392 | onLayout={this._onLayout} 393 | {...this._panResponder.panHandlers} 394 | > 395 | {this.props.children} 396 | 397 | {this._renderButtons(this.props.right, isRightVisible, styleRight)} 398 | {this._renderButtons(this.props.left, isLeftVisible, styleLeft)} 399 | 400 | ); 401 | }, 402 | 403 | _onLayout: function (event) { 404 | var { width, height } = event.nativeEvent.layout; 405 | this.setState({ 406 | contentWidth: width, 407 | contentHeight: height, 408 | }); 409 | }, 410 | 411 | _renderButtons: function (buttons, isVisible, style) { 412 | if (buttons && isVisible) { 413 | return ( 414 | {buttons.map(this._renderButton)} 415 | ); 416 | } else { 417 | return ( 418 | 419 | ); 420 | } 421 | }, 422 | 423 | _renderButton: function (btn, i) { 424 | return ( 425 | this._autoClose(btn)} 433 | text={btn.text} 434 | type={btn.type} 435 | underlayColor={btn.underlayColor} 436 | width={this.state.btnWidth} 437 | /> 438 | ); 439 | } 440 | }) 441 | 442 | Swipeout.NativeButton = NativeButton; 443 | Swipeout.SwipeoutButton = SwipeoutBtn; 444 | 445 | export default Swipeout; 446 | -------------------------------------------------------------------------------- /src/styles.js: -------------------------------------------------------------------------------- 1 | import { 2 | StyleSheet, 3 | } from 'react-native'; 4 | 5 | const styles = StyleSheet.create({ 6 | swipeout: { 7 | backgroundColor: '#dbddde', 8 | overflow: 'hidden', 9 | }, 10 | swipeoutBtnTouchable: { 11 | flex: 1, 12 | }, 13 | swipeoutBtn: { 14 | alignItems: 'center', 15 | backgroundColor: '#b6bec0', 16 | flex: 1, 17 | justifyContent: 'center', 18 | overflow: 'hidden', 19 | }, 20 | swipeoutBtnText: { 21 | color: '#fff', 22 | textAlign: 'center', 23 | }, 24 | swipeoutBtns: { 25 | bottom: 0, 26 | flex: 1, 27 | flexDirection: 'row', 28 | position: 'absolute', 29 | right: 0, 30 | top: 0, 31 | }, 32 | swipeoutContent: { 33 | }, 34 | colorDelete: { 35 | backgroundColor: '#fb3d38', 36 | }, 37 | colorPrimary: { 38 | backgroundColor: '#006fff' 39 | }, 40 | colorSecondary: { 41 | backgroundColor: '#fd9427' 42 | }, 43 | }) 44 | 45 | export default styles; 46 | --------------------------------------------------------------------------------