Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
970bff6
[ReactNative] Enable resolveAssetSource for Image.android
frantic Apr 24, 2015
1f98c84
[react-native] Update react-tools to 0.13.2*
sophiebits Apr 24, 2015
46db182
[react_native] JS files from D2017699: Expose JavaScriptEnabled prope…
kmagiera Apr 24, 2015
a2dd7fc
[ReactNative] Fix dimensions in jest tests
sahrens Apr 24, 2015
a1a15bd
[ReactNative] Fix reloading in debug mode sometimes crashes packager
frantic Apr 24, 2015
68eb3e4
[ReactNative] geolocation method docs
sahrens Apr 24, 2015
1cc0c96
[React Native] Bring back console.error redboxes with disable flag
sahrens Apr 25, 2015
4cbd7ce
[Flow] Add versions to fbobjc .flowconfigs
gabelevi Apr 25, 2015
bd57364
[ReactNative] Fix error when reload during profile
tadeuzagallo Apr 25, 2015
8a3b0fa
Fix edge cases and add tests for +[RCTConvert NSURL:]
nicklockwood Apr 25, 2015
dd6bce7
[ReactNative] Allow bridge modules to run on the JavaScript thread
tadeuzagallo Apr 26, 2015
77e38b2
Improved RCTActivityIndicatorView and fixed some flow errors
nicklockwood Apr 26, 2015
8aeb33d
[ReactNative] Make so each RCTContextExecutor has its own thread
tadeuzagallo Apr 27, 2015
136431c
[ReactNative] Fix struct args on exported methods
tadeuzagallo Apr 27, 2015
826b56a
[React Native] Update RCTView border implementation
Apr 27, 2015
bae4e44
Added placeholderTextColor property for TextInput class
bimawa Apr 27, 2015
3f723f4
[ReactNative][RFC] Yellow Box for warnings
Apr 27, 2015
dd56ccb
[react-native] Fix capitalization of "REact"
sophiebits Apr 27, 2015
b6e6dae
[Flow] Properly fix new errors as of Flow v0.10.
gabelevi Apr 27, 2015
ab6ff49
Updates from Mon 27 Apr
vjeux Apr 28, 2015
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
3 changes: 3 additions & 0 deletions .flowconfig
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,6 @@ Examples/UIExplorer/ImageMocks.js

[options]
module.system=haste

[version]
0.10.0
20 changes: 19 additions & 1 deletion Examples/UIExplorer/BorderExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,17 @@ var styles = StyleSheet.create({
borderLeftWidth: 40,
borderLeftColor: 'blue',
},
border5: {
borderRadius: 50,
borderTopWidth: 10,
borderTopColor: 'red',
borderRightWidth: 20,
borderRightColor: 'yellow',
borderBottomWidth: 30,
borderBottomColor: 'green',
borderLeftWidth: 40,
borderLeftColor: 'blue',
},
});

