Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Latest merge #2

Merged
merged 84 commits into from
Feb 1, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
84 commits
Select commit Hold shift + click to select a range
ee989ce
App Icon Update
Jan 25, 2016
aa0f9c8
Merge pull request #5539 from yamill/wpv_appicon_update
chirag04 Jan 25, 2016
91fe915
Remove JSThreadState from Bridge
astreet Jan 26, 2016
c1aed7b
Fix warnings generated by Elements Inspector
frantic Jan 26, 2016
1edcf4c
Disable navigation bar right button when it's transparent.
Jan 26, 2016
7419a82
Handle bad JSON data without crashing
nicklockwood Jan 26, 2016
5f0ef12
Skip bundling for Simulator
frantic Jan 26, 2016
9a0539d
Open source Android date and time pickers
Jan 26, 2016
6b75d7f
Expose `has` method on Cache.
cpojer Jan 26, 2016
7e64ad8
Fix some lint nits
cpojer Jan 26, 2016
affd623
self -> this in ScrollResponder
jedlau Jan 26, 2016
e33e6ab
Add cross-platform Linking module
satya164 Jan 26, 2016
bccdef0
added ShareHows app android link in showcase
deminoth Jan 27, 2016
3f97c5a
assign webView's delegate to nil
itouch2 Jan 27, 2016
4bf418a
Merge pull request #5577 from dobbit/showcase
chirag04 Jan 27, 2016
fff5dc3
Add 3dTouch props to touch events
Jan 27, 2016
83fd314
Moving more unit tests to open source
bestander Jan 27, 2016
825ba6c
Inline Require every module but the preloaded ones
martinbigio Jan 27, 2016
21a4c6e
quick fix circle buck builds
bestander Jan 27, 2016
f685878
Improved 3D touch implementation, and added example
nicklockwood Jan 27, 2016
b84f5fb
Added iOS indicatorStyle prop to ScrollView
jeanregisser Jan 27, 2016
1d819e9
Open sourced <ImageEditor>, <ImageStore> for Android
bestander Jan 27, 2016
04d14e5
Fix colors in RCTDevLoadingView
javache Jan 27, 2016
b85a52a
Update Image docs and examples to the new asset system
andreasdri Jan 27, 2016
f2438b4
Hot Loading Sourcemaps
martinbigio Jan 27, 2016
c56f280
Disable Flow on Packager
martinbigio Jan 27, 2016
af2f407
Add global flow types to eslint globals
janicduplessis Jan 27, 2016
2529179
Remove min/max Width/Height in the docs
vjeux Jan 28, 2016
47f863c
Single quotes in enum values
vjeux Jan 28, 2016
23f7720
RN: Update / Fix PixelRatio Manual Mock
yungsters Jan 28, 2016
3117a33
Limit mocks shared with a resolution response
cpojer Jan 28, 2016
f7c48ee
Fix per connection timeouts for XHR
Jan 28, 2016
96a3a8e
Codemod realtime to CLOCK_MONOTONIC where it makes sense
Jan 28, 2016
4511993
Fix duplicate platform labels in UIExplorer examples
nicklockwood Jan 28, 2016
0f7477f
add flag to enable momentum scrolling on iOS
aflanagan Jan 28, 2016
a322ab6
Fix ImageEditor example
nicklockwood Jan 28, 2016
4a226fc
Add guard to ErrorUtils mock
kassens Jan 28, 2016
b55dcbe
Fix CPU spike: should use UIGraphicsEndImageContext rather than UIGra…
Jan 28, 2016
e9f95c1
Check for contentView before emitting scroll event
brentvatne Jan 28, 2016
b7b27bd
Fixing typo in Bundler
skevy Jan 28, 2016
ca8792d
Add check to broadcast receiver to prevent exception
Jan 28, 2016
a61ab87
Add transform option to module / module cache
davidaurelio Jan 29, 2016
0b39c72
Fix bundler to not do as many passes in optimization
Jan 29, 2016
0c0bd53
Remove dummy .so file
Jan 29, 2016
181896e
Move HMR to external transformer
martinbigio Jan 29, 2016
203fdca
Support fade for remote images in React with nodes.
Jan 29, 2016
598df0b
Add Object.entries and Object.values polyfill
DmitrySoshnikov Jan 29, 2016
7e5247c
Fix timing initialization bug
andreicoman11 Jan 29, 2016
1154f2a
Document colors
vjeux Jan 29, 2016
54e5033
More helpful description for native-js prop mismatch
vjeux Jan 29, 2016
2d9876d
Add partial reading of files to fastfs
davidaurelio Jan 29, 2016
b9ceecb
Adapt tests to new Object/es7 polyfill
davidaurelio Jan 29, 2016
5e82094
Move bridge dependencies into a single ReactTestFactory
mhorowitz Jan 29, 2016
8de86a0
Add onPageScrollStateChanged for ViewPagerAndroid
Kudo Jan 29, 2016
1c6e837
Add a deprecatedPropType module to show deprecation warnings
janicduplessis Jan 29, 2016
c33e852
[website] Fix warning.png file
Jan 29, 2016
1dd5ba7
Add a cross-platform Picker
Jan 29, 2016
53100ec
Add support for custom scale types
plamenko Jan 29, 2016
cb874a5
Add MapView annotation callback when it gets / lost the focus
christoph-jerolimov Jan 29, 2016
715081c
Update Releases.md
mkonicek Jan 29, 2016
c8a0a3e
Reimplement color processing
vjeux Jan 29, 2016
65b8ff1
Make HMR faster
martinbigio Jan 29, 2016
68f71da
Make HMR faster (2)
martinbigio Jan 29, 2016
063e8b9
revert D2862911: this broke ReactNative
bestander Jan 29, 2016
041fb59
Fix bug with calculating Y offset in RecyclerViewBackedScrollView.
kmagiera Jan 29, 2016
8a10fc6
Remove timeout from MessageQueueThreadImpl creation
andreicoman11 Jan 29, 2016
8b7671a
Improve ios offline build instructions
morenoh149 Jan 29, 2016
1bc0387
remove ReactDOM from Jest blacklist
kassens Jan 30, 2016
9d0242f
Replace direct access of NativeModules.UIManager with require('UIMana…
nicklockwood Jan 30, 2016
99e56d6
Add buck build folders to gitignore
janicduplessis Jan 30, 2016
679beb2
Tweak docs before releasing 0.19
Jan 31, 2016
3fbd46c
Cleanup Edit with GitHub
vjeux Jan 31, 2016
670f9af
Document Linking
vjeux Jan 31, 2016
d3a1d27
Improve the error message when the packager can't find a module
Jan 31, 2016
5712e0c
Typo: Change WebWiew to WebView
jondot Jan 31, 2016
2341245
Handle spaces in $REACT_NATIVE_DIR
samn Jan 31, 2016
5afb740
Update 3rd-party modules website to Js.coach
ahmed1490 Feb 1, 2016
bee6988
Temporarily allow decimals on rgb() and rgba()
vjeux Feb 1, 2016
9308f89
Add per-field cache invalidation
cpojer Feb 1, 2016
ee30433
Update Android's ScrollView.scrollTo API to match JS/iOS
nicklockwood Feb 1, 2016
33e8a03
Open sourced view tests
bestander Feb 1, 2016
8cfed9d
Merge pull request #5640 from janicduplessis/buck
bestander Feb 1, 2016
97723e4
Typo
Feb 1, 2016
bb5a6be
Only execute update block once
javache Feb 1, 2016
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
28 changes: 27 additions & 1 deletion .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,19 @@
"__DEV__": true,
"__dirname": false,
"__fbBatchedBridgeConfig": false,
"alert": false,
"cancelAnimationFrame": false,
"clearImmediate": true,
"clearInterval": false,
"clearTimeout": false,
"console": false,
"document": false,
"escape": false,
"Event": false,
"EventTarget": false,
"exports": false,
"fetch": false,
"FormData": false,
"global": false,
"jest": false,
"Map": true,
Expand All @@ -43,7 +47,29 @@
"setTimeout": false,
"window": false,
"XMLHttpRequest": false,
"pit": false
"pit": false,

// Flow global types.
"ReactComponent": false,
"ReactClass": false,
"ReactElement": false,
"ReactPropsCheckType": false,
"ReactPropsChainableTypeChecker": false,
"ReactPropTypes": false,
"SyntheticEvent": false,
"$Either": false,
"$All": false,
"$Tuple": false,
"$Supertype": false,
"$Subtype": false,
"$Shape": false,
"$Diff": false,
"$Keys": false,
"$Enum": false,
"$Exports": false,
"$FlowIssue": false,
"$FlowFixMe": false,
"$FixMe": false
},

