Commit Graph

1997 Commits

Author SHA1 Message Date
Ben Nham 0673ac25f1 improve detection of inspectable JS contexts
Reviewed By: Hypuk

Differential Revision: D6578735

fbshipit-source-id: ac6a3a8bae9aef7fd3b4a036c3f154b3f6b7d80c
2017-12-18 13:32:36 -08:00
Ben Nham 15cd98b782 add isInspectable property
Reviewed By: Hypuk

Differential Revision: D6578736

fbshipit-source-id: a4229c3766125ff55cff50a49893b2385f9c8a6a
2017-12-18 13:32:36 -08:00
Valentin Shergin d2dc451407 reactBridgeDidFinishTransaction was finally removed
Summary:
We are removing `reactBridgeDidFinishTransaction`.
Why?
 * It is a performance drain. Supporting this requires dispatching main-thread block on every single transaction complete;
 * It has "too broad" non-conceptual semantic which encouraged using this as a "band-aid solution" for poorly designed components;
 * It is conceptually incompatible with new approaches that we are trying to implement to optimize the render layer;
 * It was deprecated for very long time.

Reviewed By: mmmulani

Differential Revision: D6549729

fbshipit-source-id: 58094aab982c67cec3d7fa3b616c637cb84d697f
2017-12-18 11:47:26 -08:00
Valentin Shergin b263560c73 reactBridgeDidFinishTransaction was removed from RCTTabBar
Summary:
We are removing `reactBridgeDidFinishTransaction`.
Why?
 * It is a performance drain. Supporting this requires dispatching main-thread block on every single transaction complete;
 * It has "too broad" non-conceptual semantic which encouraged using this as a "band-aid solution" for poorly designed components;
 * It is conceptually incompatible with new approaches that we are trying to implement to optimize the render layer;
 * It was deprecated for very long time.

This diff replaces usage of `reactBridgeDidFinishTransaction` with `uiManagerDidPerformMounting` which has very similar semantic except that fact that `uiManagerDidPerformMounting` is called asynchronously on the next run loop tick. And this should be okay because new React partial rendering does not guarantee synchronous execution anyways.

Reviewed By: mmmulani

Differential Revision: D6549586

fbshipit-source-id: 589b814f83b91ed8fabf7e638e7554ab3c9d286e
2017-12-18 11:47:26 -08:00
Valentin Shergin 099b28006b `reactBridgeDidFinishTransaction` was removed from RCTNavigator
Summary:
We are removing `reactBridgeDidFinishTransaction`.
Why?
 * It is a performance drain. Supporting this requires dispatching main-thread block on every single transaction complete;
 * It has "too broad" non-conceptual semantic which encouraged using this as a "band-aid solution" for poorly designed components;
 * It is conceptually incompatible with new approaches that we are trying to implement to optimize the render layer;
 * It was deprecated for very long time.

This diff replaces usage of `reactBridgeDidFinishTransaction` with `uiManagerDidPerformMounting` which has very similar semantic except that fact that `uiManagerDidPerformMounting` is called asynchronously on the next run loop tick. And this should be okay because new React partial rendering does not guarantee synchronous execution anyways.

Reviewed By: mmmulani

Differential Revision: D6549217

fbshipit-source-id: 2649e943e82e6fbe02c7678583a97db3f5800201
2017-12-18 11:47:26 -08:00
Valentin Shergin b8e60a3ca3 reactSetInheritedBackgroundColor was removed from RCTView
Summary:
Now setting explicit backgroundColor style is required for Views with background shadow,
otherwise the shadow will be generated based on content of the view (which is expected behaviour).

Reviewed By: mmmulani

Differential Revision: D6582587

fbshipit-source-id: 0514cb3c57bad17d2af40810b0e0f7ddc96a2c31
2017-12-18 11:47:26 -08:00
Valentin Shergin 2789ba016b zIndex prop was removed from RCTShadowView
Summary:
This was leftovers from old implementation of zIndex feature.
Janic janicduplessis refactored this and moved all logic to UIView layer, so we don't need this prop anymore in shadow realm.
More info: https://github.com/facebook/react-native/pull/14011

Reviewed By: mmmulani

Differential Revision: D6574414

fbshipit-source-id: 2cae19350765689784d7884ed875878d39b4e3f1
2017-12-18 11:47:26 -08:00
Michael Schneider d021dd25da Fix typo in RCTSurfaceHostingView
Summary:
Fix typo in RCTSurfaceHostingView (minumumSize -> minimumSize)
Closes https://github.com/facebook/react-native/pull/17235

Differential Revision: D6585719

Pulled By: hramos

fbshipit-source-id: bfb18015f48bc8ab161945d09125c27d29738ede
2017-12-15 17:32:24 -08:00
Ben Nham bef7967f9a move page registration logic in to jsinspector
Reviewed By: pakoito

Differential Revision: D6531199

fbshipit-source-id: ed1ae9e2f0c19e7656cd022e438693798320e55a
2017-12-15 09:20:13 -08:00
Alex Dvornikov d9c658566a Fix a crash when keyboard is visible and bridge reload happens
Reviewed By: sahrens

Differential Revision: D6573855

fbshipit-source-id: 8768dca7d36782e82fb457f6ff4b09791e669d00
2017-12-14 17:51:59 -08:00
Yujie Liu 2fecbf6171 Add RCTLibraryPathForURL in RCTUtil
Reviewed By: fromcelticpark

Differential Revision: D6445626

fbshipit-source-id: aa37c87f019eea85d76365b6be919adfafc3c27a
2017-12-14 14:31:50 -08:00
Ayush Sood ee521f9c05 Add extra data view to RN RedBox
Reviewed By: shergin

Differential Revision: D6382976

fbshipit-source-id: 33568a241395b085a840ac52adab3c9dc463ea4c
2017-12-14 10:50:24 -08:00
Alexey Lang e8eec24706 Fix crashing Systrace when debugging JS remotely
Reviewed By: fromcelticpark

Differential Revision: D6522026

fbshipit-source-id: 11920ecc0133f47314607a0b3431f27027cc9e22
2017-12-14 10:19:15 -08:00
Paco Estevez Garcia 59c3e33f63 Fix isNuclideDebuggingAvailable on iOS
Reviewed By: bnham

Differential Revision: D6567435

fbshipit-source-id: e8c4d8a3e02fe767f5a6871db61b21faf181cc43
2017-12-14 08:17:12 -08:00
Valentin Shergin 85503a0612 Fixed retain cycle in RCTFBHTTPRequestHandler
Summary: Following common ObjC pattern, we have to store delegates as weak pointers.

Reviewed By: mmmulani

Differential Revision: D6558886

fbshipit-source-id: 11a710a7e9e17d7c6a78ae46b53b043f44ccf8e5
2017-12-13 16:02:04 -08:00
Rahul Ramachandran eaa84997ce Fix - argument type in RCTEventEmitter
Reviewed By: javache

Differential Revision: D6528139

fbshipit-source-id: 170c2359bcc67131330d091e3707124018053938
2017-12-13 08:30:39 -08:00
Yujie Liu 0b1e6444bb remove embeddedBundleURL
Reviewed By: fromcelticpark

Differential Revision: D6501542

fbshipit-source-id: c6f1adddc4e671f73195afde927face28ee79342
2017-12-12 13:11:14 -08:00
Valentin Shergin 098a63a1ce ScrollView related files were moved to dedicated folder
Summary: Trivial.

Reviewed By: rsnara

Differential Revision: D6539747

fbshipit-source-id: 716a02be185bde79e60011fcc226131972e74951
2017-12-11 19:08:00 -08:00
Valentin Shergin a255204e3e Removing `reactBridgeDidFinishTransaction` from RCTScrollView
Summary:
We are removing `reactBridgeDidFinishTransaction`.
Why?
 * It is a performance drain. Supporting this requires dispatching main-thread block on every single transaction complete;
 * It has "too broad" non-conceptual semantic which encouraged using this as a "band-aid solution" for poorly designed components;
 * It is conceptually incompatible with new approaches that we are trying to implement to optimize the render layer;
 * It was deprecated for very long time.

This diff removes `reactBridgeDidFinishTransaction` from RCTScrollView component. As I mentioned, because of the semantic of `reactBridgeDidFinishTransaction` is extremely broad, it's hard to capture what exact case it should handle. Based on comments and existing logic, it seems it tight to `contentSize` property and the size of RCTScrollContentView.

Reviewed By: rsnara

Differential Revision: D6538419

fbshipit-source-id: ccc6f5fea327471f10f1738d3da5214c0d362953
2017-12-11 19:08:00 -08:00
Valentin Shergin 60dc9bed00 -[RCTUIManagerObserver uiManagerDidPerformMounting]
Reviewed By: rsnara

Differential Revision: D6434461

fbshipit-source-id: a66407936cec3582cb27c57eb8e36dc225149c45
2017-12-11 17:10:48 -08:00
Valentin Shergin 0a8721c340 Renaming uiManagerWillFlushUIBlocks -> uiManagerWillPerformMounting
Summary:
Because it is not simply flushing, it (in the future) is more complex process. And the names should represent logical meaning of the process, not particular implementation details.
It also nice to have unified terminology across our reactive UI frameworks.

