Skip to content

Commit

Permalink
Merge branch 'master' into muhammad/arch-64-fb-submit-master
Browse files Browse the repository at this point in the history
* master:
  Fix NullPointerException when emiting event using UIManagerModule
  Fixed concurrency issue in remote debugger
  Fix ReactImagePropertyTest SoLoader failures (facebook#19607)
  Remove unused include. (facebook#19548)
  Update Danger token (facebook#19606)
  Modified deepFreezeAndThrowOnMutationInDev to use Object.prototype.ha… (facebook#19598)
  Change error message on interpolation (facebook#19571)
  Bump Prettier to 1.13.4 on xplat
  Fix/security issues (facebook#19373)
  Add open source Flow declaration for Metro module
  Use correct library reference for libfishhook.a in RCTWebSocket (facebook#19579)
  Enable proguard for Fabric in release builds
  Fix events not working after closing and navigating back to Fabric screen in FB4A
  • Loading branch information
marafat committed Jun 8, 2018
2 parents b0851f7 + 291c01f commit 46919e9
Show file tree
Hide file tree
Showing 49 changed files with 184 additions and 95 deletions.
4 changes: 2 additions & 2 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -567,9 +567,9 @@ jobs:
- run:
name: Analyze Pull Request
command: |
# DANGER_GITHUB_API_TOKEN=Facebook-Open-Source-Bot public_repo access token
# DANGER_GITHUB_API_TOKEN=React-Linter public_repo access token
if [ -n "$CIRCLE_PR_NUMBER" ]; then
cd bots && DANGER_GITHUB_API_TOKEN="b186c9a82bab3b08ec80""c0818117619eec6f281a" yarn danger
cd bots && DANGER_GITHUB_API_TOKEN="80aa64c50f38a267e9ba""575d41d528f9c234edb8" yarn danger
else
echo "Skipping pull request analysis."
fi
Expand Down
4 changes: 2 additions & 2 deletions Libraries/ART/ReactNativeART.js
Original file line number Diff line number Diff line change
Expand Up @@ -297,7 +297,7 @@ function insertOffsetsIntoArray(stops, targetArray, atIndex, multi, reverse) {
let i = 0;
if ('length' in stops) {
while (i < stops.length) {
offsetNumber = i / (stops.length - 1) * multi;
offsetNumber = (i / (stops.length - 1)) * multi;
targetArray[atIndex + i] = reverse ? 1 - offsetNumber : offsetNumber;
i++;
}
Expand Down Expand Up @@ -530,7 +530,7 @@ function LinearGradient(stops, x1, y1, x2, y2) {
const type = LINEAR_GRADIENT;

if (arguments.length < 5) {
const angle = (x1 == null ? 270 : x1) * Math.PI / 180;
const angle = ((x1 == null ? 270 : x1) * Math.PI) / 180;

let x = Math.cos(angle);
let y = -Math.sin(angle);
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Animated/src/Easing.js
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ class Easing {
* http://easings.net/#easeInSine
*/
static sin(t: number) {
return 1 - Math.cos(t * Math.PI / 2);
return 1 - Math.cos((t * Math.PI) / 2);
}

/**
Expand Down Expand Up @@ -164,7 +164,7 @@ class Easing {
*/
static elastic(bounciness: number = 1): (t: number) => number {
const p = bounciness * Math.PI;
return t => 1 - Math.pow(Math.cos(t * Math.PI / 2), 3) * Math.cos(t * p);
return t => 1 - Math.pow(Math.cos((t * Math.PI) / 2), 3) * Math.cos(t * p);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Animated/src/__tests__/Easing-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ describe('Easing', () => {

function sampleEasingFunction(easing) {
const DURATION = 300;
const tickCount = Math.round(DURATION * 60 / 1000);
const tickCount = Math.round((DURATION * 60) / 1000);
const samples = [];
for (let i = 0; i <= tickCount; i++) {
samples.push(easing(i / tickCount));
Expand Down
3 changes: 1 addition & 2 deletions Libraries/Animated/src/animations/DecayAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,7 @@ class DecayAnimation extends Animation {

const value =
this._fromValue +
this._velocity /
(1 - this._deceleration) *
(this._velocity / (1 - this._deceleration)) *
(1 - Math.exp(-(1 - this._deceleration) * (now - this._startTime)));

this._onUpdate(value);
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Animated/src/animations/SpringAnimation.js
Original file line number Diff line number Diff line change
Expand Up @@ -266,15 +266,15 @@ class SpringAnimation extends Animation {
position =
this._toValue -
envelope *
((v0 + zeta * omega0 * x0) / omega1 * Math.sin(omega1 * t) +
(((v0 + zeta * omega0 * x0) / omega1) * Math.sin(omega1 * t) +
x0 * Math.cos(omega1 * t));
// This looks crazy -- it's actually just the derivative of the
// oscillation function
velocity =
zeta *
omega0 *
envelope *
(Math.sin(omega1 * t) * (v0 + zeta * omega0 * x0) / omega1 +
((Math.sin(omega1 * t) * (v0 + zeta * omega0 * x0)) / omega1 +
x0 * Math.cos(omega1 * t)) -
envelope *
(Math.cos(omega1 * t) * (v0 + zeta * omega0 * x0) -
Expand Down
4 changes: 2 additions & 2 deletions Libraries/Animated/src/nodes/AnimatedInterpolation.js
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ function checkValidInputRange(arr: Array<number>) {
* mean this implicit string conversion, you can do something like
* String(myThing)
*/
'inputRange must be monotonically increasing ' + arr,
'inputRange must be monotonically non-decreasing ' + arr,
);
}
}
Expand Down Expand Up @@ -358,7 +358,7 @@ class AnimatedInterpolation extends AnimatedWithChildren {
}
if (/deg$/.test(value)) {
const degrees = parseFloat(value) || 0;
const radians = degrees * Math.PI / 180.0;
const radians = (degrees * Math.PI) / 180.0;
return radians;
} else {
// Assume radians
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Animated/src/nodes/AnimatedModulo.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class AnimatedModulo extends AnimatedWithChildren {

__getValue(): number {
return (
(this._a.__getValue() % this._modulus + this._modulus) % this._modulus
((this._a.__getValue() % this._modulus) + this._modulus) % this._modulus
);
}

Expand Down
2 changes: 1 addition & 1 deletion Libraries/Color/normalizeColor.js
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ function parse255(str: string): number {

function parse360(str: string): number {
const int = parseFloat(str);
return ((int % 360 + 360) % 360) / 360;
return (((int % 360) + 360) % 360) / 360;
}

function parse1(str: string): number {
Expand Down
19 changes: 14 additions & 5 deletions Libraries/Components/Keyboard/KeyboardAvoidingView.js
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,10 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
return (
<View
ref={viewRef}
style={StyleSheet.compose(style, heightStyle)}
style={StyleSheet.compose(
style,
heightStyle,
)}
onLayout={this._onLayout}
{...props}>
{children}
Expand All @@ -186,9 +189,12 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
onLayout={this._onLayout}
{...props}>
<View
style={StyleSheet.compose(contentContainerStyle, {
bottom: bottomHeight,
})}>
style={StyleSheet.compose(
contentContainerStyle,
{
bottom: bottomHeight,
},
)}>
{children}
</View>
</View>
Expand All @@ -198,7 +204,10 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
return (
<View
ref={viewRef}
style={StyleSheet.compose(style, {paddingBottom: bottomHeight})}
style={StyleSheet.compose(
style,
{paddingBottom: bottomHeight},
)}
onLayout={this._onLayout}
{...props}>
{children}
Expand Down
5 changes: 4 additions & 1 deletion Libraries/Components/Slider/Slider.js
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,10 @@ const Slider = (
forwardedRef?: ?React.Ref<'RCTActivityIndicatorView'>,
|}>,
) => {
const style = StyleSheet.compose(styles.slider, props.style);
const style = StyleSheet.compose(
styles.slider,
props.style,
);

const onValueChange =
props.onValueChange &&
Expand Down
5 changes: 4 additions & 1 deletion Libraries/Components/Switch/Switch.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,10 @@ class Switch extends React.Component<Props> {
: this.props.tintColor,
}
: {
style: StyleSheet.compose(styles.rctSwitchIOS, this.props.style),
style: StyleSheet.compose(
styles.rctSwitchIOS,
this.props.style,
),
};

return (
Expand Down
6 changes: 5 additions & 1 deletion Libraries/Lists/FlatList.js
Original file line number Diff line number Diff line change
Expand Up @@ -614,7 +614,11 @@ class FlatList<ItemT> extends React.PureComponent<Props<ItemT>, void> {
'Expected array of items with numColumns > 1',
);
return (
<View style={StyleSheet.compose(styles.row, columnWrapperStyle)}>
<View
style={StyleSheet.compose(
styles.row,
columnWrapperStyle,
)}>
{item.map((it, kk) => {
const element = renderItem({
item: it,
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Lists/VirtualizedList.js
Original file line number Diff line number Diff line change
Expand Up @@ -1369,7 +1369,7 @@ class VirtualizedList extends React.PureComponent<Props, State> {
/* $FlowFixMe(>=0.63.0 site=react_native_fb) This comment suppresses an
* error found when Flow v0.63 was deployed. To see the error delete
* this comment and run Flow. */
this.props.onEndReachedThreshold * visibleLength / 2;
(this.props.onEndReachedThreshold * visibleLength) / 2;
// Mark as high priority if we're close to the start of the first item
// But only if there are items before the first rendered item
if (first > 0) {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Lists/VirtualizedSectionList.js
Original file line number Diff line number Diff line change
Expand Up @@ -457,7 +457,7 @@ class ItemWithSeparator extends React.Component<
static getDerivedStateFromProps(
props: ItemWithSeparatorProps,
prevState: ItemWithSeparatorState,
): ?ItemWithSeparatorState {
): ?ItemWithSeparatorState {
return {
separatorProps: {
...prevState.separatorProps,
Expand Down
15 changes: 8 additions & 7 deletions Libraries/ReactNative/YellowBox.js
Original file line number Diff line number Diff line change
Expand Up @@ -424,13 +424,14 @@ class YellowBox extends React.Component<
];
return (
<View style={inspector ? styles.fullScreen : listStyle}>
{!inspector && rows.length > 0 && (
<TouchableHighlight
style={styles.dismissAllContainer}
onPress={() => this.dismissWarning(null)}>
<Text style={styles.dismissAll}>Dismiss All</Text>
</TouchableHighlight>
)}
{!inspector &&
rows.length > 0 && (
<TouchableHighlight
style={styles.dismissAllContainer}
onPress={() => this.dismissWarning(null)}>
<Text style={styles.dismissAll}>Dismiss All</Text>
</TouchableHighlight>
)}
<ScrollView style={listStyle} scrollsToTop={false}>
{rows}
</ScrollView>
Expand Down
2 changes: 1 addition & 1 deletion Libraries/StyleSheet/processTransform.js
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ function _multiplyTransform(
*/
function _convertToRadians(value: string): number {
const floatValue = parseFloat(value);
return value.indexOf('rad') > -1 ? floatValue : floatValue * Math.PI / 180;
return value.indexOf('rad') > -1 ? floatValue : (floatValue * Math.PI) / 180;
}

function _validateTransforms(transform: Array<Object>): void {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Utilities/MatrixMath.js
Original file line number Diff line number Diff line change
Expand Up @@ -719,7 +719,7 @@ const MatrixMath = {
0,
0,
MatrixMath.roundTo3Places(
Math.atan2(row[0][1], row[0][0]) * 180 / Math.PI,
(Math.atan2(row[0][1], row[0][0]) * 180) / Math.PI,
),
];
} else {
Expand Down
2 changes: 1 addition & 1 deletion Libraries/Utilities/__tests__/MatrixMath-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
const MatrixMath = require('MatrixMath');

function degreesToRadians(degrees) {
return degrees * Math.PI / 180;
return (degrees * Math.PI) / 180;
}

function convertZeroes(degrees) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ describe('deepFreezeAndThrowOnMutationInDev', function() {
expect(() => deepFreezeAndThrowOnMutationInDev()).not.toThrow();
});

it('should not throw on object without prototype', () => {
__DEV__ = true;
var o = Object.create(null);
o.key = 'Value';
expect(() => deepFreezeAndThrowOnMutationInDev(o)).not.toThrow();
});

it('should throw on mutation in dev with strict', () => {
'use strict';
__DEV__ = true;
Expand Down
13 changes: 9 additions & 4 deletions Libraries/Utilities/deepFreezeAndThrowOnMutationInDev.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,12 +39,17 @@ function deepFreezeAndThrowOnMutationInDev<T: Object>(object: T): T {
}

const keys = Object.keys(object);
const hasOwnProperty = Object.prototype.hasOwnProperty;

for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (object.hasOwnProperty(key)) {
object.__defineGetter__(key, identity.bind(null, object[key]));
object.__defineSetter__(key, throwOnImmutableMutation.bind(null, key));
if (hasOwnProperty.call(object, key)) {
Object.defineProperty(object, key, {
get: identity.bind(null, object[key]),
});
Object.defineProperty(object, key, {
set: throwOnImmutableMutation.bind(null, key),
});
}
}

Expand All @@ -53,7 +58,7 @@ function deepFreezeAndThrowOnMutationInDev<T: Object>(object: T): T {

for (var i = 0; i < keys.length; i++) {
var key = keys[i];
if (object.hasOwnProperty(key)) {
if (hasOwnProperty.call(object, key)) {
deepFreezeAndThrowOnMutationInDev(object[key]);
}
}
Expand Down
6 changes: 3 additions & 3 deletions Libraries/WebSocket/RCTWebSocket.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
/* Begin PBXBuildFile section */
1338BBE01B04ACC80064A9C9 /* RCTSRWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */; };
1338BBE11B04ACC80064A9C9 /* RCTWebSocketExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */; };
13526A521F362F7F0008EF00 /* libfishhook.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 13526A511F362F7F0008EF00 /* libfishhook.a */; };
2D3ABDC220C7206E00DF56E9 /* libfishhook.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3DBE0D001F3B181A0099AA32 /* libfishhook.a */; };
2D3B5F3D1D9B165B00451313 /* RCTSRWebSocket.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDD1B04ACC80064A9C9 /* RCTSRWebSocket.m */; };
2D3B5F3E1D9B165B00451313 /* RCTWebSocketExecutor.m in Sources */ = {isa = PBXBuildFile; fileRef = 1338BBDF1B04ACC80064A9C9 /* RCTWebSocketExecutor.m */; };
2D3B5F401D9B165B00451313 /* RCTWebSocketModule.m in Sources */ = {isa = PBXBuildFile; fileRef = 3C86DF7B1ADF695F0047B81A /* RCTWebSocketModule.m */; };
Expand Down Expand Up @@ -87,7 +87,7 @@
isa = PBXFrameworksBuildPhase;
buildActionMask = 2147483647;
files = (
13526A521F362F7F0008EF00 /* libfishhook.a in Frameworks */,
2D3ABDC220C7206E00DF56E9 /* libfishhook.a in Frameworks */,
);
runOnlyForDeploymentPostprocessing = 0;
};
Expand Down Expand Up @@ -435,7 +435,7 @@
EXECUTABLE_PREFIX = lib;
GCC_PREPROCESSOR_DEFINITIONS = (
"DEBUG=1",
"RCT_METRO_PORT=${RCT_METRO_PORT}",
"RCT_METRO_PORT=${RCT_METRO_PORT}",
"$(inherited)",
);
GCC_TREAT_WARNINGS_AS_ERRORS = NO;
Expand Down
7 changes: 6 additions & 1 deletion Libraries/WebSocket/WebSocket.js
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,12 @@ class WebSocket extends EventTarget(...WEBSOCKET_EVENTS) {
this._eventEmitter = new NativeEventEmitter(WebSocketModule);
this._socketId = nextWebSocketId++;
this._registerEvents();
WebSocketModule.connect(url, protocols, {headers}, this._socketId);
WebSocketModule.connect(
url,
protocols,
{headers},
this._socketId,
);
}

get binaryType(): ?BinaryType {
Expand Down
5 changes: 3 additions & 2 deletions RNTester/js/AlertExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,9 @@ class SimpleAlertExampleBlock extends React.Component {
class AlertExample extends React.Component {
static title = 'Alert';

static description = 'Alerts display a concise and informative message ' +
'and prompt the user to make a decision.';
static description =
'Alerts display a concise and informative message ' +
'and prompt the user to make a decision.';

render() {
return (
Expand Down
5 changes: 3 additions & 2 deletions RNTester/js/AnimatedGratuitousApp/AnExApp.js
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,9 @@ class Circle extends React.Component<any, any> {

class AnExApp extends React.Component<any, any> {
static title = 'Animated - Gratuitous App';
static description = 'Bunch of Animations - tap a circle to ' +
'open a view with more animations, or longPress and drag to reorder circles.';
static description =
'Bunch of Animations - tap a circle to ' +
'open a view with more animations, or longPress and drag to reorder circles.';

_onMove: (position: Point) => void;
constructor(props: any): void {
Expand Down
2 changes: 1 addition & 1 deletion RNTester/js/DatePickerIOSExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class DatePickerExample extends React.Component<
> {
static defaultProps = {
date: new Date(),
timeZoneOffsetInHours: -1 * new Date().getTimezoneOffset() / 60,
timeZoneOffsetInHours: (-1 * new Date().getTimezoneOffset()) / 60,
};

state = {
Expand Down
2 changes: 1 addition & 1 deletion RNTester/js/ImageExample.js
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ var NetworkImageExample = createReactClass({
onProgress={e =>
this.setState({
progress: Math.round(
100 * e.nativeEvent.loaded / e.nativeEvent.total,
(100 * e.nativeEvent.loaded) / e.nativeEvent.total,
),
})
}
Expand Down
Loading

0 comments on commit 46919e9

Please sign in to comment.