"rules": {
Expand Down
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ project.xcworkspace
/Examples/**/android/app/build/
/ReactAndroid/build/

# Buck
.buckd
buck-out

# Android
.idea
.gradle
Expand Down
5 changes: 5 additions & 0 deletions Examples/.eslintrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"rules": {
"no-alert": 0
}
}
117 changes: 117 additions & 0 deletions Examples/UIExplorer/DatePickerAndroidExample.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,117 @@
/**
* 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.
*/
'use strict';

var React = require('react-native');
var {
DatePickerAndroid,
StyleSheet,
Text,
TouchableWithoutFeedback,
} = React;

var UIExplorerBlock = require('./UIExplorerBlock');
var UIExplorerPage = require('./UIExplorerPage');

var DatePickerAndroidExample = React.createClass({

statics: {
title: 'DatePickerAndroid',
description: 'Standard Android date picker dialog',
},

getInitialState() {
return {
presetDate: new Date(2020, 4, 5),
allDate: new Date(2020, 4, 5),
simpleText: 'pick a date',
minText: 'pick a date, no earlier than today',
maxText: 'pick a date, no later than today',
presetText: 'pick a date, preset to 2020/5/5',
allText: 'pick a date between 2020/5/1 and 2020/5/10',
};
},

async showPicker(stateKey, options) {
try {
var newState = {};
const {action, year, month, day} = await DatePickerAndroid.open(options);
if (action === DatePickerAndroid.dismissedAction) {
newState[stateKey + 'Text'] = 'dismissed';
} else {
var date = new Date(year, month, day);
newState[stateKey + 'Text'] = date.toLocaleDateString();
newState[stateKey + 'Date'] = date;
}
this.setState(newState);
} catch ({code, message}) {
console.warn(`Error in example '${stateKey}': `, message);
}
},

render() {
return (
<UIExplorerPage title="DatePickerAndroid">
<UIExplorerBlock title="Simple date picker">
<TouchableWithoutFeedback
onPress={this.showPicker.bind(this, 'simple', {date: this.state.simpleDate})}>
<Text style={styles.text}>{this.state.simpleText}</Text>
</TouchableWithoutFeedback>
</UIExplorerBlock>
<UIExplorerBlock title="Date picker with pre-set date">
<TouchableWithoutFeedback
onPress={this.showPicker.bind(this, 'preset', {date: this.state.presetDate})}>
<Text style={styles.text}>{this.state.presetText}</Text>
</TouchableWithoutFeedback>
</UIExplorerBlock>
<UIExplorerBlock title="Date picker with minDate">
<TouchableWithoutFeedback
onPress={this.showPicker.bind(this, 'min', {
date: this.state.minDate,
minDate: new Date(),
})}>
<Text style={styles.text}>{this.state.minText}</Text>
</TouchableWithoutFeedback>
</UIExplorerBlock>
<UIExplorerBlock title="Date picker with maxDate">
<TouchableWithoutFeedback
onPress={this.showPicker.bind(this, 'max', {
date: this.state.maxDate,
maxDate: new Date(),
})}>
<Text style={styles.text}>{this.state.maxText}</Text>
</TouchableWithoutFeedback>
</UIExplorerBlock>
<UIExplorerBlock title="Date picker with all options">
<TouchableWithoutFeedback
onPress={this.showPicker.bind(this, 'all', {
date: this.state.allDate,
minDate: new Date(2020, 4, 1),
maxDate: new Date(2020, 4, 10),
})}>
<Text style={styles.text}>{this.state.allText}</Text>
</TouchableWithoutFeedback>
</UIExplorerBlock>
</UIExplorerPage>
);
},
});