See the next diffs.

Reviewed By: rsnara

Differential Revision: D6436770

fbshipit-source-id: 0a0b686e8ace89e30f6787a37c0a7965c5af757b
2017-12-11 17:10:48 -08:00
Adam Ernst b1701ccaef Fix RCTInspectorPackagerConnection logspam for real
Reviewed By: danzimm

Differential Revision: D6486113

fbshipit-source-id: f6e661ce95ae89bafce9e0d773b484b28e4f83c4
2017-12-05 10:34:10 -08:00
Pritesh Nandgaonkar b08a912f11 vector instead of YGNodeList
Reviewed By: jonathandann, emilsjolander

Differential Revision: D6442379

fbshipit-source-id: d2d48ef0676351d2eeaa2d427dcd72e082cd15a1
2017-12-05 08:30:15 -08:00
Paco Estevez Garcia de424cc291 Add inspector attach to RN Dev Menu (iOS)
Reviewed By: Hypuk

Differential Revision: D6405831

fbshipit-source-id: ffecfbf85a35fad4d0c9a823c5e637a6b9e202ee
2017-12-05 06:31:15 -08:00
Valentin Shergin d71d28f094 RCTSurfaceStage.m was added to project file
Summary: Trivial.

Reviewed By: rsnara

Differential Revision: D6483553

fbshipit-source-id: 08c42da69cdbc5d6e0d196eed36530130ff418ba
2017-12-05 00:15:47 -08:00
Eric Davison 36ad813899 Adding support for custom accessibility actions on iOS.
Summary:
This feature has been requested by customers.  Our previous (pre-react) application had support for custom accessibility actions.

This feature allows UI elements to provide a list of custom actions that can be read when VoiceOver is enabled.  UI elements expose one accessibility action by default.  Some UI elements may support multiple actions though other mechanisms like tap and hold.  To expose these actions in an accessible way iOS provides custom accessibility actions.

Feature was tested in the iOS simulator using the Accessibility Inspector.  Custom actions were added to a button and observed in the tool.  Custom actions were also invoked using the tool and then stepped through in the debugger.

The feature was also tested on an iPhone.  VoiceOver was enabled on the device and custom actions were observed for controls that exposed them.

We have been using this feature in our app for some time as well.

[IOS] [ENHANCEMENT] [Accessibility] - Added support for custom accessibility actions

Eric Davison
Microsoft Corp.
Closes https://github.com/facebook/react-native/pull/17020

Differential Revision: D6472283

Pulled By: shergin

fbshipit-source-id: 4ac4697dca07028e87ffe71b70c00280e7f2043c
2017-12-04 23:31:50 -08:00
Adam Ernst ff3dc2ed19 Silence RCTInspectorPackagerConnection logspam
Reviewed By: jingc

Differential Revision: D6480638

fbshipit-source-id: 7610f4136b81fcb16c93920c3b70bf551b4e9ddd
2017-12-04 18:22:51 -08:00
Valentin Shergin 4d37cf0fbc RCTSurface: RCTSurfaceHostingView, interop layer beteween UIKit and RCTSurface
Summary: UIView subclass which providers interoperability between UIKit and Surface regarding layout and life-cycle.

Reviewed By: rsnara

Differential Revision: D6465922

fbshipit-source-id: 2a7cfb70119d460bc22968d1aa780833bf47d7f6
2017-12-04 13:48:27 -08:00
Alex Kotliarskyi e19d9dec9b Make testID work for iOS tabs
Reviewed By: shergin

Differential Revision: D6455054

fbshipit-source-id: 3c667b585e9332a1dbfff1fd3325f2c95985a5be
2017-12-04 11:17:10 -08:00
Valentin Shergin ba6075120a RCTSurface: Stopping the app on surface object deallocation
Reviewed By: rsnara

Differential Revision: D6431628

fbshipit-source-id: 2b3fd39d77a1108516f00727dd21f648c2bf41b1
2017-12-03 20:16:36 -08:00
Valentin Shergin 43b2509320 RCTSurface: activityIndicatorViewFactory was removed from RCTSurfaceView
Summary: Apparently we don't need this at this level. This will be implemented as part of RCTSufraceHostingView.

Reviewed By: rsnara

Differential Revision: D6367071

fbshipit-source-id: 71a2361b8a0c6594c63602165ce5e054de62630d
2017-12-03 20:16:36 -08:00
Valentin Shergin e9e0cd7ab8 RCTSurface: Couple helper functions for Stage
Summary: We need this trivial funcs to unify spinner appearance logic.

Reviewed By: rsnara

Differential Revision: D6367072

fbshipit-source-id: 70e288bc1fed5911828a5f6deaa829597bf8ebff
2017-12-03 20:16:35 -08:00
Valentin Shergin da17b237e1 RCTSurface: Use async dispatch to register root shadow view
Summary: We don't really need sync dispatch here. We only need sequential execution of our UIManager blocks.

Reviewed By: rsnara

Differential Revision: D6367069

fbshipit-source-id: cc675aafd6c762506048bcf65c24e54080b013a5
2017-12-03 20:16:35 -08:00
Valentin Shergin 081f7d14ad RCTSurface: Fixed problem in stage propagation
Summary: We previously incorrectly communicated to the delegate changed fragment instead of compound value.

Reviewed By: rsnara

Differential Revision: D6367070

fbshipit-source-id: 373a7c14a79a4727a7e8f61178dea3ca16ea1f40
2017-12-03 20:16:35 -08:00
Sophie Alpert 2e1707d0e6 Fix RCTRefreshControl jumping
Reviewed By: shergin

Differential Revision: D6470066

fbshipit-source-id: 44fb03c264d98af61dccfa0146690fd49ee9f2ab
2017-12-03 16:15:53 -08:00
chendo 19b0a65c5e Improve accessibilityLabel performance
Summary:
Integration testing with Appium on iOS is slow. Profiling with Instruments.app points to `RCTView`'s `accessibilityLabel` method being a hot point in React Native, due to the `RCTRecursiveAccessibilityLabel` function.

I did a baseline benchmark by using Appium's `find_element(accessibility_id: <label>)` call on our application 10 times and got a baseline result of 0.6s for one of our primary screens.

After implementing the change and performing the same call 10 times, I got 0.48s for the same call, for a 20% performance increase in `find_element`.

[iOS] [View] - Improve performance of `RCTView` `accessibilityLabel`

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAL  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
Closes https://github.com/facebook/react-native/pull/17022

Differential Revision: D6459462

Pulled By: shergin

fbshipit-source-id: 3de7e5dc075281e35e62b4d4234d3f7fac5aae23
2017-12-01 10:16:39 -08:00
Valentin Shergin 71b498b082 Introducing `[RCTUIManager _executeBlockWithShadowView:forTag:]`
Summary:
New super simple abstraction in RCTUIManager.
Nothing really changed and RCTUIManager became shorter.

Reviewed By: rsnara

Differential Revision: D5990342

fbshipit-source-id: b38397b789a999168ac14625585065eda73d328f
2017-11-29 23:01:31 -08:00
Valentin Shergin 21714fe197 Removing RCTUIManager.unsafeFlushUIChangesBeforeBatchEnds experiment
Reviewed By: javache

Differential Revision: D6432476

fbshipit-source-id: fd02b686cf8bc70a4dfcc02d3bbfdf01c611f351
2017-11-29 10:34:04 -08:00
Ben Nham 70c359000a move inspector out of jschelpers
Differential Revision: D6385924

fbshipit-source-id: 1913d903077494cc0d86d5a8c8839620f1ecab0c
2017-11-27 07:23:37 -08:00
Pritesh Nandgaonkar 0984f29a32 Refactor and move YGNodeToString implementation to different file
Reviewed By: emilsjolander

Differential Revision: D6397372

fbshipit-source-id: 79e701efe7f19db6dac1aea6328ebf0ac84a7ac3
2017-11-23 09:46:30 -08:00
Alex Dvornikov e7bd0f056b Remove self capturing RCTCxxBridge->_pendingCalls
Differential Revision: D6387237

fbshipit-source-id: 3244bba439ba9fc38c5be09657cbdc787b9b4585
2017-11-23 05:17:19 -08:00
Nicolas Charpentier b9e7006cc6 Fix markdown in requiresMainQueueSetup warning
Summary:
nit-picking

[IOS] [MINOR] [React/Base/RCTModuleData.mm] - Fix markdown in `requiresMainQueueSetup` warning
Closes https://github.com/facebook/react-native/pull/16916

Differential Revision: D6394725

Pulled By: shergin

fbshipit-source-id: 272c5a6ee529af0b162230e8a07275043a888907
2017-11-22 02:31:05 -08:00
Nicolas Charpentier ee3532b5c2 Implement requiresMainQueueSetup in RCTTVNavigationEventEmitter
Summary:
Fix the following warning:

