From 8a32d0af4d99ce47f7fa3667b4fa9e125dba956f Mon Sep 17 00:00:00 2001 From: Eric Rozell Date: Wed, 21 Feb 2018 08:57:30 -0500 Subject: [PATCH 1/3] fix(LICENSE): derive Libraries folder from MIT-licensed code react-native recently moved to the MIT license. In order to remove the BSD+Patents licensing from react-native-windows, we have to re-derive the source code we copied from react-native from the latest source code. This change re-derives the source code in the Libraries folder. --- Libraries/Alert/Alert.windows.js | 81 +-- .../AccessibilityInfo.windows.js | 11 +- .../ActivityIndicator.windows.js | 61 +- .../AppleTV/TVEventHandler.windows.js | 29 +- Libraries/Components/Button.windows.js | 47 +- .../Components/CheckBox/CheckBox.windows.js | 6 +- .../DatePicker/DatePickerIOS.windows.js | 6 +- .../DatePickerAndroid.windows.js | 8 +- .../DrawerLayoutAndroid.windows.js | 6 +- .../FlipViewWindows.android.js | 8 +- .../FlipViewWindows/FlipViewWindows.ios.js | 8 +- .../FlipViewWindows.windows.js | 5 +- .../FocusableWindows.android.js | 7 +- .../FocusableWindows/FocusableWindows.ios.js | 7 +- .../FocusableWindows.windows.js | 9 +- .../MaskedViewIOS/MaskedViewIOS.windows.js | 6 +- .../Navigation/NavigatorIOS.windows.js | 6 +- .../PasswordBoxWindows.windows.js | 270 ++++---- Libraries/Components/Picker/Picker.windows.js | 53 +- .../Picker/PickerAndroid.windows.js | 6 +- .../Components/Picker/PickerIOS.windows.js | 8 +- Libraries/Components/Picker/PickerWindows.js | 97 +-- .../ProgressBarAndroid.windows.js | 6 +- .../ProgressBarWindows.android.js | 8 +- .../ProgressBarWindows.ios.js | 8 +- .../ProgressBarWindows.windows.js | 4 +- .../ProgressRingWindows.android.js | 8 +- .../ProgressRingWindows.ios.js | 8 +- .../ProgressRingWindows.windows.js | 4 +- .../ProgressViewIOS.windows.js | 6 +- .../SafeAreaView/SafeAreaView.windows.js | 6 +- .../ScrollView/ScrollView.windows.js | 202 ++++-- .../SegmentedControlIOS.windows.js | 6 +- .../SplitViewWindows.android.js | 10 +- .../SplitViewWindows/SplitViewWindows.ios.js | 10 +- .../SplitViewWindows.windows.js | 74 ++- .../Components/StatusBar/StatusBar.windows.js | 213 +++++-- .../StatusBar/StatusBarIOS.windows.js | 10 +- .../Components/TabBarIOS/TabBarIOS.windows.js | 20 +- .../TabBarIOS/TabBarItemIOS.windows.js | 6 +- .../Components/TextInput/TextInput.windows.js | 219 ++++--- .../TextInput/TextInputState.windows.js | 13 +- .../TimePickerAndroid.windows.js | 8 +- .../ToastAndroid/ToastAndroid.windows.js | 6 +- .../ToolbarAndroid/ToolbarAndroid.windows.js | 6 +- .../TouchableNativeFeedback.windows.js | 6 +- .../View/PlatformViewPropTypes.windows.js | 47 ++ .../Components/View/ViewPropTypes.windows.js | 509 ---------------- .../ViewPager/ViewPagerAndroid.windows.js | 6 +- .../Components/WebView/WebView.windows.js | 139 ++++- Libraries/Core/ReactNativeVersion.windows.js | 6 +- .../NavigationHeaderBackButton.windows.js | 69 --- .../assets/back-icon@1.5x.windows.png | Bin 134 -> 0 bytes .../assets/back-icon@1x.windows.png | Bin 100 -> 0 bytes .../assets/back-icon@2x.windows.png | Bin 134 -> 0 bytes .../assets/back-icon@3x.windows.png | Bin 167 -> 0 bytes .../assets/back-icon@4x.windows.png | Bin 207 -> 0 bytes ...orBreadcrumbNavigationBarStyles.windows.js | 227 ------- .../NavigatorNavigationBarStylesWindows.js | 173 ------ .../SwipeableRow/SwipeableRow.windows.js | 37 +- Libraries/Image/Image.windows.js | 228 +++---- Libraries/Network/NetInfo.windows.js | 237 ++++--- Libraries/Network/RCTNetworking.windows.js | 8 +- Libraries/RCTTest/SnapshotViewIOS.windows.js | 6 +- Libraries/Settings/Settings.windows.js | 13 +- Libraries/Text/Text.windows.js | 576 ------------------ Libraries/Utilities/BackHandler.windows.js | 66 +- Libraries/Utilities/HMRLoadingView.windows.js | 13 +- Libraries/Utilities/Platform.windows.js | 13 +- Libraries/Vibration/Vibration.windows.js | 43 +- Libraries/Vibration/VibrationIOS.windows.js | 40 +- Libraries/WebSocket/WebSocket.windows.js | 132 +++- .../react-native-windows-implementation.js | 21 + .../react-native-windows.js | 24 - package.json | 2 +- 75 files changed, 1573 insertions(+), 2674 deletions(-) create mode 100644 Libraries/Components/View/PlatformViewPropTypes.windows.js delete mode 100644 Libraries/Components/View/ViewPropTypes.windows.js delete mode 100644 Libraries/CustomComponents/NavigationExperimental/NavigationHeaderBackButton.windows.js delete mode 100644 Libraries/CustomComponents/NavigationExperimental/assets/back-icon@1.5x.windows.png delete mode 100644 Libraries/CustomComponents/NavigationExperimental/assets/back-icon@1x.windows.png delete mode 100644 Libraries/CustomComponents/NavigationExperimental/assets/back-icon@2x.windows.png delete mode 100644 Libraries/CustomComponents/NavigationExperimental/assets/back-icon@3x.windows.png delete mode 100644 Libraries/CustomComponents/NavigationExperimental/assets/back-icon@4x.windows.png delete mode 100644 Libraries/CustomComponents/Navigator/NavigatorBreadcrumbNavigationBarStyles.windows.js delete mode 100644 Libraries/CustomComponents/Navigator/NavigatorNavigationBarStylesWindows.js delete mode 100644 Libraries/Text/Text.windows.js create mode 100644 Libraries/react-native-windows/react-native-windows-implementation.js delete mode 100644 Libraries/react-native-windows/react-native-windows.js diff --git a/Libraries/Alert/Alert.windows.js b/Libraries/Alert/Alert.windows.js index 3b0e59accc2..d7faddb60cb 100644 --- a/Libraries/Alert/Alert.windows.js +++ b/Libraries/Alert/Alert.windows.js @@ -1,11 +1,14 @@ /** * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * + * Portions copyright for react-native-windows: + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + * * @providesModule Alert * @flow */ @@ -17,7 +20,7 @@ const Platform = require('Platform'); import type { AlertType, AlertButtonStyle } from 'AlertIOS'; -type Buttons = Array<{ +export type Buttons = Array<{ text?: string, onPress?: ?Function, style?: AlertButtonStyle, @@ -31,71 +34,15 @@ type Options = { /** * Launches an alert dialog with the specified title and message. * - * Optionally provide a list of buttons. Tapping any button will fire the - * respective onPress callback and dismiss the alert. By default, the only - * button will be an 'OK' button. - * - * This is an API that works both on iOS and Android and can show static - * alerts. To show an alert that prompts the user to enter some information, - * see `AlertIOS`; entering text in an alert is common on iOS only. - * - * ## iOS - * - * On iOS you can specify any number of buttons. Each button can optionally - * specify a style, which is one of 'default', 'cancel' or 'destructive'. - * - * ## Android - * - * On Android at most three buttons can be specified. Android has a concept - * of a neutral, negative and a positive button: - * - * - If you specify one button, it will be the 'positive' one (such as 'OK') - * - Two buttons mean 'negative', 'positive' (such as 'Cancel', 'OK') - * - Three buttons mean 'neutral', 'negative', 'positive' (such as 'Later', 'Cancel', 'OK') - * - * By default alerts on Android can be dismissed by tapping outside of the alert - * box. This event can be handled by providing an optional `options` parameter, - * with an `onDismiss` callback property `{ onDismiss: () => {} }`. - * - * Alternatively, the dismissing behavior can be disabled altogether by providing - * an optional `options` parameter with the `cancelable` property set to `false` - * i.e. `{ cancelable: false }` - * - * Example usage: - * ``` - * // Works on both iOS and Android - * Alert.alert( - * 'Alert Title', - * 'My Alert Msg', - * [ - * {text: 'Ask me later', onPress: () => console.log('Ask me later pressed')}, - * {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'}, - * {text: 'OK', onPress: () => console.log('OK Pressed')}, - * ], - * { cancelable: false } - * ) - * ``` - * ## Windows - * - * On Windows at most two buttons can be specified. - * - * - If you specify one button, it will be the 'positive' one (such as 'OK') - * - Two buttons mean 'negative', 'positive' (such as 'Cancel', 'OK') - * - * ``` - * // Works on iOS, Android, and Windows - * Alert.alert( - * 'Alert Title', - * 'My Alert Msg', - * [ - * {text: 'Cancel', onPress: () => console.log('Cancel Pressed'), style: 'cancel'}, - * {text: 'OK', onPress: () => console.log('OK Pressed')}, - * ] - * ) - * ``` + * See http://facebook.github.io/react-native/docs/alert.html */ class Alert { + /** + * Launches an alert dialog with the specified title and message. + * + * See http://facebook.github.io/react-native/docs/alert.html#alert + */ static alert( title: ?string, message?: ?string, diff --git a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js index ee75022c979..3e845a76373 100644 --- a/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js +++ b/Libraries/Components/AccessibilityInfo/AccessibilityInfo.windows.js @@ -1,11 +1,14 @@ /** * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * + * Portions copyright for react-native-windows: + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + * * @providesModule AccessibilityInfo * @flow */ diff --git a/Libraries/Components/ActivityIndicator/ActivityIndicator.windows.js b/Libraries/Components/ActivityIndicator/ActivityIndicator.windows.js index 1746155494a..5998172f1a9 100644 --- a/Libraries/Components/ActivityIndicator/ActivityIndicator.windows.js +++ b/Libraries/Components/ActivityIndicator/ActivityIndicator.windows.js @@ -1,10 +1,13 @@ /** * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. + * + * Portions copyright for react-native-windows: + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. * * @providesModule ActivityIndicator * @flow @@ -14,13 +17,14 @@ const ColorPropType = require('ColorPropType'); const NativeMethodsMixin = require('NativeMethodsMixin'); const Platform = require('Platform'); -const React = require('React'); -const createReactClass = require('create-react-class'); +const ProgressBarAndroid = require('ProgressBarAndroid'); const PropTypes = require('prop-types'); +const React = require('React'); const StyleSheet = require('StyleSheet'); const View = require('View'); const ViewPropTypes = require('ViewPropTypes'); +const createReactClass = require('create-react-class'); const requireNativeComponent = require('requireNativeComponent'); const GRAY = '#999999'; @@ -36,6 +40,8 @@ type DefaultProps = { /** * Displays a circular loading indicator. + * + * See http://facebook.github.io/react-native/docs/activityindicator.html */ const ActivityIndicator = createReactClass({ displayName: 'ActivityIndicator', @@ -45,15 +51,21 @@ const ActivityIndicator = createReactClass({ ...ViewPropTypes, /** * Whether to show the indicator (true, the default) or hide it (false). + * + * See http://facebook.github.io/react-native/docs/activityindicator.html#animating */ animating: PropTypes.bool, /** * The foreground color of the spinner (default is gray). + * + * See http://facebook.github.io/react-native/docs/activityindicator.html#color */ color: ColorPropType, /** * Size of the indicator (default is 'small'). * Passing a number to the size prop is only supported on Android. + * + * See http://facebook.github.io/react-native/docs/activityindicator.html#size */ size: PropTypes.oneOfType([ PropTypes.oneOf([ 'small', 'large' ]), @@ -63,6 +75,8 @@ const ActivityIndicator = createReactClass({ * Whether the indicator should hide when not animating (true by default). * * @platform ios + * + * See http://facebook.github.io/react-native/docs/activityindicator.html#hideswhenstopped */ hidesWhenStopped: PropTypes.bool, }, @@ -92,19 +106,23 @@ const ActivityIndicator = createReactClass({ break; } + const nativeProps = { + ...props, + style: sizeStyle, + styleAttr: 'Normal', + indeterminate: true, + }; + return ( - - + + {Platform.OS !== 'android' ? ( + + ) : ( + + )} ); - }, + } }); const styles = StyleSheet.create({ @@ -128,17 +146,6 @@ if (Platform.OS === 'ios') { ActivityIndicator, {nativeOnly: {activityIndicatorViewStyle: true}}, ); -} else if (Platform.OS === 'android') { - var RCTActivityIndicator = requireNativeComponent( - 'AndroidProgressBar', - ActivityIndicator, - // Ignore props that are specific to non inderterminate ProgressBar. - {nativeOnly: { - indeterminate: true, - progress: true, - styleAttr: true, - }}, - ); } else if (Platform.OS === 'windows') { var RCTActivityIndicator = requireNativeComponent( 'WindowsProgressRing', diff --git a/Libraries/Components/AppleTV/TVEventHandler.windows.js b/Libraries/Components/AppleTV/TVEventHandler.windows.js index 6d52d0d5eff..718fa84a8de 100644 --- a/Libraries/Components/AppleTV/TVEventHandler.windows.js +++ b/Libraries/Components/AppleTV/TVEventHandler.windows.js @@ -1,31 +1,8 @@ /** - * Copyright (c) 2016-present, Facebook, Inc. - * All rights reserved. + * Copyright (c) 2015-present, Facebook, Inc. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. - * - * Facebook, Inc. ("Facebook") owns all right, title and interest, including - * all intellectual property and other proprietary rights, in and to the React - * Native CustomComponents software (the "Software"). Subject to your - * compliance with these terms, you are hereby granted a non-exclusive, - * worldwide, royalty-free copyright license to (1) use and copy the Software; - * and (2) reproduce and distribute the Software as part of your own software - * ("Your Software"). Facebook reserves all rights not expressly granted to - * you in this license agreement. - * - * THE SOFTWARE AND DOCUMENTATION, IF ANY, ARE PROVIDED "AS IS" AND ANY EXPRESS - * OR IMPLIED WARRANTIES (INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES - * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE) ARE DISCLAIMED. - * IN NO EVENT SHALL FACEBOOK OR ITS AFFILIATES, OFFICERS, DIRECTORS OR - * EMPLOYEES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; - * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, - * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR - * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THE SOFTWARE, EVEN IF - * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * * @providesModule TVEventHandler * @flow diff --git a/Libraries/Components/Button.windows.js b/Libraries/Components/Button.windows.js index b2c50b0270b..18bed8c4138 100644 --- a/Libraries/Components/Button.windows.js +++ b/Libraries/Components/Button.windows.js @@ -1,11 +1,14 @@ /** * Copyright (c) 2015-present, Facebook, Inc. - * All rights reserved. * - * This source code is licensed under the BSD-style license found in the - * LICENSE file in the root directory of this source tree. An additional grant - * of patent rights can be found in the PATENTS file in the same directory. + * This source code is licensed under the MIT license found in the + * LICENSE file in the root directory of this source tree. * + * Portions copyright for react-native-windows: + * + * Copyright (c) Microsoft Corporation. All rights reserved. + * Licensed under the MIT License. + * * @providesModule Button * @flow */ @@ -32,7 +35,6 @@ const KEY_CODE_SPACE = FocusableView.keys.Space; const DOWN_KEYCODES = [KEY_CODE_SPACE, KEY_CODE_ENTER]; const UP_KEYCODES = [KEY_CODE_SPACE]; - /** * A basic button component that should render nicely on any platform. Supports * a minimal level of customization. @@ -48,6 +50,9 @@ const UP_KEYCODES = [KEY_CODE_SPACE]; * Example usage: * * ``` + * import { Button } from 'react-native'; + * ... + * *