var styles = StyleSheet.create({
text: {
color: 'black',
},
});

module.exports = DatePickerAndroidExample;
78 changes: 46 additions & 32 deletions Examples/UIExplorer/ImageEditingExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var {
Image,
ImageEditor,
NativeModules,
Platform,
ScrollView,
StyleSheet,
Text,
Expand All @@ -30,8 +31,6 @@ var {
View,
} = React;

var RCTScrollViewConsts = UIManager.RCTScrollView.Constants;

var PAGE_SIZE = 20;

type ImageOffset = {
Expand Down Expand Up @@ -67,22 +66,21 @@ class SquareImageCropper extends React.Component {
this._fetchRandomPhoto();
}

_fetchRandomPhoto() {
CameraRoll.getPhotos(
{first: PAGE_SIZE},
(data) => {
if (!this._isMounted) {
return;
}
var edges = data.edges;
var edge = edges[Math.floor(Math.random() * edges.length)];
var randomPhoto = edge && edge.node && edge.node.image;
if (randomPhoto) {
this.setState({randomPhoto});
}
},
(error) => undefined
);
async _fetchRandomPhoto() {
try {
const data = await CameraRoll.getPhotos({first: PAGE_SIZE});
if (!this._isMounted) {
return;
}
var edges = data.edges;
var edge = edges[Math.floor(Math.random() * edges.length)];
var randomPhoto = edge && edge.node && edge.node.image;
if (randomPhoto) {
this.setState({randomPhoto});
}
} catch (error) {
console.warn("Can't get a photo from camera roll", error);
}
}

componentWillUnmount() {
Expand Down Expand Up @@ -190,29 +188,49 @@ class SquareImageCropper extends React.Component {
}

class ImageCropper extends React.Component {
_scaledImageSize: ImageSize;
_contentOffset: ImageOffset;
_maximumZoomScale: number;
_minimumZoomScale: number;
_scaledImageSize: ImageSize;
_horizontal: boolean;

componentWillMount() {
// Scale an image to the minimum size that is large enough to completely
// fill the crop box.
var widthRatio = this.props.image.width / this.props.size.width;
var heightRatio = this.props.image.height / this.props.size.height;
if (widthRatio < heightRatio) {
this._horizontal = widthRatio > heightRatio;
if (this._horizontal) {
this._scaledImageSize = {
width: this.props.size.width,
height: this.props.image.height / widthRatio,
width: this.props.image.width / heightRatio,
height: this.props.size.height,
};
} else {
this._scaledImageSize = {
width: this.props.image.width / heightRatio,
height: this.props.size.height,
width: this.props.size.width,
height: this.props.image.height / widthRatio,
};
if (Platform.OS === 'android') {
// hack to work around Android ScrollView a) not supporting zoom, and
// b) not supporting vertical scrolling when nested inside another
// vertical ScrollView (which it is, when displayed inside UIExplorer)
this._scaledImageSize.width *= 2;
this._scaledImageSize.height *= 2;
this._horizontal = true;
}
}
this._contentOffset = {
x: (this._scaledImageSize.width - this.props.size.width) / 2,
y: (this._scaledImageSize.height - this.props.size.height) / 2,
};
this._maximumZoomScale = Math.min(
this.props.image.width / this._scaledImageSize.width,
this.props.image.height / this._scaledImageSize.height
);
this._minimumZoomScale = Math.max(
this.props.size.width / this._scaledImageSize.width,
this.props.size.height / this._scaledImageSize.height
);
this._updateTransformData(
this._contentOffset,
this._scaledImageSize,
Expand Down Expand Up @@ -248,19 +266,15 @@ class ImageCropper extends React.Component {
}

render() {
var decelerationRate =
RCTScrollViewConsts && RCTScrollViewConsts.DecelerationRate ?
RCTScrollViewConsts.DecelerationRate.Fast :
0;

return (
<ScrollView
alwaysBounceVertical={true}
automaticallyAdjustContentInsets={false}
contentOffset={this._contentOffset}
decelerationRate={decelerationRate}
horizontal={true}
maximumZoomScale={3.0}
decelerationRate="fast"
horizontal={this._horizontal}
maximumZoomScale={this._maximumZoomScale}
minimumZoomScale={this._minimumZoomScale}
onMomentumScrollEnd={this._onScroll.bind(this)}
onScrollEndDrag={this._onScroll.bind(this)}
showsHorizontalScrollIndicator={false}
Expand Down
20 changes: 10 additions & 10 deletions Examples/UIExplorer/ImageExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -148,15 +148,15 @@ exports.examples = [
},
{
title: 'Plain Static Image',
description: 'Static assets should be required by prefixing with `image!` ' +
'and are located in the app bundle.',
description: 'Static assets should be placed in the source code tree, and ' +
'required in the same way as JavaScript modules.',
render: function() {
return (
<View style={styles.horizontal}>
<Image source={require('image!uie_thumb_normal')} style={styles.icon} />
<Image source={require('image!uie_thumb_selected')} style={styles.icon} />
<Image source={require('image!uie_comment_normal')} style={styles.icon} />
<Image source={require('image!uie_comment_highlighted')} style={styles.icon} />
<Image source={require('./uie_thumb_normal.png')} style={styles.icon} />
<Image source={require('./uie_thumb_selected.png')} style={styles.icon} />
<Image source={require('./uie_comment_normal.png')} style={styles.icon} />
<Image source={require('./uie_comment_highlighted.png')} style={styles.icon} />
</View>
);
},
Expand Down Expand Up @@ -320,19 +320,19 @@ exports.examples = [
<View>
<View style={styles.horizontal}>
<Image
source={require('image!uie_thumb_normal')}
source={require('./uie_thumb_normal.png')}
style={[styles.icon, {borderRadius: 5, tintColor: '#5ac8fa' }]}
/>
<Image
source={require('image!uie_thumb_normal')}
source={require('./uie_thumb_normal.png')}
style={[styles.icon, styles.leftMargin, {borderRadius: 5, tintColor: '#4cd964' }]}
/>
<Image
source={require('image!uie_thumb_normal')}
source={require('./uie_thumb_normal.png')}
style={[styles.icon, styles.leftMargin, {borderRadius: 5, tintColor: '#ff2d55' }]}
/>
<Image
source={require('image!uie_thumb_normal')}
source={require('./uie_thumb_normal.png')}
style={[styles.icon, styles.leftMargin, {borderRadius: 5, tintColor: '#8e8e93' }]}
/>
</View>
Expand Down
4 changes: 2 additions & 2 deletions Examples/UIExplorer/ListViewExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ var UIExplorerPage = require('./UIExplorerPage');

var ListViewSimpleExample = React.createClass({
statics: {
title: '<ListView> - Simple',
title: '<ListView>',
description: 'Performant, scrollable list of data.'
},

Expand All @@ -50,7 +50,7 @@ var ListViewSimpleExample = React.createClass({
render: function() {
return (
<UIExplorerPage
title={this.props.navigator ? null : '<ListView> - Simple'}
title={this.props.navigator ? null : '<ListView>'}
noSpacer={true}
noScroll={true}>
<ListView
Expand Down
Loading