> Module RCTTVNavigationEventEmitter requires main queue setup since it overrides `init` but doesn't implement `requiresMainQueueSetup`. In a future release React Native will default to initializing all native modules on a background thread unless explicitly opted-out of.

Trivial change.

[IOS] [MINOR] [RCTTVNavigationEventEmitter] - Implement `requiresMainQueueSetup` in `RCTTVNavigationEventEmitter`
Closes https://github.com/facebook/react-native/pull/16915

Differential Revision: D6394636

Pulled By: shergin

fbshipit-source-id: 3981655832715e73e93ef917d987e25097029b84
2017-11-22 00:39:33 -08:00
Nikita Tuk 15179f1798 Fixed fractional border width on iOS
Summary:
Incorrect render for borders that are not proportional to device pixel: borders get stretched and become significantly bigger than expected.
Rdar: http://www.openradar.me/15959788

Incorrect render for borders that are not proportional to device pixel: borders get stretched and become significantly bigger than expected.
Rdar: http://www.openradar.me/15959788

Reviewed By: shergin

Differential Revision: D6317674

fbshipit-source-id: 6bc331447458583a02c0e56d0d011a31d31d70a8
2017-11-21 12:16:21 -08:00
Pritesh Nandgaonkar d7ab9496bc Change c files to cpp
Reviewed By: gkassabli

Differential Revision: D6271299

fbshipit-source-id: 66c0e54ccf019d72d1fd0b4d117826e4e84fdc89
2017-11-21 10:18:29 -08:00
Adam Ernst 33cefc1760 RCTRedBox should appear beneath the status bar
Reviewed By: fromcelticpark

Differential Revision: D6370566

fbshipit-source-id: fe59a789113c2e8c24e96e560647efbd8bdfe67b
2017-11-20 18:36:27 -08:00
Adam Ernst 9180d4eb82 Make RCTPackagerConnection a singleton
Reviewed By: fromcelticpark

Differential Revision: D6361741

fbshipit-source-id: 96e92dff5dd3d7aa1f7555442b0eba90e7dbf47c
2017-11-20 18:36:27 -08:00
Alex Dvornikov 0ac5a5230c Make RCTNativeModule::invokeInner explicitely return folly::none in case of error
Differential Revision: D6347967

