Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
93 commits
Select commit Hold shift + click to select a range
92dfa15
add onSnapStart event
gabeboning Aug 31, 2017
063de0d
update docs
gabeboning Aug 31, 2017
88f02b1
Merge remote-tracking branch 'upstream/master'
gabeboning Oct 10, 2017
a67237c
Add onSnapStart event
Oct 27, 2017
431d0ee
call onSnapStart event
Oct 27, 2017
a75bb48
add snapstart data
gabeboning Oct 29, 2017
4f33c89
snap data
gabeboning Oct 29, 2017
d241d6f
Merge pull request #2 from gabeboning/android-snap-start
gabeboning Oct 29, 2017
9375d13
added bringToFront to Android (#184)
rotemmiz Feb 8, 2018
d45aa25
0.1.8
rotemmiz Feb 8, 2018
162ebe7
export bringToFront to JS
rotemmiz Feb 8, 2018
679ba98
fix(interactableView): expose bringToFront to js (#183)
ofirdagan Feb 8, 2018
ba04e1b
0.1.9
rotemmiz Feb 8, 2018
1c89628
OMG
rotemmiz Feb 8, 2018
b1e5352
0.1.10
rotemmiz Feb 8, 2018
66d0913
Fixes onSnapStart() not being called on snapTo() for iOS
lukefanning Feb 19, 2018
f3a6ac5
Wrap self.onSnapStart with if
lukefanning Feb 20, 2018
6f60654
Adds wix style spacing back in
lukefanning Feb 20, 2018
8b6c2c8
Update README.md for install of real life example
Mar 1, 2018
340249b
Merge pull request #3 from ssg-luke/master
gabeboning Mar 2, 2018
fee2bf5
Fix setPosition to changePosition (#163)
scopsy Mar 23, 2018
a147754
Maintenance: Unify examples (#198)
mkuczera Apr 14, 2018
92d3eb8
Update playground app to RN 0.57.4 (#243)
Inbal-Tish Nov 4, 2018
3e91956
remove old boundaries when set new ones (#162)
Mbompr Nov 4, 2018
6647440
Fixing INativeAlertEvent typing (it's a dictionary) (#181)
dvxme Nov 4, 2018
438a8fa
iOS + Android: Unify onDrag snap API (#196)
mkuczera Nov 4, 2018
5f5a93a
Bumped detox version
yershalom Nov 4, 2018
fc99507
Add detox release config
yershalom Nov 4, 2018
b321e94
Set react-native back
yershalom Nov 4, 2018
20f530d
No need jest for unit tests
yershalom Nov 4, 2018
1a017bd
Merge branch 'master' into master
yershalom Nov 4, 2018
bfb579f
Merge pull request #147 from Hurdlr/master
Inbal-Tish Nov 4, 2018
bf1cc62
Update README.md
Inbal-Tish Nov 5, 2018
edcfcd1
updating scripts
Inbal-Tish Nov 5, 2018
2ca7bbf
undo script deletion
Inbal-Tish Nov 5, 2018
f372b40
removing "postinstall" script
Inbal-Tish Nov 5, 2018
6efbb86
Merge pull request #250 from wix/postinstall_remove
Inbal-Tish Nov 5, 2018
9d19477
Added badges to README.md
rotemmiz Nov 5, 2018
84338ac
Merge branch 'master' of github.com:wix/react-native-interactable int…
Inbal-Tish Nov 6, 2018
70e301a
removing run-android script
Inbal-Tish Nov 6, 2018
ea0eed5
refreshing color palette
Inbal-Tish Nov 6, 2018
b5babdb
adjusting app header
Inbal-Tish Nov 6, 2018
228056e
Fix for example "collapsing header with scroll" screen (was not worki…
Inbal-Tish Nov 6, 2018
e48bfe8
Merge branches 'docs_update' and 'master' of github.com:wix/react-nat…
Inbal-Tish Nov 6, 2018
9288c11
changing run scripts (ios and android)
Inbal-Tish Nov 6, 2018
a3f6783
more colors adjustments
Inbal-Tish Nov 6, 2018
008fc3f
Merge branch 'master' of github.com:wix/react-native-interactable int…
Inbal-Tish Nov 6, 2018
755a76b
removing team from ios project
Inbal-Tish Nov 6, 2018
10919b0
removing scripts to avoid merge conflict
Inbal-Tish Nov 6, 2018
298a04e
fix
ButtersHub Nov 6, 2018
b99acd3
Merge branch 'docs_update' of github.com:wix/react-native-interactabl…
ButtersHub Nov 6, 2018
c45e875
Merge pull request #248 from wix/docs_update
ButtersHub Nov 6, 2018
dbc41f0
Merge pull request #252 from wix/demo_update
ButtersHub Nov 6, 2018
64e1418
Add keystore for test app
yershalom Nov 11, 2018
e204490
Fix for issue #101: iOS - onSnap is called when drag is paused but no…
Inbal-Tish Nov 11, 2018
3c6f519
fix for issue #226 - dragWithSpring not working in Android (#255)
Inbal-Tish Nov 11, 2018
2dcb738
Detox Fix
ButtersHub Nov 13, 2018
4dc2b72
editing e2e:android script
Inbal-Tish Nov 13, 2018
76a8288
Merge pull request #257 from wix/e2e_android
yershalom Nov 13, 2018
c316b90
fix for issue #108: Android - onDrag is fired when changePosition() i…
Inbal-Tish Nov 13, 2018
40dfab5
Cleanup npm package before prerelase
rotemmiz Nov 13, 2018
0f31fea
1.0.0-alpha.1
rotemmiz Nov 13, 2018
f741ca2
Add headless for emulator in CI
yershalom Nov 14, 2018
f0d3b4d
Add -UseModernBuildSystem for support xcode10
yershalom Feb 27, 2019
eca91ec
RN 0.59 upgrade
Inbal-Tish Apr 7, 2019
b091c26
Merge pull request #275 from wix/rn59
ethanshar Apr 23, 2019
7aaf8a5
accepting licence
Inbal-Tish May 26, 2019
e1c79cd
Revert "accepting licence"
Inbal-Tish May 26, 2019
8ecc795
adding ci scripts
Inbal-Tish Jun 6, 2019
5794e0c
migrating Detox
Inbal-Tish Jun 6, 2019
030d0b1
Bumping major version
Inbal-Tish Jun 6, 2019
2626f6a
* Upgrade to RN 0.61 (IOS only)
shahardavid Nov 7, 2019
bff6d0e
Upgrade to RN61
ArnonZ Nov 13, 2019
f4c58ae
RN61 upgrade
ArnonZ Nov 13, 2019
3c9b2ea
Removed InvocationTargetException
ArnonZ Nov 13, 2019
f7a3ffe
Adding stuff to gitignore post RN61 migration
ArnonZ Nov 13, 2019
0cd9663
Updating gitignore
ArnonZ Nov 13, 2019
fdb3179
Adding pod install script
ArnonZ Nov 13, 2019
d63762f
Adding pod install script to ci
ArnonZ Nov 13, 2019
622a870
Detox ios simulator update
ArnonZ Nov 13, 2019
75060d4
ci pod install
ArnonZ Nov 13, 2019
036eff6
fix
ArnonZ Nov 13, 2019
c2117a7
Created pod install script
ArnonZ Nov 13, 2019
7969952
catching InvocationTargetException
ArnonZ Nov 18, 2019
ab8dcd8
disable detox
ethanshar Nov 26, 2019
944625f
Merge pull request #301 from wix/RN61-upgrade
ethanshar Nov 26, 2019
d9a1778
ignore detox for now
ethanshar Nov 26, 2019
a0063a5
remove podspec from npmignore
ethanshar Nov 26, 2019
a7b01b7
update patch version to 2.0.1
ethanshar Nov 26, 2019
d79e07d
Update README.md
silyevsk Nov 2, 2020
a49c4a7
remove ExampleInstrumentedTest file as suggested in https://github.co…
felipe-xavier Mar 2, 2021
4e7b08e
Merge pull request #320 from felipe-xavier/issue-2157
d4vidi Mar 2, 2021
5ea6b0f
Upgrade Detox
d4vidi Mar 7, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 20 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -28,14 +28,33 @@ project.xcworkspace
.idea
.gradle
local.properties
android/.settings/*
android/.project
lib/android/.project
playground/android/app/.project
playground/android/.project

# node.js
#
node_modules/
npm-debug.log

# npm
package-lock.json

# yarn
yarn.lock
yarn-error.log

# BUCK
buck-out/
\.buckd/
android/app/libs
android/keystores/debug.keystore
*.keystore
!debug.keystore

# Bundle artifact
*.jsbundle

# CocoaPods
playground/ios/Pods
12 changes: 10 additions & 2 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
example
real-life-example
.ghp/


playground
e2e
logos
./index.ios.js
./index.android.js
./rn-cli.config.js

#################
# from .gitignore:
Expand Down Expand Up @@ -83,6 +87,9 @@ fabric.properties
#
# gitignore contributors: remember to update Global/Xcode.gitignore, Objective-C.gitignore & Swift.gitignore

#Cocoapods
# *.podspec

## Build generated
ios/build/
ios/DerivedData/
Expand Down Expand Up @@ -152,6 +159,7 @@ android/bin/
android/gen/
android/out/
android/app/build/
lib/android/gradle/

# Gradle files
android/.gradle/
Expand Down
2 changes: 1 addition & 1 deletion Interactable.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ Pod::Spec.new do |s|
s.homepage = "https://github.com/wix/react-native-interactable"

s.license = "MIT"
s.authors = { "Tal Kol" => "talkol@gmail.com" }
s.authors = package["author"]
s.platform = :ios, "7.0"

s.source = { :git => "https://github.com/wix/react-native-interactable.git" }
Expand Down
24 changes: 22 additions & 2 deletions PROPS.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,15 @@ horizontalOnly={true}

Optional, whether the view should be locked to horizontal movement only. Default `false`.

#### `startOnFront` (boolean) **[Android Only]**

```jsx
startOnFront
```

Optional, whether the view should call `view.bringToFront()` when the view is first loaded.
*Usually using zIndex does the trick. Use this in cases it doesn't*

#### `verticalOnly` (boolean)

```jsx
Expand Down Expand Up @@ -131,7 +140,18 @@ Optional, an object providing limits to movement relative to the view's center (
onSnap={this.onDrawerSnap}
```

Optional, a function called whenever the view snaps to a `snapPoints` point (after being dragged). Example for [drawer](https://github.com/wix/react-native-interactable/blob/b72eff0649b48dd50548593e5ecfe4c42b026a02/example/src/IconDrawer.js#L63). When the function is called, an event object is passed as argument, containing the following properties:
Optional, a function called whenever the view finishes snapping to a `snapPoints` point (after being dragged). Example for [drawer](https://github.com/wix/react-native-interactable/blob/b72eff0649b48dd50548593e5ecfe4c42b026a02/example/src/IconDrawer.js#L63). When the function is called, an event object is passed as argument, containing the following properties:

* `index` - The zero-based index of the point in the `snapPoints` array.
* `id` - The string `id` of the point in the `snapPoints` array (assuming it was provided).

#### `onSnapStart` (function)

```jsx
onSnapStart={this.onDrawerSnapStart}
```

Optional, a function called whenever the view starts snapping to a `snapPoints` point (after being dragged). When the function is called, an event object is passed as argument, containing the following properties:

* `index` - The zero-based index of the point in the `snapPoints` array.
* `id` - The string `id` of the point in the `snapPoints` array (assuming it was provided).
Expand All @@ -158,7 +178,7 @@ Optional, a function called whenever the user starts or stops dragging the view.
* `state` - `start` or `end`, whether the user started or finished dragging.
* `x` - The horizontal position of the view (relative to the center).
* `y` - The vertical position of the view (relative to the center).
* `targetSnapPointId` - For `end` state, the string `id` of the target point in the `snapPoints` array (assuming it was provided). Otherwise, empty string.
* `targetSnapPointId` - For `end` state, the string `id` of the target point in the `snapPoints` array (assuming it was provided).

#### `onAlert` (function)

Expand Down
57 changes: 30 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,13 @@

<br>

[![NPM Version](https://img.shields.io/npm/v/react-native-interactable.svg?style=flat)](https://www.npmjs.com/package/react-native-interactable)
[![Build Status](https://img.shields.io/jenkins/s/http/jenkins-oss.wixpress.com:8080/job/multi-react-native-interactable-master.svg)](https://jenkins-oss.wixpress.com/job/multi-react-native-interactable-master/)
[![NPM Downloads](https://img.shields.io/npm/dm/react-native-interactable.svg?style=flat)](https://www.npmjs.com/package/react-native-interactable)

### LOOKING FOR A MAINTAINER

We love this project, but currently we don’t have enough time to work on it. So we are looking for a maintainer. If you have enough time and knowledge and want to become one - please let us know (levv@wix.com, sergeyi@wix.com)
We love this project, but currently we don’t have enough time to work on it. So we are looking for a maintainer. If you have enough time and knowledge and want to become one - please let us know (levv@wix.com)

<br>

Expand Down Expand Up @@ -80,36 +83,18 @@ pod 'Interactable', :path => '../node_modules/react-native-interactable'

## Example

To see the library in action you have several options:
<br><br>The [playground](https://github.com/wix/react-native-interactable/tree/master/playground) project has few use-cases implemented like: *swipeable card*, *drawer*, *collapsible header* and *chat heads* under the "Basic examples" section. It's simplistic but easy to learn from.
<br><br>Under the "Real life example" you'll find more complex demonstrations. They're harder to learn from, but they're cool to watch. More info about the [UX inspirations](https://github.com/wix/react-native-interactable/blob/master/UX-INSPIRATIONS.md) for the demo app.

* **Build and run the example project on your computer**
<br><br>The [example](example) project has 4 use-cases implemented: *swipeable card*, *drawer*, *collapsible header* and *chat heads*. It's simplistic but easy to learn from.
<br><br>*Note: It's recommended to experience it on a [real device](http://facebook.github.io/react-native/docs/running-on-device.html) and not on a simulator. The simulator has poor performance so the framerate isn't like the real thing.*
<br><br>
To run the example, clone the repo and run from the root folder:<br>
* **Build and run the example project**
To see the library in action, clone the repo and run the playground from the root folder:<br>
```
cd real-life-example
npm install
react-native run-ios
npm start
npm run ios
```

* **Install and run the demo app from the App Store/Google Play on your phone**
<br><br>If you don't want to mess with building yourself, you can play with a pre-built demo on your phone.
<br><br>Download from [Apple App Store (iOS)](https://itunes.apple.com/us/app/react-native-interactions/id1209875831?ls=1&mt=8)<br>Download from [Google Play Store (Android)](https://play.google.com/store/apps/details?id=com.wix.interactions&hl=en)
<br><br><img src="http://i.imgur.com/VpSsavS.gif" width=200 />&nbsp;&nbsp;&nbsp;&nbsp;<img src="http://i.imgur.com/O7ulJa1.gif" width=200 />&nbsp;&nbsp;&nbsp;&nbsp;<img src="http://i.imgur.com/2mrUNIM.gif" width=200 />

* **Build and run the demo app on your computer**
<br><br>The [demo app](real-life-example) contains more complex demonstrations than the [example](example) project. They're harder to learn from, but they're cool to watch. More info about the [UX inspirations](https://github.com/wix/react-native-interactable/blob/master/UX-INSPIRATIONS.md) for the demo app.
<br><br>*Note: It's recommended to experience it on a [real device](http://facebook.github.io/react-native/docs/running-on-device.html) and not on a simulator. The simulator has poor performance so the framerate isn't like the real thing.*
<br><br>
To run the demo app, clone the repo and run from the root folder:
```
cd real-life-example
npm install
react-native run-ios
```

<br>

## Usage

Expand Down Expand Up @@ -169,6 +154,12 @@ alertAreas={[{id: 'myArea', influenceArea: {top: 0}}]}
horizontalOnly={true}
```

* [`startOnFront`](https://github.com/wix/react-native-interactable/blob/master/PROPS.md#startOnFront-boolean) - [ANDROID ONLY] whether the view should call `bringToFront`

```jsx
startOnFront
```

* [`verticalOnly`](https://github.com/wix/react-native-interactable/blob/master/PROPS.md#verticalonly-boolean) - whether the view should be locked to vertical movement only

```jsx
Expand All @@ -181,12 +172,18 @@ verticalOnly={true}
boundaries={{left: -100, right: 100, bounce: 0.5}}
```

* [`onSnap`](https://github.com/wix/react-native-interactable/blob/master/PROPS.md#onsnap-function) - a function called whenever the view snaps to a `snapPoints` point (after dragging)
* [`onSnap`](https://github.com/wix/react-native-interactable/blob/master/PROPS.md#onsnap-function) - a function called whenever the view finishes snapping to a `snapPoints` point (after dragging)

```jsx
onSnap={this.onDrawerSnap}
```

* [`onSnapStart`](https://github.com/wix/react-native-interactable/blob/master/PROPS.md#onsnapstart-function) - a function called whenever the view starts snapping to a `snapPoints` point (after dragging)

```jsx
onSnapStart={this.onDrawerSnapStart}
```

* [`onStop`](https://github.com/wix/react-native-interactable/blob/master/PROPS.md#onstop-function) - a function called whenever the interaction stops (views freeze momentarily)

```jsx
Expand Down Expand Up @@ -273,7 +270,7 @@ Takes a single argument, which is a params object containing:
##### `changePosition(params)` - used to imperatively set the view's position

```jsx
instance.setPosition({x: 120, y: 40});
instance.changePosition({x: 120, y: 40});
```

Takes a single argument, which is a params object containing:
Expand All @@ -282,6 +279,12 @@ Takes a single argument, which is a params object containing:

<br>

##### `bringToFront()` - bring view to front (Android Only)

```jsx
instance.bringToFront();
```

## Animating other views according to `Interactable.View` position

This library is integrated with the [Animated](https://facebook.github.io/react-native/docs/animated.html) library in order to support performant animations of other views according to the movement of the `Interactable.View`.
Expand Down
1 change: 1 addition & 0 deletions android
14 changes: 14 additions & 0 deletions e2e/firstTest.spec.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
describe('Example', () => {
beforeEach(async () => {
await device.reloadReactNative();
});

it('should show Overview screen', async () => {
await expect(element(by.id('Overview'))).toBeVisible();
});

it('Chat Heads is clickable', async () => {
await element(by.text('Chat Heads')).tap();
});

})
19 changes: 19 additions & 0 deletions e2e/init.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const detox = require('detox');
const config = require('../package.json').detox;
const adapter = require('detox/runners/mocha/adapter');

before(async () => {
await detox.init(config);
});

beforeEach(async function () {
await adapter.beforeEach(this);
});

afterEach(async function () {
await adapter.afterEach(this);
});

after(async () => {
await detox.cleanup();
});
1 change: 1 addition & 0 deletions e2e/mocha.opts
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
--recursive --timeout 120000 --bail
3 changes: 0 additions & 3 deletions example/.babelrc

This file was deleted.

44 changes: 0 additions & 44 deletions example/.flowconfig

This file was deleted.

1 change: 0 additions & 1 deletion example/.gitattributes

This file was deleted.

53 changes: 0 additions & 53 deletions example/.gitignore

This file was deleted.

1 change: 0 additions & 1 deletion example/.watchmanconfig

This file was deleted.

12 changes: 0 additions & 12 deletions example/__tests__/index.android.js

This file was deleted.

Loading