exports.title = 'Border';
Expand All @@ -71,7 +82,7 @@ exports.examples = [
},
{
title: 'Equal-Width / Same-Color',
description: 'borderWidth & borderColor',
description: 'borderWidth & borderColor & borderRadius',
render() {
return <View style={[styles.box, styles.borderRadius]} />;
}
Expand All @@ -97,4 +108,11 @@ exports.examples = [
return <View style={[styles.box, styles.border4]} />;
}
},
{
title: 'Custom Borders',
description: 'border*Width & border*Color',
render() {
return <View style={[styles.box, styles.border5]} />;
}
},
];
3 changes: 2 additions & 1 deletion Examples/UIExplorer/GeolocationExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,8 @@ var GeolocationExample = React.createClass({
componentDidMount: function() {
navigator.geolocation.getCurrentPosition(
(initialPosition) => this.setState({initialPosition}),
(error) => console.error(error)
(error) => console.error(error),
{enableHighAccuracy: true, timeout: 100, maximumAge: 1000}
);
this.watchID = navigator.geolocation.watchPosition((lastPosition) => {
this.setState({lastPosition});
Expand Down
4 changes: 4 additions & 0 deletions Examples/UIExplorer/UIExplorerBlock.js
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ var styles = StyleSheet.create({
},
titleContainer: {
borderWidth: 0.5,
borderRadius: 2.5,
borderColor: '#d6d7da',
backgroundColor: '#f6f7f8',
paddingHorizontal: 10,
Expand All @@ -78,8 +79,10 @@ var styles = StyleSheet.create({
titleRow: {
flexDirection: 'row',
justifyContent: 'space-between',
backgroundColor: 'transparent',
},
titleText: {
backgroundColor: 'transparent',
fontSize: 14,
fontWeight: '500',
},
Expand All @@ -97,6 +100,7 @@ var styles = StyleSheet.create({
height: 8,
},
children: {
backgroundColor: 'transparent',
padding: 10,
}
});
Expand Down
1 change: 1 addition & 0 deletions Examples/UIExplorer/WebViewExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ var WebViewExample = React.createClass({
automaticallyAdjustContentInsets={false}
style={styles.webView}
url={this.state.url}
javaScriptEnabledAndroid={true}
onNavigationStateChange={this.onNavigationStateChange}
startInLoadingState={true}
/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ var NativeModules = {
UIManager: {
customBubblingEventTypes: {},
customDirectEventTypes: {},
Dimensions: {},
},
AsyncLocalStorage: {
getItem: jest.genMockFunction(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,16 @@ var React = require('React');
var StyleSheet = require('StyleSheet');
var View = require('View');

var keyMirror = require('keyMirror');
var requireNativeComponent = require('requireNativeComponent');
var verifyPropTypes = require('verifyPropTypes');

var SpinnerSize = keyMirror({
large: null,
small: null,
});

var GRAY = '#999999';

type DefaultProps = {
animating: boolean;
size: 'small' | 'large';
color: string;
hidesWhenStopped: boolean;
size: 'small' | 'large';
};

var ActivityIndicatorIOS = React.createClass({
Expand All @@ -47,7 +42,10 @@ var ActivityIndicatorIOS = React.createClass({
* The foreground color of the spinner (default is gray).
*/
color: PropTypes.string,

/**
* Whether the indicator should hide when not animating (true by default).
*/
hidesWhenStopped: PropTypes.bool,
/**
* Size of the indicator. Small has a height of 20, large has a height of 36.
*/
Expand All @@ -60,27 +58,18 @@ var ActivityIndicatorIOS = React.createClass({
getDefaultProps: function(): DefaultProps {
return {
animating: true,
size: SpinnerSize.small,
color: GRAY,
hidesWhenStopped: true,
size: 'small',
};
},

render: function() {
var style = styles.sizeSmall;
var NativeConstants = NativeModules.UIManager.UIActivityIndicatorView.Constants;
var activityIndicatorViewStyle = NativeConstants.StyleWhite;
if (this.props.size === 'large') {
style = styles.sizeLarge;
activityIndicatorViewStyle = NativeConstants.StyleWhiteLarge;
}
var {style, ...props} = this.props;
var sizeStyle = (this.props.size === 'large') ? styles.sizeLarge : styles.sizeSmall;
return (
<View
style={[styles.container, style, this.props.style]}>
<UIActivityIndicatorView
activityIndicatorViewStyle={activityIndicatorViewStyle}
animating={this.props.animating}
color={this.props.color}
/>
<View style={[styles.container, sizeStyle, style]}>
<RCTActivityIndicatorView {...props} />
</View>
);
}
Expand All @@ -99,15 +88,15 @@ var styles = StyleSheet.create({
}
});

var UIActivityIndicatorView = requireNativeComponent(
'UIActivityIndicatorView',
var RCTActivityIndicatorView = requireNativeComponent(
'RCTActivityIndicatorView',
null
);
if (__DEV__) {
var nativeOnlyProps = {activityIndicatorViewStyle: true};
verifyPropTypes(
ActivityIndicatorIOS,
UIActivityIndicatorView.viewConfig,
RCTActivityIndicatorView.viewConfig,
nativeOnlyProps
);
}
Expand Down
3 changes: 3 additions & 0 deletions Libraries/Components/TabBarIOS/TabBarItemIOS.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,9 @@ var TabBarItemIOS = React.createClass({
* blank content, you probably forgot to add a selected one.
*/
selected: React.PropTypes.bool,
/**
* React style object.
*/
style: View.propTypes.style,
/**
* Text that appears under the icon. It is ignored when a system icon
Expand Down
1 change: 1 addition & 0 deletions Libraries/Components/TextInput/TextInput.js
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,7 @@ var TextInput = React.createClass({
onSubmitEditing={this.props.onSubmitEditing}
onSelectionChangeShouldSetResponder={() => true}
placeholder={this.props.placeholder}
placeholderTextColor={this.props.placeholderTextColor}
text={this.state.bufferedValue}
autoCapitalize={autoCapitalize}
autoCorrect={this.props.autoCorrect}
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Components/View/View.js
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ var stylePropType = StyleSheetPropType(ViewStylePropTypes);
* container that supports layout with flexbox, style, some touch handling, and
* accessibility controls, and is designed to be nested inside other views and
* to have 0 to many children of any type. `View` maps directly to the native
* view equivalent on whatever platform react is running on, whether that is a
* view equivalent on whatever platform React is running on, whether that is a
* `UIView`, `<div>`, `android.view`, etc. This example creates a `View` that
* wraps two colored boxes and custom component in a row with padding.
*
Expand Down
3 changes: 3 additions & 0 deletions Libraries/Components/WebView/WebView.android.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ var WebView = React.createClass({
onNavigationStateChange: PropTypes.func,
startInLoadingState: PropTypes.bool, // force WebView to show loadingView on first load
style: View.propTypes.style,
javaScriptEnabledAndroid: PropTypes.bool,
/**
* Used to locate this view in end-to-end tests.
*/
Expand Down Expand Up @@ -90,6 +91,7 @@ var WebView = React.createClass({
key="webViewKey"
style={webViewStyles}
url={this.props.url}
javaScriptEnabledAndroid={this.props.javaScriptEnabledAndroid}
contentInset={this.props.contentInset}
automaticallyAdjustContentInsets={this.props.automaticallyAdjustContentInsets}
onLoadingStart={this.onLoadingStart}
Expand Down Expand Up @@ -157,6 +159,7 @@ var WebView = React.createClass({
var RCTWebView = createReactIOSNativeComponentClass({
validAttributes: merge(ReactIOSViewAttributes.UIView, {
url: true,
javaScriptEnabledAndroid: true,
}),
uiViewClassName: 'RCTWebView',
});
Expand Down
4 changes: 4 additions & 0 deletions Libraries/Components/WebView/WebView.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,10 @@ var WebView = React.createClass({
onNavigationStateChange: PropTypes.func,
startInLoadingState: PropTypes.bool, // force WebView to show loadingView on first load
style: View.propTypes.style,
/**
* Used for android only, JS is enabled by default for WebView on iOS
*/
javaScriptEnabledAndroid: PropTypes.bool,
},

getInitialState: function() {
Expand Down
18 changes: 16 additions & 2 deletions Libraries/Geolocation/Geolocation.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,12 @@ var subscriptions = [];

var updatesEnabled = false;

type GeoOptions = {
timeout: number;
maximumAge: number;
enableHighAccuracy: bool;
}

/**
* You need to include the `NSLocationWhenInUseUsageDescription` key
* in Info.plist to enable geolocation. Geolocation is enabled by default
Expand All @@ -32,10 +38,14 @@ var updatesEnabled = false;
*/
var Geolocation = {

/*
* Invokes the success callback once with the latest location info. Supported
* options: timeout (ms), maximumAge (ms), enableHighAccuracy (bool)
*/
getCurrentPosition: function(
geo_success: Function,
geo_error?: Function,
geo_options?: Object
geo_options?: GeoOptions
) {
invariant(
typeof geo_success === 'function',
Expand All @@ -48,7 +58,11 @@ var Geolocation = {
);
},

watchPosition: function(success: Function, error?: Function, options?: Object): number {
/*
* Invokes the success callback whenever the location changes. Supported
* options: timeout (ms), maximumAge (ms), enableHighAccuracy (bool)
*/
watchPosition: function(success: Function, error?: Function, options?: GeoOptions): number {
if (!updatesEnabled) {
RCTLocationObserver.startObserving(options || {});
updatesEnabled = true;
Expand Down
7 changes: 3 additions & 4 deletions Libraries/Geolocation/RCTLocationObserver.m
Original file line number Diff line number Diff line change
Expand Up @@ -163,12 +163,12 @@ - (void)timeout:(NSTimer *)timer

#pragma mark - Public API

RCT_EXPORT_METHOD(startObserving:(NSDictionary *)optionsJSON)
RCT_EXPORT_METHOD(startObserving:(RCTLocationOptions)options)
{
[self checkLocationConfig];

// Select best options
_observerOptions = [RCTConvert RCTLocationOptions:optionsJSON];
_observerOptions = options;
for (RCTLocationRequest *request in _pendingRequests) {
_observerOptions.accuracy = MIN(_observerOptions.accuracy, request.options.accuracy);
}
Expand All @@ -189,7 +189,7 @@ - (void)timeout:(NSTimer *)timer
}
}

RCT_EXPORT_METHOD(getCurrentPosition:(NSDictionary *)optionsJSON
RCT_EXPORT_METHOD(getCurrentPosition:(RCTLocationOptions)options
withSuccessCallback:(RCTResponseSenderBlock)successBlock
errorCallback:(RCTResponseSenderBlock)errorBlock)
{
Expand Down Expand Up @@ -219,7 +219,6 @@ - (void)timeout:(NSTimer *)timer
}

// Check if previous recorded location exists and is good enough
RCTLocationOptions options = [RCTConvert RCTLocationOptions:optionsJSON];
if (_lastLocationEvent &&
CFAbsoluteTimeGetCurrent() - [RCTConvert NSTimeInterval:_lastLocationEvent[@"timestamp"]] < options.maximumAge &&
[_lastLocationEvent[@"coords"][@"accuracy"] doubleValue] >= options.accuracy) {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Image/Image.ios.js
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ var verifyPropTypes = require('verifyPropTypes');
var warning = require('warning');

/**
* A react component for displaying different types of images,
* A React component for displaying different types of images,
* including network images, static resources, temporary local images, and
* images from local disk, such as the camera roll.
*
Expand Down
6 changes: 6 additions & 0 deletions Libraries/Image/__tests__/resolveAssetSource-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,12 @@ describe('resolveAssetSource', () => {
expect(resolveAssetSource(source2)).toBe(source2);
});

it('ignores any weird data', () => {
expect(resolveAssetSource(null)).toBe(null);
expect(resolveAssetSource(42)).toBe(null);
expect(resolveAssetSource('nonsense')).toBe(null);
});

describe('bundle was loaded from network', () => {
beforeEach(() => {
SourceCode.scriptURL = 'http://10.0.0.1:8081/main.bundle';
Expand Down
7 changes: 4 additions & 3 deletions Libraries/Image/resolveAssetSource.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,11 @@ function pickScale(scales, deviceScale) {
return scales[scales.length - 1] || 1;
}

// TODO(frantic):
// * Pick best scale and append @Nx to file path
// * We are currently using httpServerLocation for both http and in-app bundle
function resolveAssetSource(source) {
if (!source || typeof source !== 'object') {
return null;
}

if (!source.__packager_asset) {
return source;
}
Expand Down
2 changes: 1 addition & 1 deletion Libraries/ReactIOS/ReactIOSComponentMixin.js
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ var ReactInstanceMap = require('ReactInstanceMap');
*
* `mountImage`: A way to represent the potential to create lower level
* resources whos `nodeHandle` can be discovered immediately by knowing the
* `rootNodeID`. Today's web react represents this with `innerHTML` annotated
* `rootNodeID`. Today's web React represents this with `innerHTML` annotated
* with DOM ids that match the `rootNodeID`.
*
* Opaque name TodaysWebReact FutureWebWorkerReact ReactNative
Expand Down
2 changes: 1 addition & 1 deletion Libraries/ReactIOS/ReactIOSMount.js
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@ var ReactIOSMount = {
* that has been rendered and unmounting it. There should just be one child
* component at this time.
*/
unmountComponentAtNode: function(containerTag: number): bool {
unmountComponentAtNode: function(containerTag: number): boolean {
if (!ReactIOSTagHandles.reactTagIsNativeTopRootID(containerTag)) {
console.error('You cannot render into anything but a top root');
return false;
Expand Down
Loading