fbshipit-source-id: 88788da321ca75d20b6c1a8e3d41642af7c6155e
2017-11-17 03:17:20 -08:00
Douglas 45185947ee Fix tvOS compile issues; enable TVEventHandler in Modal (fix #15389)
Summary:
**Motivation**

Fix an issue (#15389) where `TVEventHandler` would not work when a modal was visible.  The solution adds the gesture recognizers from the native `RCTTVRemoteHandler` to the native modal view (except for the menu button recognizer, which still needs special handling in modals).  This PR also fixes some breakages in compiling React Native for tvOS.

**Test plan**

Compilation fixes should enable tvOS compile test to pass in Travis CI.

The modal fix can be tested with the following component, modified from the original source in #15389 .

``` javascript
import React, { Component } from 'react';
import ReactNative from 'ReactNative';
import {
    Text,
    View,
    StyleSheet,
    TouchableHighlight,
    TVEventHandler,
    Modal,
} from 'react-native';

export default class Events extends Component {

    constructor(props) {
        super(props);

        this.state = {
            modalVisible: false,
        };
        this._tvEventHandler = new TVEventHandler();
    }

    _enableTVEventHandler() {
        this._tvEventHandler.enable(this, (cmp, evt) => {
            const myTag = ReactNative.findNodeHandle(cmp);
            console.log('Event.js TVEventHandler: ', evt.eventType);
            // if (evt.eventType !== 'blur' && evt.eventType !== 'focus') {
            //  console.log('Event.js TVEventHandler: ', evt.eventType);
            // }
        });
    }

    _disableTVEventHandler() {
        if (this._tvEventHandler) {
            this._tvEventHandler.disable();
            delete this._tvEventHandler;
        }
    }

    componentDidMount() {
        this._enableTVEventHandler();
    }

    componentWillUnmount() {
        this._disableTVEventHandler();
    }

    _renderRow() {
        return (
            <View style={styles.row}>
                {
                    Array.from({ length: 7 }).map((_, index) => {
                        return (
                            <TouchableHighlight
                                key={index}
                                onPress={() => { this.setState({ modalVisible: !this.state.modalVisible }); }}
                            >
                                <View style={styles.item}>
                                    <Text style={styles.itemText}>{ index }</Text>
                                </View>
                            </TouchableHighlight>
                        );
                    })
                }
            </View>
        );
    }

    onTVEvent(cmp, evt) {
      console.log('Modal.js TVEventHandler: ', evt.eventType);
    }

    hideModal() {
      this.setState({
        modalVisible: false
      });
    }

    render() {
        return (
            <View style={styles.container}>
                <Modal visible={this.state.modalVisible}
                       onRequestClose={() => this.hideModal()}>
                    <View style={styles.modal}>
                        { this._renderRow() }
                        { this._renderRow() }
                    </View>
                </Modal>
                { this._renderRow() }
                { this._renderRow() }
            </View>
        );
    }
}

const styles = StyleSheet.create({
    container: {
        flex: 1,
        backgroundColor: 'darkslategrey',
    },
    row: {
        flexDirection: 'row',
        padding: 30,
    },
    item: {
        width: 200,
        height: 100,
        borderColor: 'cyan',
        borderWidth: 2,
        margin: 30,
        alignItems: 'center',
        justifyContent: 'center',
    },
    itemText: {
        fontSize: 40,
        color: 'cyan',
    },
    modal: {
        flex: 1,
        backgroundColor: 'steelblue',
    },
});
```
**Release Notes**

After this change, the `onRequestClose` property will be required for a `Modal` in Apple TV.
Closes https://github.com/facebook/react-native/pull/16076

Differential Revision: D6288801

Pulled By: hramos

fbshipit-source-id: 446ae94a060387324aa9e528bd93cdabc9b5b37f
2017-11-09 13:54:54 -08:00
Alex Dvornikov 681278947e Adopt new split segments registration approach on iOS
Differential Revision: D6284479

fbshipit-source-id: d0d7e8c6a6ce4ecab63739149be69f25df7fbe6f
2017-11-09 12:23:49 -08:00
Alex Dvornikov cff0d8e0e5 Register split segment paths with RAMBundleRegistry
Differential Revision: D6284466

fbshipit-source-id: c80cf929af38f92f06cca5b366c58785ae992d83
2017-11-09 12:23:46 -08:00
Yujie Liu ae5ef653cb Rename bundleSource to embeddedBundle
Reviewed By: fromcelticpark

Differential Revision: D6274101

fbshipit-source-id: f62da158d165cb3ce4a510ebc4eed24a8a719381
2017-11-09 09:33:00 -08:00
Alex Dvornikov 6ecae73fe5 Remove RAMBundleRegistry subclasses
Differential Revision: D6262247

fbshipit-source-id: 708f919e34f1706d9aca19a34ad8ea506e9f8d8b
2017-11-08 04:12:20 -08:00
Yujie Liu b983de9c54 Share bundled source URL to RN
Differential Revision: D6192988

fbshipit-source-id: efa584ee2340a34156956990d6cd96d37ba4ab60
2017-11-07 16:46:53 -08:00
Valentin Shergin 7df58e23a3 Introducing RCTSurface, new experimental thread-safe interop layer
Summary:
RCTSurface instance represents React Native-powered piece of a user interface
which can be a full-screen app, separate modal view controller,
or even small widget. It is called "Surface".

The RCTSurface instance is completely thread-safe by design;
it can be created on any thread, and any its method can be called from
any thread (if the opposite is not mentioned explicitly).
The primary goals of the RCTSurface are:
 - ability to measure and layout the surface in a thread-safe and synchronous manner;
 - ability to create a UIView instance on demand (later);
 - ability to communicate the current stage of the surface granularly.

Differential Revision: D6202576

fbshipit-source-id: 8e644c87fcaad2b6a9c9304b58384d7192747556
2017-11-07 16:16:56 -08:00
Valentin Shergin be6976d6fa RCTAllocatedRootViewTag was moved to RCTUIManagerUtils
Summary: This logic was decoupled from RCTRootView to make it reusable.

Reviewed By: javache

Differential Revision: D6214785

fbshipit-source-id: e7419be03ba0e20d95b47c11e41789636aa6e916
2017-11-07 16:16:56 -08:00
Vojtech Novak 75d62bf0a8 fix #10747 (ScrollView rendered incorrectly with RefreshControl)
Summary:
set the y offset to 0, since 0 offset is where we want to be after we hide the refreshControl.

Tested in emulator with ios 8, 9, 10 and also with section headers.
Closes https://github.com/facebook/react-native/pull/15033

Differential Revision: D6265930

Pulled By: shergin

fbshipit-source-id: b249c4713de68fc6b3a32cee7f995dc352315970
2017-11-07 16:16:56 -08:00
Alex Dvornikov f1258181ee Rename "js-bundles" to "js-segments"
Differential Revision: D6244399

fbshipit-source-id: d1606d126e3b598b19fa8a0955438c8dec76f5d0
2017-11-06 18:25:52 -08:00
Robert Paul fd9c3618fc - Adding locale prop to DatePickerIOS
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

While building a React Native application, I've come across the use case of wanting to set a specific locale for DatePickers irrespective of the users OS region setting. Since this is a feature available to native DatePicker components, I think it would be helpful to expose this in React Native as well.

Testing can be done by passing a `locale` prop to a DatePickerIOS. Example:

```
<DatePickerIOS
  date={this.state.date}
  mode="date"
  locale="fr_FR"
  onDateChange={date => this.setState({ date: date })}
/>
```

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAl  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
[IOS][ENHANCEMENT][DatePickerIOS] - Adding a locale prop.
Closes https://github.com/facebook/react-native/pull/16639

Differential Revision: D6241981

Pulled By: hramos

fbshipit-source-id: 77b1b85c09f3e12d6b3e103b3d1ffd1f12e2cea9
2017-11-04 14:40:24 -07:00
Aditya Kumar 7c95db11d7 Return NSString instead of SEL
Reviewed By: javache

Differential Revision: D6211964

fbshipit-source-id: 4a55d56d0cc4be10460087810f62134676983203
2017-11-03 16:31:31 -07:00
Yujie Liu 90a00a66e2 bundledSourceURLForBridge always return bundle path
Differential Revision: D6215467

fbshipit-source-id: 49d818cfdb776dd849a809440a1e592e5cb2231a
2017-11-03 14:16:40 -07:00
Mehdi Mulani b8a5136d22 Fix memory leak in RCTSafeAreaView
Summary:
According to the retain code collector, RCTSafeAreaView is in a cycle:
-> _bridge -> RCTCxxBridge -> _moduleDataByName -> __NSDictionaryM -> RCTModuleData -> _instance -> RCTUIManager -> _viewRegistry -> __NSDictionaryM -> RCTSafeAreaView
This should break the cycle.

Reviewed By: shergin

Differential Revision: D6213668

fbshipit-source-id: efb9c1dd148b72f66fe4485b81c16cd4c2d18b17
2017-11-02 08:51:34 -07:00
Yujie Liu dec81781cd Add bundleSourceURLForBridge in RCTBridgeDelegate
Differential Revision: D6190622

fbshipit-source-id: c45a327be0b0ded6ce10d14b481c0583acca6cca
2017-11-01 09:06:22 -07:00
Jakub Grzmiel 308360ef7f Add __autoreleasing paramters to fix block-capture-autoreleasing warning
Differential Revision: D6196088

fbshipit-source-id: 38a4fd33800113fe78c5e4db27ea0d1354568ce0
2017-10-31 09:17:24 -07:00
Y.Shing 2546c95ac8 Fix iOS 11 WebView extra white space on top due to contentInsetAdjustmentBehavior
Summary:
Same IOS 11 issue as https://github.com/facebook/react-native/pull/15023
Fixes the annoying 20px content insert on top.
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

Fix the behaviour of WebView when building the iOS project with Xcode 9 due to the `contentInsetAdjustmentBehavior`.

![expected](https://user-images.githubusercontent.com/5630513/32207551-b7789668-bdca-11e7-840a-f325b2767d08.jpg)
![iphone_x_after](https://user-images.githubusercontent.com/5630513/32207557-beb8fd6e-bdca-11e7-87d0-18d533f20125.jpg)

![issue_normal_iphone_ios11](https://user-images.githubusercontent.com/5630513/32207572-d773be5c-bdca-11e7-8e28-8f0783eef1cd.jpg)
![iphone_x_before](https://user-images.githubusercontent.com/5630513/32207581-e3e93234-bdca-11e7-847d-f801bbf05d55.jpg)

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAl  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->
 [IOS] [BUGFIX] [WebView] - Fix extra white space added to webView due to iOS 11 contentInsetAdjustmentBehavior
Closes https://github.com/facebook/react-native/pull/16519

Differential Revision: D6195670

Pulled By: shergin

fbshipit-source-id: 08d4d4dc700059bb7707e038dc4f592af0275896
2017-10-30 23:29:20 -07:00
Aditya Kumar bbc90b4dc2 Move RCTConvertSelectorForType to their respective using modules
Reviewed By: javache

Differential Revision: D6137419

fbshipit-source-id: a30193469e7a061331d3d6798324475890c75625
2017-10-26 17:03:41 -07:00
Dan Zimmerman 55f75dfd65 Remove the experimental concept of whitelisted modules
Reviewed By: dcaspi

Differential Revision: D6124036

fbshipit-source-id: af3771ce2204b3695f79265d5aade7e321e12a3e
2017-10-25 08:20:48 -07:00
Dan Zimmerman fe792f5878 Remove experimental shouldBridgeLoadJavaScriptSynchronously:
Differential Revision: D6124037

fbshipit-source-id: a116def1032e1f4656fafbc7f2e36e812b13c9c0
2017-10-25 08:20:48 -07:00
Dan Zimmerman ca85a536c6 Remove experimental shouldBridgeInitializeNativeModulesSynchronously:
Differential Revision: D6124035

fbshipit-source-id: 540b8bfc955bf48e9ca33ed97807177ac740059e
2017-10-25 08:20:48 -07:00
Ramanpreet Nara efa4d3c222 Rename I18nManager Left/Right swap methods
Reviewed By: fkgozali

Differential Revision: D6140072

fbshipit-source-id: 282dc614c036de8f217a729f21a1bbe92b8afd7d
2017-10-24 20:45:59 -07:00
Tsolis Dimitris Sotiris 1d674f0309 Fix crash when loading local bundle and hot reload is enabled
Summary:
<!--
Thank you for sending the PR! We appreciate you spending the time to work on these changes.

Help us understand your motivation by explaining why you decided to make this change.

You can learn more about contributing to React Native here: http://facebook.github.io/react-native/docs/contributing.html

Happy contributing!

-->

When initializing react native module using a url pointing to local jsbundle and hot reload is enabled, bridge, is trying to initialize the feature but crashes because there is no host in a local file url.

1. Create a new project.

```sh
$ react-native init testPlanApp && cd testPlanApp
```

2. Create jsbundle.

```sh
$ react-native bundle --platform ios --dev false --entry-file index.js --bundle-output ios/main.jsbundle
```

3. Run the app and enable hot reload.
4. Enable airplane mode.
5. Close application and re-run.
6. See app crashes.

<!--
Help reviewers and the release process by writing your own release notes

**INTERNAL and MINOR tagged notes will not be included in the next version's final release notes.**

  CATEGORY
[----------]        TYPE
[ CLI      ]   [-------------]      LOCATION
[ DOCS     ]   [ BREAKING    ]   [-------------]
[ GENERAl  ]   [ BUGFIX      ]   [-{Component}-]
[ INTERNAL ]   [ ENHANCEMENT ]   [ {File}      ]
[ IOS      ]   [ FEATURE     ]   [ {Directory} ]   |-----------|
[ ANDROID  ]   [ MINOR       ]   [ {Framework} ] - | {Message} |
[----------]   [-------------]   [-------------]   |-----------|

[CATEGORY] [TYPE] [LOCATION] - MESSAGE

 EXAMPLES:

 [IOS] [BREAKING] [FlatList] - Change a thing that breaks other things
 [ANDROID] [BUGFIX] [TextInput] - Did a thing to TextInput
 [CLI] [FEATURE] [local-cli/info/info.js] - CLI easier to do things with
 [DOCS] [BUGFIX] [GettingStarted.md] - Accidentally a thing/word
 [GENERAL] [ENHANCEMENT] [Yoga] - Added new yoga thing/position
 [INTERNAL] [FEATURE] [./scripts] - Added thing to script that nobody will see
-->

[IOS] [BUGFIX] [Hot reloading] - Fix crash when loading local bundle and hot reload is enabled.
Closes https://github.com/facebook/react-native/pull/16504

Differential Revision: D6133767

Pulled By: shergin

fbshipit-source-id: 3f7668e3e8fa7e772f58420e5a8a0985a5f8e48b
2017-10-24 00:06:31 -07:00
Janic Duplessis c47759a9ae Fix potential retain cycles in Animated iOS
Summary:
Fixes potential retain cycles detected by an internal fb tool.

```
First:

__NSDictionaryM
-> RCTPropsAnimatedNode
-> _parentNodes -> __NSDictionaryM
-> RCTStyleAnimatedNode
-> _childNodes -> __NSDictionaryM

Second:

RCTScrollView
-> _eventDispatcher -> RCTEventDispatcher
-> _observers -> __NSArrayM
-> RCTNativeAnimatedModule
-> _nodesManager -> RCTNativeAnimatedNodesManager
-> _uiManager -> RCTUIManager
-> _viewRegistry -> __NSDictionaryM
-> RCTScrollView
```

First fix:
Use weak map for parent and child nodes, strong refs are managed by RCTNativeAnimatedNodesManager

Second fix:
Make RCTEventDispatcher observers a weak array and make sure we don't keep strong refs to UIManager in RCTNativeAnimatedNodesManager and RCTPropsAnimatedNode.

Tested that native animations still work in UIExplorer

[IOS] [BUGFIX] [NativeAnimated] - Fix potential retain cycles in Animated iOS
Closes https://github.com/facebook/react-native/pull/16506

Differential Revision: D6126400

Pulled By: shergin

fbshipit-source-id: 1ac5083f8ab79a806305edc23ae4796ed428f78b
2017-10-23 13:20:59 -07:00
Sam Mueller d38b95f8b7 (iOS) Support for ExtraBold alias of Heavy (font-weight 800)
Summary:
ExtraBold is a fairly common suffix in font naming. A good example is "Circe-ExtraBold". It's usually synonymous with Heavy or Black at font weight 800, as described here: https://www.webtype.com/info/articles/fonts-weights/

This fixes a regression with ExtraBold fonts introduced in d3007b0 where simply having an extrabold font will cause `weightOfFont` to choose this weight aggressively, resulting in all bold text erroneously interpreted as extrabold/heavy. This fix ensures that extrabold is detected before bold, and correctly attributed to `UIFontWeightHeavy`.
Closes https://github.com/facebook/react-native/pull/16323

Differential Revision: D6119059

Pulled By: shergin

fbshipit-source-id: 56a5c30584f220974308a7d6068c8d952aa20fb8
2017-10-23 11:24:18 -07:00
Ramanpreet Nara 64284bf66e iOS: Implement margin(Start|End) styles for RN
Reviewed By: mmmulani

Differential Revision: D5884168

fbshipit-source-id: 4d37583ba79324e6cf8caaa20cecf865f28337f7
2017-10-18 19:33:31 -07:00
Ramanpreet Nara 0a70c026cb iOS: Implement padding(Start|End) styles for RN
Reviewed By: mmmulani

Differential Revision: D5876934

fbshipit-source-id: 55fc49e0fddeaf0e6541d3159f35783e02bd6260
2017-10-18 19:33:31 -07:00
Ramanpreet Nara 1b5f8d3ee5 iOS: Implement border(Top|Bottom)(Start|End)Radius and border(Start|End)(Color|Width) RN styles
Reviewed By: shergin

Differential Revision: D5874536

fbshipit-source-id: 5ad237bddb70745aef0341cddb172da5ee388c38
2017-10-18 19:33:31 -07:00
Ramanpreet Nara 38b5506599 iOS: Forward RN start/end styles to Yoga
Reviewed By: mmmulani

Differential Revision: D5853589

fbshipit-source-id: 9acee0993a25dce5f4b1ce506746b789b1c4c763
2017-10-18 19:33:31 -07:00
Ramanpreet Nara 98547d4bcf Implement gating support for direction-aware API changes
Reviewed By: achen1

Differential Revision: D6045083

fbshipit-source-id: 857a43029ad88d2324ec77145a1e30d92b5e8fae
2017-10-18 19:33:31 -07:00
Kevin Gozali 47bfbbb1d3 iOS: introduce RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD() macro to provide the return type of a sync method
Summary:
This provides a way to customize the return type of a sync exported method, instead of just using `id`.

```
RCT_EXPORT_SYNCHRONOUS_TYPED_METHOD(NSString *, sync1:(NSString *)x)
{
  return @"hello";
}
```

The return type needs to be a sub type of `id` - so scalars like `double` won't work (the bridge will crash).

Differential Revision: D6068884

fbshipit-source-id: 43a98141f1d0aef335aa0b33a24219f8e574e58b
2017-10-17 06:15:13 -07:00
Marc Horowitz 0a7d5ab753 Add support for FBReactModule (Wilde) to use jsi/hermes with a bcbundle
Reviewed By: danzimm

Differential Revision: D5983822

fbshipit-source-id: ae09c0a33988cb9c3d51e5a18b875698c19a1ec6
2017-10-16 17:07:48 -07:00
James Ide 7733d40237 Move JS-native version check to its own module + unit tests + prefix Obj-C macro w/RCT
Summary:
- The version check that ensures the JS and native versions match is now in its own module for two reasons: it is easier to test and it allows react-native-windows to override just this module to implement its own version check (ex: more advanced checks for RNW-specific code).
- Added unit tests for the version checking to specify its behavior more clearly, including parity between dev and prod to avoid prod-only behavior and mitigate SEVs.
- Prefixed the Obj-C `#define` with `RCT_` to conform with other RN globals.
Closes https://github.com/facebook/react-native/pull/16403

Differential Revision: D6068491

Pulled By: hramos

fbshipit-source-id: 2b255b93982fb9d1b655fc62cb17b126bd5a939a
2017-10-16 14:30:34 -07:00
Alex Dvornikov dd400f842b add "jsBundlesDirectory" method to RCTBridgeDelegate
Differential Revision: D6030185

fbshipit-source-id: 58d6f9d0d412c7ad0f83af9ae4df01c4dc1178bc
2017-10-12 12:33:21 -07:00
Dmitry Zakharov 04ff184c12 Make RCTUIManager and RCTDeviceInfo unsubscribe from NSNotificationCenter on
Reviewed By: fromcelticpark

Differential Revision: D5986167

fbshipit-source-id: 18131572361c4b3f5e0ed5c8f97833a21902cad1
2017-10-10 05:10:05 -07:00
Valentin Shergin 32e5c8e5b5 Deprecated stuff was removed from RCTShadowView
Summary: It was deprecated awhile ago.

Reviewed By: javache

Differential Revision: D5990504

fbshipit-source-id: a218410d17f5f450d573338522b689e035106aba
2017-10-09 17:22:35 -07:00
Valentin Shergin 4342879c92 Deprecated stuff was removed from RCTUIManager
Summary: It was deprecated awhile ago.

Reviewed By: javache

Differential Revision: D5990505

fbshipit-source-id: 68deefb76fee31a49bfe832e281dc8ee11061cb8
2017-10-09 17:22:35 -07:00
Valentin Shergin b0c1bd284f `[RCTShadowView localData]` is now only setter.
Summary: It saves 8 bytes per shadowView instance, and it is more logical because it does nothing by default.

Reviewed By: javache

Differential Revision: D5997804

fbshipit-source-id: c985a11aeea881e95911469e10c8c27429a2718a
2017-10-09 10:46:08 -07:00
Valentin Shergin 5e25c0e32f Introducing PseudoUIManagerQueue
Summary:
Queues Problem Intro:
UIManager queue is special queue because it has special relationship with
the Main queue.

This particular relationship comes from two key factors:
 1. UIManager initiates execution of many blocks on the Main queue;
 2. In some cases, we want to initiate (and wait for) some UIManager's work *synchronously* from
    the Main queue.

So, how can we meet these criteria?
"Pseudo UIManager queue" comes to rescue!

"Pseudo UIManager queue" means safe execution of typical UIManager's work
on the Main queue while the UIManager queue is explicitly blocked for preventing
simultaneous/concurrent memory access.

So, how can we technically do this?
 1. `RCTAssertUIManagerQueue` is okay with execution on both actual UIManager and
    Pseudo UIManager queues.
 2. Both `RCTExecuteOnUIManagerQueue` and `RCTUnsafeExecuteOnUIManagerQueueSync`
    execute given block *synchronously* if they were called on actual UIManager
    or Pseudo UIManager queues.
 3. `RCTExecuteOnMainQueue` executes given block *synchronously* if we already on
    the Main queue.
 4. `RCTUnsafeExecuteOnUIManagerQueueSync` is smart enough to do the trick:
    It detects calling on the Main queue and in this case, instead of doing
    trivial *synchronous* dispatch, it does:
      - Block the Main queue;
      - Dispatch the special block on UIManager queue to block the queue and
        concurrent memory access;
      - Execute the given block on the Main queue;
      - Unblock the UIManager queue.

Imagine the analogy: We have two queues: the Main one and UIManager one.
And these queues are two lanes of railway go in parallel. Then,
at some point, we merge UIManager lane with the Main lane, and all cars use
the unified the Main lane.
And then we split lanes again.

This solution assumes that the code running on UIManager queue will never
*explicitly* block the Main queue via calling `RCTUnsafeExecuteOnMainQueueSync`.
Otherwise, it can cause a deadlock.

Reviewed By: mmmulani

Differential Revision: D5935464

fbshipit-source-id: 6a60ff236280d825b4e2b101f06222266097b97f
2017-10-08 21:40:19 -07:00
Adam Ernst e87904cea5 Redo error handling on iOS
Reviewed By: danzimm

Differential Revision: D5969343

fbshipit-source-id: 376984a6e959349260c54884c0b0b719f4c353d6
2017-10-05 13:31:55 -07:00
Valentin Shergin f8e13868dd Fixed crash in [UIManager setLocalData:]
Summary:
This is pretty normal and harmless case, we should not crash here.
I plan to refactor similar places in this file soon.

Reviewed By: AaaChiuuu

Differential Revision: D5983443

fbshipit-source-id: 922fea8ed12ebef45d249f16739aa81fe3254f19
2017-10-04 19:54:24 -07:00
Alex Dvornikov afec987e10 Unify sampling profiler and reload logic by leveraging RCTPackagerConnection
Differential Revision: D5951952

fbshipit-source-id: ceea04ebbddb02944717a266a14523be052ab213
2017-10-04 19:17:06 -07:00
Alex Dvornikov 9e01d72103 Unify supplimentary bundle path creation logic between Android and iOS
Differential Revision: D5941546

fbshipit-source-id: c9b8fab887f480faa373c26a1d5ba310e8acde78
2017-10-04 15:16:27 -07:00
Alex Dvornikov d07279c978 Remove usage of "this" in a callback in RCTNativeModule
Summary: As RCTNativeModule can be destructed at any time, it's unsafe to capture "this" in a callback.

Reviewed By: javache

Differential Revision: D5963728

fbshipit-source-id: c80a01c851d97813e4fead2b31c442eaeb8ae204
2017-10-04 06:00:09 -07:00
Paco Estevez Garcia ef2e29f54c Move URL escaping to Inspector layer
Reviewed By: Hypuk

Differential Revision: D5967544

fbshipit-source-id: d741e6324aff7583778cb13c862505b61ca02a3d
2017-10-04 03:51:33 -07:00
Frank Manns 09680f71df Return instancetype for shared RCTI18nUtil instance
Summary:
In modern Objective-C you should use the `instancetype` keyword for methods which return an instance of the class they are called on. See Apple's [Adopting Modern Objective-C](https://developer.apple.com/library/content/releasenotes/ObjectiveC/ModernizationObjC/AdoptingModernObjective-C/AdoptingModernObjective-C.html) guide.

Because `sharedInstance` was returning an object of type `id`, the returned value needed to be cast before it could be used in Swift.

I also changed the implementation of `sharedInstance` to use Grand Central Dispatch, which is the generally accepted best way of creating a singleton in Objective-C.

I verified my changes with the "RTLExample" app in RNTester.

| LTR | RTL |
|---|---|
|<img width="300" src="https://user-images.githubusercontent.com/1413388/31155210-6454b4d6-a87a-11e7-9dd7-9a52f3924737.png">|<img width="300" src="https://user-images.githubusercontent.com/1413388/31155233-8702aff6-a87a-11e7-8028-51cf2b3eb0c4.png">|
Closes https://github.com/facebook/react-native/pull/16196

Differential Revision: D5971898

Pulled By: shergin

fbshipit-source-id: dfa375c89248adfc9fd885cacc6a6d4cbfea6e90
2017-10-03 20:11:16 -07:00
Ramanpreet Nara 992ade1fc5 Re-render views when direction changes
Reviewed By: shergin

Differential Revision: D5959573

fbshipit-source-id: 36b2cde921362a934a2c88a3ed05be5082ed08bf
2017-10-03 13:01:06 -07:00
Valentin Shergin 20ba5158d6 SafeAreaView was added to OSS RNTester project file
Reviewed By: rsnara

Differential Revision: D5962563

fbshipit-source-id: c043d3ab32d6ed77a1a258b30fa86661338f5c76
2017-10-03 11:30:56 -07:00
Paco Estevez Garcia da14fad829 Add AppIdentity and DeviceIdentity to Inspector
Reviewed By: Hypuk

Differential Revision: D5924011

fbshipit-source-id: a81d420dbe1a5ede203d2fa313548e19664b9587
2017-10-03 06:03:23 -07:00
Valentin Shergin 33f4779ed8 DeviceInfo.isIPhoneX_deprecated: ugly and temporary way to fix your UI on iPhone X
Summary:
If you are a product developer and you need to fix your app's issues related to iPhone X limitations asap,
you can temporary use `DeviceInfo.isIPhoneX_deprecated`.
You can, but you should not. Please consider use new <SafeAreaView>.
This prop was initially named so ugly because we are trying to discourage the community to use it.
However, we understand that sometimes we need a "band-aid" to prevent our apps bleeding.
Note: This prop (DeviceInfo.isIPhoneX_deprecated) will be removed completely after 06/18.

Reviewed By: fkgozali

Differential Revision: D5946329

fbshipit-source-id: 5d6dcaf0e2d175327d59cde4b5ec2e01cd77ec70
2017-10-02 23:00:03 -07:00
Valentin Shergin 9cd095eae8 Using RCTExecuteOnMainQueue in RCTUIManager
Reviewed By: javache

Differential Revision: D5937423

fbshipit-source-id: 1b7f5976acdfdfd00c6aa5c13e80113ba1e04434
2017-10-02 18:20:19 -07:00
Valentin Shergin feba4f6a92 Using RCTExecuteOnUIManagerQueue convinient func in all conseptually identical cases
Summary:
Reasons:
 * It is more clear and readable;
 * It is more semantical;
 * It allows us to add some magic (and complexity, to be fair) to the RCTExecuteOnUIManagerQueue. (See next diffs in the stack.)

Reviewed By: javache

Differential Revision: D5935466

fbshipit-source-id: aeb18d6e11c047eb19182a656da581b6ce073602
2017-10-02 18:20:19 -07:00
Simon Racz be27f44e1b Removed a wrong assert.
Summary:
This fixes [#15801](https://github.com/facebook/react-native/issues/15801)

We ran into a strange crash on iOS (debug only). After removing the clutter I was able to reproduce it in a tiny app. You can check it out [here.](https://github.com/simonracz/textinput_stress)

The UI in JS and native are not always in sync (which is okay). Due to this, a native view might call back into JS, which is no longer present in the shadow view hierarchy there. I think this should be also okay.

TextInput in some cases calls into [setIntrinsicContentView](6d67e2dbbc/React/Modules/RCTUIManager.m (L382)), where it triggers an overly enthusiastic `NSAssert` and crashes the app.

Check out [textinput_stress](https://github.com/simonracz/textinput_stress)
Rotate the simulator a few times to see the crash or the lack of crash.
Closes https://github.com/facebook/react-native/pull/16170

Differential Revision: D5959776

Pulled By: shergin

fbshipit-source-id: f39f5a3f1d86b330ecf7cbccd90871bc01fd69d9
2017-10-02 17:46:00 -07:00
Jason Carreiro abed3cf6c4 Revert D5944488: [RN][iOS]: Re-render views when direction changes
Differential Revision: D5944488

fbshipit-source-id: 79e695dcc0ea7d09544ace1525828333a5818c5a
2017-10-02 12:19:25 -07:00
Ramanpreet Nara 9bbc70c442 Re-render views when direction changes
Summary:
This is required for D5874536, wherein I'll be introducing direction-aware props for borders.

When a view's border changes due to a direction update, only the frames of its children update. Therefore, only the children `UIView`s get a chance to be re-rendered. This is incorrect because the view that's had its borders changed also needs to re-render. So, I keep a track of the layout direction in a property on all shadow views. Then, when I update that prop within `applyLayoutNode`, I push shadow views into the `viewsWithNewFrames` set.

Reviewed By: mmmulani

Differential Revision: D5944488

fbshipit-source-id: 3f23e9973f3555612920703cdb6cec38e6360d2d
2017-10-02 11:15:48 -07:00
Valentin Shergin cd74e46d3b Fixed RNTester project file for Apple TV
Summary: Now it compiles and works.

Reviewed By: fromcelticpark

Differential Revision: D5952026

fbshipit-source-id: df0408108ab29b77592d78b29553d2e65686f2f2
2017-10-01 20:30:08 -07:00
Alex Dvornikov c4f7ce9afd always pass key parameter to RCTReadFile
Differential Revision: D5921064

fbshipit-source-id: ad2dd352060fcb2c873dc5a91781797c9abd6c33
2017-09-28 09:38:44 -07:00
Valentin Shergin ac6b1d1091 Removed unused imports from RCTUIManager
Reviewed By: mmmulani

Differential Revision: D5916606

fbshipit-source-id: f7a301928f68bc2aa15a8e50c4b25f2779d27567
2017-09-27 19:00:29 -07:00
Janic Duplessis 1af645b2fd Validate that JS and Native code versions match for RN releases
Summary:
Basic implementation of the proposal in #15271

Note that this should not affect facebook internally since they are not using OSS releases.

Points to consider:
- How strict should the version match be, right now I just match exact versions.
- Wasn't able to use haste for ReactNativeVersion because I was getting duplicate module provider caused by the template file in scripts/versiontemplates. I tried adding the scripts folder to modulePathIgnorePatterns in package.json but that didn't help.
- Redscreen vs. warning, I think warning is useless because if the app crashes you won't have time to see the warning.
- Should the check and native modules be __DEV__ only?

**Test plan**
Tested that it works when version match and that it redscreens when versions don't before getting other errors on Android and iOS.
Closes https://github.com/facebook/react-native/pull/15518

Differential Revision: D5813551

Pulled By: hramos

fbshipit-source-id: 901757e25724b0f22bf39de172b56309d0dd5a95
2017-09-27 18:31:15 -07:00
Alex Dvornikov 47f6068b16 Log call stack symbols in case of native module method's failure
Differential Revision: D5921069

fbshipit-source-id: c386a836e6f3c314d668e02f3bae243dadcab6e3
2017-09-27 10:00:33 -07:00
Valentin Shergin 6d67e2dbbc Bunch of utility funcs were moved to RCTUIManagerUtils
Summary: Because `RCTUIManager` is already overcomplicated and that stuff deserves separate file and header.

Reviewed By: javache

Differential Revision: D5856653

fbshipit-source-id: 7001bb8ba611976bf3b82d6a25f5619810a35b34
2017-09-26 14:08:28 -07:00
tfallon@mail.depaul.edu 03ae65bc25 Fixes removeClipSubviews check for offscreen rendering of ListViews
Summary:
This issue has been open for a really long time, but I'm pretty sure this is the line that needed to change:
https://github.com/facebook/react-native/issues/1831

What was happening here is that `CGRectIsEmpty` returns true when either height or width is zero. With the current logic, one of those would always be zero when the parent was rendered off screen. This ensures that there the intersection be of CGSizeZero for the view to actually be clipped.

That being said, there seems to be something more complex going on here that I'm not understanding? I would think that you'd simply want to check if the child view's frame is within the bounds of the parent at all. If it was, then don't clip it. If I'm in the wrong, could someone explain this a bit more? If so, I'll fix this issue.

Using this [repository](https://github.com/jcharlet/react_native_listview_bug), this one line change fixes the issue and still clips cells as they are scrolled off screen.
Closes https://github.com/facebook/react-native/pull/15669

Differential Revision: D5815056

Pulled By: shergin

fbshipit-source-id: 32382e4954139e4d5af67d786422fd87173b1a1a
2017-09-26 11:01:39 -07:00
Alex Dvornikov 29e7659111 Use const reference in RCTNativeModule::invokeInner
Reviewed By: mhorowitz

Differential Revision: D5909088

fbshipit-source-id: 3104e3d0a4b29d457c3c7fad2a29e2f0943b478d
2017-09-25 20:39:16 -07:00
Mehdi Mulani e220878b00 Add a hack to fix the Modal component interacting with LayoutAnimation
Summary: As per the comment, <Modal> uses entering/leaving the view hierarchy as a cue to show/hide the modal. By re-adding it, we are causing a bunch of confusion.

Reviewed By: shergin

Differential Revision: D5893607

fbshipit-source-id: ecd05799751a9bba843998ae93f24fe35edca8b4
2017-09-25 11:07:55 -07:00
Jakub Grzmiel d005c8c08a Fix format warnings for clang 5.0
Reviewed By: mzlee

Differential Revision: D5900751

fbshipit-source-id: 4e9aea068aab3d2d882b8fb103a8828e861da97c
2017-09-25 10:30:53 -07:00
Valentin Shergin 983b05441d Introducing <SafeAreaView>
Summary:
<SafeAreaView> renders nested content and automatically applies paddings reflect the portion of the view
that is not covered by navigation bars, tab bars, toolbars, and other ancestor views.
Moreover, and most importantly, Safe Area's paddings feflect physical limitation of the screen,
such as rounded corners or camera notches (aka sensor housing area on iPhone X).

Reviewed By: mmmulani

Differential Revision: D5886411

fbshipit-source-id: 7ecc7aa34de8f5527c4e59b0fb4efba3aaea28c8
2017-09-24 23:01:25 -07:00
Valentin Shergin 8b4ed9490c Introducting `-[UIManager.setLocalData:forView:]`, the way to provide environmental data to ShadowView
Summary:
In some cases we need a way to specify some environmental data to shadow view
to improve layout (or do something similar), so `localData` serves these needs.
For example, any stateful embedded native views may benefit from this.
Have in mind that this data is not supposed to interfere with the state of
the shadow view.

Reviewed By: mmmulani

Differential Revision: D5884711

fbshipit-source-id: f0bf66e4608894ec4479b8aca262afcfba6b9f4b
2017-09-24 23:01:25 -07:00
Mehdi Mulani 9bf936ccba Avoid oversending modalDismissed event
Reviewed By: shergin

Differential Revision: D5895366

fbshipit-source-id: 6d1ca424d2d43fadb48354a1cbad94714448a380
2017-09-23 10:46:17 -07:00
Alex Dvornikov 7d2021ec49 Added iOS support for loading multiple RAM bundles
Differential Revision: D5890466

fbshipit-source-id: e7805f90a7c446f5f75427c3fadcd133a3f7ad18
2017-09-22 09:58:47 -07:00
Alex Dvornikov 7d115730dc Configure JSExector with BundleRegistry instead of JSModulesUnbundle
Differential Revision: D5890458

fbshipit-source-id: 968be95786ffbf53aa98928d4d3e3bd52a84b3dc
2017-09-22 09:58:46 -07:00
Jia Li 0aa12939fd Revert D5850968: Configure JSExector with BundleRegistry instead of JSModulesUnbundle.
Differential Revision: D5850968

fbshipit-source-id: f4c9dc8d5f14cdd32195463e8786242e708770e9
2017-09-21 21:22:39 -07:00
Jia Li 526fd6b931 Revert D5850970: Added iOS support for loading multiple RAM bundles
Differential Revision: D5850970

fbshipit-source-id: 8b0f9bc296ac2944b8b7657a4119b6787d810a2c
2017-09-21 21:22:39 -07:00
Mehdi Mulani a389ffbd84 Add onDismiss to Modal.js
Summary: Adds an onDismiss so that navigation events can be chained to the dismissing of a modal.

Reviewed By: sahrens

Differential Revision: D5852953

fbshipit-source-id: a86e36fdd5b0b206c2dd9fa248e2a88da22efa31
2017-09-21 15:01:52 -07:00
Alex Dvornikov 1aeb767a37 Added iOS support for loading multiple RAM bundles
Differential Revision: D5850970

fbshipit-source-id: 88ab6fe3822f1bc4195007f8ec83177a84c27569
2017-09-21 08:51:00 -07:00
Alex Dvornikov 79821917fa Configure JSExector with BundleRegistry instead of JSModulesUnbundle.
Differential Revision: D5850968

fbshipit-source-id: e5e7ad92c2347c2641551fcf820f061ffde5fed6
2017-09-21 08:51:00 -07:00
Alex Dvornikov 2f952fbaac Initial implementation of multiple RAM bundles registry
Differential Revision: D5850963

fbshipit-source-id: e1bd6d74953872d38e73a20f6d054905a7e4c80c
2017-09-21 08:51:00 -07:00
Justin Reynolds 3ae45d5cb8 Fix Content-Type header checking of React/RCTJavascriptLoader.mm #15791
Summary:
To fix this issue: https://github.com/facebook/react-native/issues/15791
Closes https://github.com/facebook/react-native/pull/15792

Differential Revision: D5813101

Pulled By: shergin

fbshipit-source-id: fd3eb6f1d9ccdeb5373d1ba2b2df173ff7a8e986
2017-09-19 19:50:07 -07:00
Alex Dvornikov 01bcbd44e7 Unbreak ReactLegacy project
Reviewed By: shergin

Differential Revision: D5854859

fbshipit-source-id: 96d4ced9f5481ae1df8741f9d09da4bc939e8ed8
2017-09-19 03:30:05 -07:00
Michał Gregorczyk d6c519bc96 Base class for all object private data passed to JSC
Reviewed By: amnn

Differential Revision: D5761937

fbshipit-source-id: de88cf8b959fc855c3c0786f817bb6032491c819
2017-09-18 18:45:27 -07:00
Valentin Shergin 9d9e250d28 Using `indexOfObjectIdenticalTo` instead of `indexOfObject` in RCTUIManager
Summary:
This should be much more performant (and it better illustrates the intension of the code).
The fix was suggested by Adlai-Holler.

Reviewed By: mmmulani

Differential Revision: D5851595

fbshipit-source-id: 45d172a5fa796549c6dcea8f35c5cbb2a4c2d2e0
2017-09-18 15:46:11 -07:00
Valentin Shergin d7f6208649 Fixing clowntown in RCTUIManager
Reviewed By: mmmulani

Differential Revision: D5851596

fbshipit-source-id: 952dc8af4ee2af4522725873187b6281b62642cc
2017-09-18 15:46:11 -07:00
Valentin Shergin 38c8b6dd42 Using mutex inside RCTUIManagerObserverCoordinator instead of GCD
Reviewed By: javache

Differential Revision: D5843832

fbshipit-source-id: f4051755a5de83431f8bed1b765b5d8118b5ab88
2017-09-18 13:46:10 -07:00
Paco Estevez Garcia 6b733a4fe7 Force local builds to use regular JS bundles
Reviewed By: dcaspi

Differential Revision: D5824552

fbshipit-source-id: a435fc0ad5b43a8bd3c6a873a4147c4d92190f4e
2017-09-18 08:00:33 -07:00
Alex Dvornikov 6e281798e8 Refactored executeApplicationScript in RCTCxxBridge
Reviewed By: dcaspi

Differential Revision: D5850957

fbshipit-source-id: d2cacfd99fd7ffca70b0dcf0bf252ea160268c05
2017-09-18 06:45:38 -07:00
Brian Vaughn 75c94a8907 Native view manager event types exposed to JS via view config
Differential Revision: D5814210

fbshipit-source-id: 41291f0d6b39af77f66173f6a699d88f9f4ccc74
2017-09-14 18:17:17 -07:00
Kellie Medlin e846a9f82f Fix build errors exposed by building against clang 5.0
Reviewed By: rachit-siamwalla

Differential Revision: D5828898

fbshipit-source-id: 23fa587bcd1d1b6c612cc816f1aa7b03da0c187d
2017-09-14 00:35:02 -07:00
Mehdi Mulani e8c83d180f Access AppState constants on main thread
Summary:
iOS 11 now requires this to be accessed on the main thread.
I think this is causing tests to fail, as the Main Thread Checker is turned on there.

Reviewed By: javache

Differential Revision: D5826570

fbshipit-source-id: 6acb7174c756a2ad657602f14c666f71b1ee8fe9
2017-09-13 18:15:39 -07:00
Chris Zheng 17126641b1 Removing fallback source URL from JS bridge
Summary:
Remove fallback logic.
It is hard to test whether a bundle is good or bad on device, since it does the fallback, remove the fallback logic now.

Reviewed By: javache

Differential Revision: D5773542

fbshipit-source-id: 8bb4fdad4c5761ccce915f9f1c2577464e8d37d8
2017-09-12 15:54:59 -07:00
Pieter De Baets 7b770556ac Improve RCTCxxBridge invalidation
Reviewed By: fromcelticpark

Differential Revision: D5536063

fbshipit-source-id: b0f19bebea839c7da84890c338ad4d38293bc99c
2017-09-11 04:30:31 -07:00
Sean Holbert 73c3aa8d32 (iOS) Support for DemiBold alias of SemiBold (font-weight 600)
Summary:
For more information on font weight naming see [this post](https://www.quora.com/What-is-the-difference-between-Medium-Demi-and-Semibold-fonts).

DemiBold is fairly common in font naming. For example, iOS React Native lacks support of "AvNext-DemiBold".

Also removed warning about `NSUInteger` <=> `NSInteger` comparison, by making `i` an `NSUInteger`

Before and after screenshots:

![before-fix](https://user-images.githubusercontent.com/177857/30182567-1dfebcb0-93cc-11e7-9b51-78ef6f41c447.png)

![after-fix](https://user-images.githubusercontent.com/177857/30182570-1f90ea94-93cc-11e7-8f68-008ae648ffbe.png)

Add any DemiBold font to an iOS react native project.  Set fontWeight to `'600'` on a `<Text />` component. The font weight should be applied appropriately.
Closes https://github.com/facebook/react-native/pull/15856

Differential Revision: D5800928

Pulled By: shergin

fbshipit-source-id: 9095e3e150847f9cb828aa5d080567846441e55d
2017-09-08 23:01:41 -07:00
Alex Dvornikov bd723745c1 Allow Cxx references to be used in native module's method signature
Reviewed By: javache

Differential Revision: D5772182

fbshipit-source-id: 21e2f7b8d14ffdcfc0ba969c9a35315863a19b71
2017-09-07 09:17:04 -07:00
Ben Nham 6562324e4c fix RN app not connecting to dev server helper
Reviewed By: Hypuk

Differential Revision: D5784299

fbshipit-source-id: 3758db89283830b4c8fd49aadfbeb5fac90ee806
2017-09-07 04:51:48 -07:00
Neo d3007b0fd2 fix fontWeight regression
Summary:
fix the regression I mentioned in https://github.com/facebook/react-native/pull/15162#issuecomment-319696706

as no one is working on this, I take the step, although I know nothing about Objective C

I find the key point is that the keys in `NSDictionary` are not ordered as presented, it's a hash table, so no grantee on keys order, so I create a new array to do that, then it will check `ultralight` before `light` and `semibold` before `bold`
Closes https://github.com/facebook/react-native/pull/15825

Differential Revision: D5782142

Pulled By: shergin

fbshipit-source-id: 5346b0cb263e535c0b445e7a2912c452573248a5
2017-09-06 23:51:57 -07:00
Valentin Shergin 7b962397b6 Fixed clowntoun related to `-[RCTShadowView canHaveSubviews]`
Summary:
Shame on me.
Naming can be hard. We have to use positive logic to avoid this kind of bugs. :(

In the bright future we also have to rename `isYogaLeafNode` to something with positive logic, like `canHaveYogaChildNodes`.
But before we can do this, we have to have solid plan how to unify it with Android.

Reviewed By: mmmulani

Differential Revision: D5780917

fbshipit-source-id: 1ddaaea06f5618b91528cc87f1433a55b5fae4ac
2017-09-06 23:51:57 -07:00
Valentin Shergin c3038d7210 Warn about slow main thread React methods
Summary:
This is revert of revert of https://github.com/facebook/react-native/pull/15542
WITHOUT default RCT_MAIN_THREAD_WATCH_DOG_THRESHOLD value. So, it makes it completly opt-in feature.

When code blocks the UI thread for too long, it's a bad sign because this can prevent the app from remaining responsive. This change helps detect such responsiveness issues by warning when a React method executes on the UI thread longer than some threshold.

Reviewed By: mmmulani

Differential Revision: D5772433

fbshipit-source-id: 24fe4fc0deffe9c091a4bfc4cbd76cb4f34c4091
2017-09-06 16:38:37 -07:00
Janic Duplessis 64be88398d Fix content offset validation
Summary:
Content offset was broken because on initial render contentSize is {0,0} so any positive offset is lost. Also inset top/bottom and left/right were inversed �, this led to bad initial scrolling offset when using contentInset. This fixes it by making sure contentSize is actually measured (not {0,0}. I guess it's possible that the content is ACTUALLY {0,0} but in that case I don't think it really matters).

**Test plan**
Tested that a scrollview has proper scroll position when specifying contentOffset. Also tested that it works well with contentInset.
```js
<ScrollView contentOffset={{y: 100}}>
  <View style={{height: 1000}} />
</ScrollView>
```
Closes https://github.com/facebook/react-native/pull/15670

Differential Revision: D5771221

Pulled By: shergin

fbshipit-source-id: 455ed8fd5a4ad1ec61780b573d1a8ef1d77dd124
2017-09-05 16:35:03 -07:00
Marc Horowitz d48f08cad6 Thread the JSI runtime descriptor up into the RCTDevMenu title
Reviewed By: javache

Differential Revision: D5643014

fbshipit-source-id: 977be5729c57c0d01ff67b268031ad6fdbf88a07
2017-09-05 15:02:19 -07:00
James Ide 7d04fbaba2 Change intValue -> integerValue in RCTMultipartStreamReader
Summary:
We assign the value to an NSInteger so we should convert the NSString to an NSInteger instead of an int.

Build the app in Xcode and run it.
Closes https://github.com/facebook/react-native/pull/15806

Differential Revision: D5767118

Pulled By: shergin

fbshipit-source-id: b310511f13f5f4026d595a219d69811801d313c2
2017-09-05 10:02:44 -07:00
Gabriel Bull 432fc2ab5b Fixed issue with path with spaces
Summary:
shergin This is a fix I [previously submitted](95d5d112ac (diff-883359f85083d00b7266ec2acebcca9fL3494)) but was somehow overwritten?
Closes https://github.com/facebook/react-native/pull/15760

Differential Revision: D5763636

Pulled By: shergin

fbshipit-source-id: 6b06fa7cddf068d376cb925bf7c8650a8a9700fb
2017-09-03 23:30:22 -07:00
Gilad Novik 8a85546ef9 Fix unrecognized selector error
Summary:
Fixes "[NSTaggedPointerString unsignedIntValue]: unrecognized selector" error
Closes https://github.com/facebook/react-native/pull/15755

Differential Revision: D5763628

Pulled By: shergin

fbshipit-source-id: 6e1d1b1ae6bc63e07112b9dddcdf8e6f812a7f51
2017-09-03 23:30:22 -07:00
Mark Smith 998197f444 Clean up some URL path handling
Reviewed By: sahrens

Differential Revision: D5753338

fbshipit-source-id: 0eb1b4ae64ad7170f1b97f398ff11b713c695b12
2017-09-01 13:45:03 -07:00
Alex Dvornikov 77c11e831b RCTManagedPointer fix ups
Reviewed By: javache

Differential Revision: D5727367

fbshipit-source-id: ef6c03e57ee0c40da9411c77f0e8a733945afa07
2017-09-01 08:08:06 -07:00