-
Notifications
You must be signed in to change notification settings - Fork 24.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #852 from vjeux/import_everycommit
Import everycommit
- Loading branch information
Showing
75 changed files
with
2,016 additions
and
1,310 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# OSX | ||
# | ||
.DS_Store | ||
|
||
# Xcode | ||
# | ||
build/ | ||
*.pbxuser | ||
!default.pbxuser | ||
*.mode1v3 | ||
!default.mode1v3 | ||
*.mode2v3 | ||
!default.mode2v3 | ||
*.perspectivev3 | ||
!default.perspectivev3 | ||
xcuserdata | ||
*.xccheckout | ||
*.moved-aside | ||
DerivedData | ||
*.hmap | ||
*.ipa | ||
*.xcuserstate | ||
|
||
# node.js | ||
# | ||
node_modules/ | ||
npm-debug.log |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,136 @@ | ||
/** | ||
* The examples provided by Facebook are for non-commercial testing and | ||
* evaluation purposes only. | ||
* | ||
* Facebook reserves all rights not expressly granted. | ||
* | ||
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS | ||
* OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
* FITNESS FOR A PARTICULAR PURPOSE AND NON INFRINGEMENT. IN NO EVENT SHALL | ||
* FACEBOOK BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN | ||
* AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN | ||
* CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. | ||
* | ||
* @flow | ||
*/ | ||
'use strict'; | ||
|
||
var React = require('react-native'); | ||
var { | ||
StyleSheet, | ||
PanResponder, | ||
View, | ||
} = React; | ||
|
||
var CIRCLE_SIZE = 80; | ||
var CIRCLE_COLOR = 'blue'; | ||
var CIRCLE_HIGHLIGHT_COLOR = 'green'; | ||
|
||
|
||
var NavigatorIOSExample = React.createClass({ | ||
|
||
statics: { | ||
title: 'PanResponder Sample', | ||
description: 'Basic gesture handling example', | ||
}, | ||
|
||
_panResponder: {}, | ||
_previousLeft: 0, | ||
_previousTop: 0, | ||
_circleStyles: {}, | ||
circle: (null : ?{ setNativeProps(props: Object): void }), | ||
|
||
componentWillMount: function() { | ||
this._panResponder = PanResponder.create({ | ||
onStartShouldSetPanResponder: this._handleStartShouldSetPanResponder, | ||
onMoveShouldSetPanResponder: this._handleMoveShouldSetPanResponder, | ||
onPanResponderGrant: this._handlePanResponderGrant, | ||
onPanResponderMove: this._handlePanResponderMove, | ||
onPanResponderRelease: this._handlePanResponderEnd, | ||
onPanResponderTerminate: this._handlePanResponderEnd, | ||
}); | ||
this._previousLeft = 20; | ||
this._previousTop = 84; | ||
this._circleStyles = { | ||
left: this._previousLeft, | ||
top: this._previousTop, | ||
}; | ||
}, | ||
|
||
componentDidMount: function() { | ||
this._updatePosition(); | ||
}, | ||
|
||
render: function() { | ||
return ( | ||
<View | ||
style={styles.container}> | ||
<View | ||
ref={(circle) => { | ||
this.circle = circle; | ||
}} | ||
style={styles.circle} | ||
{...this._panResponder.panHandlers} | ||
/> | ||
</View> | ||
); | ||
}, | ||
|
||
_highlight: function() { | ||
this.circle && this.circle.setNativeProps({ | ||
backgroundColor: CIRCLE_HIGHLIGHT_COLOR | ||
}); | ||
}, | ||
|
||
_unHighlight: function() { | ||
this.circle && this.circle.setNativeProps({ | ||
backgroundColor: CIRCLE_COLOR | ||
}); | ||
}, | ||
|
||
_updatePosition: function() { | ||
this.circle && this.circle.setNativeProps(this._circleStyles); | ||
}, | ||
|
||
_handleStartShouldSetPanResponder: function(e: Object, gestureState: Object): boolean { | ||
// Should we become active when the user presses down on the circle? | ||
return true; | ||
}, | ||
|
||
_handleMoveShouldSetPanResponder: function(e: Object, gestureState: Object): boolean { | ||
// Should we become active when the user moves a touch over the circle? | ||
return true; | ||
}, | ||
|
||
_handlePanResponderGrant: function(e: Object, gestureState: Object) { | ||
this._highlight(); | ||
}, | ||
_handlePanResponderMove: function(e: Object, gestureState: Object) { | ||
this._circleStyles.left = this._previousLeft + gestureState.dx; | ||
this._circleStyles.top = this._previousTop + gestureState.dy; | ||
this._updatePosition(); | ||
}, | ||
_handlePanResponderEnd: function(e: Object, gestureState: Object) { | ||
this._unHighlight(); | ||
this._previousLeft += gestureState.dx; | ||
this._previousTop += gestureState.dy; | ||
}, | ||
}); | ||
|
||
var styles = StyleSheet.create({ | ||
circle: { | ||
width: CIRCLE_SIZE, | ||
height: CIRCLE_SIZE, | ||
borderRadius: CIRCLE_SIZE / 2, | ||
backgroundColor: CIRCLE_COLOR, | ||
position: 'absolute', | ||
left: 0, | ||
top: 0, | ||
}, | ||
container: { | ||
flex: 1, | ||
paddingTop: 64, | ||
}, | ||
}); | ||
|
||
module.exports = NavigatorIOSExample; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.