From 685f10363a53b6858f0841b20b75baad5e6f7b07 Mon Sep 17 00:00:00 2001 From: Tom Underhill Date: Fri, 3 Apr 2020 20:53:43 -0700 Subject: [PATCH 01/11] Update scripts to publish react-native-macos-init --- .ado/publish.yml | 33 ++++++++ .ado/versionUtils.js | 20 +++++ packages/react-native-macos-init/package.json | 82 +++++++++---------- 3 files changed, 94 insertions(+), 41 deletions(-) diff --git a/.ado/publish.yml b/.ado/publish.yml index eccfa3821fc5fd..4a7c05c54376ea 100644 --- a/.ado/publish.yml +++ b/.ado/publish.yml @@ -49,6 +49,39 @@ jobs: command: 'publish' publishEndpoint: 'npmjs' + - job: RNMacOSInitNpmJSPublish + displayName: react-native-macos-init Publish to npmjs.org + pool: + vmImage: vs2017-win2016 + timeoutInMinutes: 90 # how long to run the job before automatically cancelling + cancelTimeoutInMinutes: 5 # how much time to give 'run always even if cancelled tasks' before killing them + steps: + - checkout: self # self represents the repo where the initial Pipelines YAML file was found + clean: true # whether to fetch clean each time + # fetchDepth: 2 # the depth of commits to ask Git to fetch + lfs: false # whether to download Git-LFS files + submodules: recursive # set to 'true' for a single level of submodules or 'recursive' to get submodules of submodules + persistCredentials: true # set to 'true' to leave the OAuth token in the Git config after the initial fetch + + - task: CmdLine@2 + displayName: npm install + inputs: + script: | + cd packages/react-native-macos-init + npm install + + - task: CmdLine@2 + displayName: Bump package version + inputs: + script: node .ado/bumpFileVersions.js + + - task: Npm@1 + displayName: "Publish react-native-macos-init to npmjs.org" + inputs: + command: 'publish' + workingDir: 'packages/react-native-macos-init' + publishEndpoint: 'npmjs' + - job: RNGithubOfficePublish displayName: React-Native GitHub Publish to Office pool: diff --git a/.ado/versionUtils.js b/.ado/versionUtils.js index cda5beaa13023a..bdfa0f0f4b2a63 100644 --- a/.ado/versionUtils.js +++ b/.ado/versionUtils.js @@ -14,6 +14,23 @@ function gatherVersionInfo() { return {pkgJson, releaseVersion, branchVersionSuffix}; } +function updateReactNativeMacOSInitVersionInFile() { + const rnMacOSInitPkgJsonPath = path.resolve(__dirname, "../packages/react-native-macos-init/package.json"); + const rnMacOSInitPkgJson = JSON.parse(fs.readFileSync(rnMacOSInitPkgJsonPath, "utf8")); + let rnMacOSInitReleaseVersion = rnMacOSInitPkgJson.version; + const rnMacOSInitVersionStringRegEx = new RegExp(`([0-9]*)\\.([0-9]*)\\.([0-9]*)`); + const rnMacOSInitVersionGroups = rnMacOSInitVersionStringRegEx.exec(rnMacOSInitReleaseVersion); + if (rnMacOSInitVersionGroups) { + rnMacOSInitReleaseVersion = rnMacOSInitVersionGroups[1] + '.' + rnMacOSInitVersionGroups[2] + '.' + (parseInt(rnMacOSInitVersionGroups[3]) + 1); + } else { + console.log("Invalid react-native-macos-init version to publish"); + process.exit(1); + } + rnMacOSInitPkgJson.version = rnMacOSInitReleaseVersion; + fs.writeFileSync(rnMacOSInitPkgJsonPath, JSON.stringify(rnMacOSInitPkgJson, null, 2)); + console.log(`Updating ${rnMacOSInitPkgJsonPath} to version ${rnMacOSInitReleaseVersion}`); +} + function updateVersionsInFiles() { let {pkgJson, releaseVersion, branchVersionSuffix} = gatherVersionInfo(); @@ -34,6 +51,9 @@ function updateVersionsInFiles() { pkgJson.version = releaseVersion; fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2)); console.log(`Updating package.json to version ${releaseVersion}`); + + updateReactNativeMacOSInitVersionInFile(); + return {releaseVersion, branchVersionSuffix}; } diff --git a/packages/react-native-macos-init/package.json b/packages/react-native-macos-init/package.json index 6ea151ab56411f..3efc8802671405 100644 --- a/packages/react-native-macos-init/package.json +++ b/packages/react-native-macos-init/package.json @@ -1,42 +1,42 @@ { - "name": "react-native-macos-init", - "version": "0.0.9", - "description": "CLI to add react-native-macos to an existing react-native project", - "main": "index.js", - "repository": "https://github.com/microsoft/react-native-macos", - "license": "MIT", - "private": false, - "scripts": { - "build": "just-scripts build", - "clean": "just-scripts clean", - "lint": "just-scripts lint", - "lint:fix": "just-scripts lint:fix", - "prepublishOnly": "npm run build" - }, - "bin": { - "react-native-macos-init": "./bin.js" - }, - "dependencies": { - "chalk": "^3", - "npm-registry": "^0.1.13", - "prompts": "^2.3.0", - "find-up": "^4.1.0", - "semver": "^7.1.3", - "valid-url": "^1.0.9", - "yargs": "^15.1.0" - }, - "devDependencies": { - "@types/chalk": "^2.2.0", - "@types/prompts": "^2.0.3", - "@types/semver": "^7.1.0", - "@types/valid-url": "^1.0.2", - "@types/yargs": "^15.0.3", - "just-scripts": "^0.36.1", - "typescript": "3.5.3" - }, - "files": [ - "bin.js", - "lib-commonjs", - "README.md" - ] - } \ No newline at end of file + "name": "react-native-macos-init", + "version": "0.0.0", + "description": "CLI to add react-native-macos to an existing react-native project", + "main": "index.js", + "repository": "https://github.com/microsoft/react-native-macos", + "license": "MIT", + "private": false, + "scripts": { + "build": "just-scripts build", + "clean": "just-scripts clean", + "lint": "just-scripts lint", + "lint:fix": "just-scripts lint:fix", + "prepublishOnly": "npm run build" + }, + "bin": { + "react-native-macos-init": "./bin.js" + }, + "dependencies": { + "chalk": "^3", + "npm-registry": "^0.1.13", + "prompts": "^2.3.0", + "find-up": "^4.1.0", + "semver": "^7.1.3", + "valid-url": "^1.0.9", + "yargs": "^15.1.0" + }, + "devDependencies": { + "@types/chalk": "^2.2.0", + "@types/prompts": "^2.0.3", + "@types/semver": "^7.1.0", + "@types/valid-url": "^1.0.2", + "@types/yargs": "^15.0.3", + "just-scripts": "^0.36.1", + "typescript": "3.5.3" + }, + "files": [ + "bin.js", + "lib-commonjs", + "README.md" + ] +} \ No newline at end of file From 1e2c329a34a980d10c4124c4027713a41d51563a Mon Sep 17 00:00:00 2001 From: Tom Underhill Date: Sat, 4 Apr 2020 15:51:32 -0700 Subject: [PATCH 02/11] Clean up merge markers --- .ado/versionUtils.js | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/.ado/versionUtils.js b/.ado/versionUtils.js index bd2441fdbf7113..8abed9b6c41882 100644 --- a/.ado/versionUtils.js +++ b/.ado/versionUtils.js @@ -14,23 +14,6 @@ function gatherVersionInfo() { return {pkgJson, releaseVersion, branchVersionSuffix}; } -function updateReactNativeMacOSInitVersionInFile() { - const rnMacOSInitPkgJsonPath = path.resolve(__dirname, "../packages/react-native-macos-init/package.json"); - const rnMacOSInitPkgJson = JSON.parse(fs.readFileSync(rnMacOSInitPkgJsonPath, "utf8")); - let rnMacOSInitReleaseVersion = rnMacOSInitPkgJson.version; - const rnMacOSInitVersionStringRegEx = new RegExp(`([0-9]*)\\.([0-9]*)\\.([0-9]*)`); - const rnMacOSInitVersionGroups = rnMacOSInitVersionStringRegEx.exec(rnMacOSInitReleaseVersion); - if (rnMacOSInitVersionGroups) { - rnMacOSInitReleaseVersion = rnMacOSInitVersionGroups[1] + '.' + rnMacOSInitVersionGroups[2] + '.' + (parseInt(rnMacOSInitVersionGroups[3]) + 1); - } else { - console.log("Invalid react-native-macos-init version to publish"); - process.exit(1); - } - rnMacOSInitPkgJson.version = rnMacOSInitReleaseVersion; - fs.writeFileSync(rnMacOSInitPkgJsonPath, JSON.stringify(rnMacOSInitPkgJson, null, 2)); - console.log(`Updating ${rnMacOSInitPkgJsonPath} to version ${rnMacOSInitReleaseVersion}`); -} - function updateVersionsInFiles() { let {pkgJson, releaseVersion, branchVersionSuffix} = gatherVersionInfo(); @@ -51,11 +34,6 @@ function updateVersionsInFiles() { pkgJson.version = releaseVersion; fs.writeFileSync(pkgJsonPath, JSON.stringify(pkgJson, null, 2)); console.log(`Updating package.json to version ${releaseVersion}`); -<<<<<<< HEAD - - updateReactNativeMacOSInitVersionInFile(); -======= ->>>>>>> ms/master return {releaseVersion, branchVersionSuffix}; } From 5a67ae06b01301ac43533e7e20dd7fed24a0937f Mon Sep 17 00:00:00 2001 From: Tom Underhill Date: Mon, 13 Apr 2020 14:15:49 -0700 Subject: [PATCH 03/11] Restored ios:macos RNTester parity except for InputAccessoryView. --- .gitignore | 1 + Libraries/CameraRoll/RCTCameraRollManager.m | 9 +- .../CameraRoll/RCTPhotoLibraryImageLoader.m | 2 + .../CameraRoll/React-RCTCameraRoll.podspec | 5 +- Libraries/Image/RCTImageView.h | 12 + .../react-native-implementation.macos.js | 400 -------- RNTester/Podfile | 3 +- RNTester/Podfile.lock | 6 +- RNTester/RNTester-macOS/Info.plist | 32 +- .../RNTester_macOS.entitlements | 8 + .../RNTesterPods.xcodeproj/project.pbxproj | 6 + RNTester/js/ActionSheetMacOSExample.js | 132 --- RNTester/js/AlertMacOSExample.js | 294 ------ RNTester/js/AnimatedExampleMacOS.js | 186 ---- RNTester/js/RNTesterList.macos.js | 48 +- RNTester/js/TextExample.macos.js | 865 ------------------ RNTester/js/TextInputExample.macos.js | 254 +++-- React/React-Core.podspec | 1 - React/Views/RCTSliderManager.m | 2 +- .../platform/ios/RCTSampleTurboModule.mm | 7 +- 20 files changed, 259 insertions(+), 2014 deletions(-) delete mode 100644 Libraries/react-native/react-native-implementation.macos.js delete mode 100644 RNTester/js/ActionSheetMacOSExample.js delete mode 100644 RNTester/js/AlertMacOSExample.js delete mode 100644 RNTester/js/AnimatedExampleMacOS.js delete mode 100644 RNTester/js/TextExample.macos.js diff --git a/.gitignore b/.gitignore index 8a878c75d23397..49c9952ae3d095 100644 --- a/.gitignore +++ b/.gitignore @@ -51,6 +51,7 @@ local.properties *.iml /android/ /ReactAndroid/packages/ +.settings/ # Node node_modules diff --git a/Libraries/CameraRoll/RCTCameraRollManager.m b/Libraries/CameraRoll/RCTCameraRollManager.m index ad84741253e38d..b6eb668b328c19 100644 --- a/Libraries/CameraRoll/RCTCameraRollManager.m +++ b/Libraries/CameraRoll/RCTCameraRollManager.m @@ -9,11 +9,13 @@ #import #import -#import +#import // TODO(macOS ISS#2323203) #import #import #import +#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) #import +#endif // TODO(macOS ISS#2323203) #import #import @@ -318,6 +320,7 @@ static void RCTResolvePromise(RCTPromiseResolveBlock resolve, resolve:(RCTPromiseResolveBlock)resolve reject:(RCTPromiseRejectBlock)reject) { +#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) NSArray *assets_ = [RCTConvert NSURLArray:assets]; [[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{ PHFetchResult *fetched = @@ -333,6 +336,10 @@ static void RCTResolvePromise(RCTPromiseResolveBlock resolve, } } ]; +#else // [TODO(macOS ISS#2323203) + NSError *error = RCTErrorWithMessage(@"Delete image not available on macOS"); + reject(@"Couldn't delete", @"Couldn't delete assets", error); +#endif // ]TODO(macOS ISS#2323203) } static void checkPhotoLibraryConfig() diff --git a/Libraries/CameraRoll/RCTPhotoLibraryImageLoader.m b/Libraries/CameraRoll/RCTPhotoLibraryImageLoader.m index ccdf3c27f73087..20790361bc4621 100644 --- a/Libraries/CameraRoll/RCTPhotoLibraryImageLoader.m +++ b/Libraries/CameraRoll/RCTPhotoLibraryImageLoader.m @@ -45,9 +45,11 @@ - (RCTImageLoaderCancellationBlock)loadImageForURL:(NSURL *)imageURL if (!imageURL) { completionHandler(RCTErrorWithMessage(@"Cannot load a photo library asset with no URL"), nil); return ^{}; +#if !TARGET_OS_OSX // TODO(macOS ISS#2323203) } else if ([imageURL.scheme caseInsensitiveCompare:@"assets-library"] == NSOrderedSame) { assetID = [imageURL absoluteString]; results = [PHAsset fetchAssetsWithALAssetURLs:@[imageURL] options:nil]; +#endif // TODO(macOS ISS#2323203) } else { assetID = [imageURL.absoluteString substringFromIndex:@"ph://".length]; results = [PHAsset fetchAssetsWithLocalIdentifiers:@[assetID] options:nil]; diff --git a/Libraries/CameraRoll/React-RCTCameraRoll.podspec b/Libraries/CameraRoll/React-RCTCameraRoll.podspec index 2e283cf6865915..d0d83cc881e4ff 100644 --- a/Libraries/CameraRoll/React-RCTCameraRoll.podspec +++ b/Libraries/CameraRoll/React-RCTCameraRoll.podspec @@ -25,7 +25,7 @@ Pod::Spec.new do |s| s.documentation_url = "https://facebook.github.io/react-native/docs/cameraroll" s.license = package["license"] s.author = "Facebook, Inc. and its affiliates" - s.platforms = { :ios => "9.0", :tvos => "9.2" } + s.platforms = { :ios => "9.0", :tvos => "9.2", :osx => "10.14" } # TODO(macOS GH#214) s.source = source s.source_files = "*.{h,m}" s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs" @@ -33,4 +33,7 @@ Pod::Spec.new do |s| s.dependency "React-Core", version s.dependency "React-RCTImage", version + + s.osx.exclude_files = "RCTImagePickerManager.*", "RCTAssetsLibraryRequestHandler.*" # TODO(macOS GH#214) + end diff --git a/Libraries/Image/RCTImageView.h b/Libraries/Image/RCTImageView.h index 5d78e2dd2f8ec4..95a70e908168ef 100644 --- a/Libraries/Image/RCTImageView.h +++ b/Libraries/Image/RCTImageView.h @@ -37,4 +37,16 @@ typedef NS_ENUM(NSInteger, UIImageRenderingMode) { @property (nonatomic, assign) CGFloat blurRadius; @property (nonatomic, assign) RCTResizeMode resizeMode; +#if TARGET_OS_OSX // [TODO(macOS ISS#2323203) +/** + * macOS Properties + */ +@property (nonatomic, copy) RCTDirectEventBlock onDoubleClick; +@property (nonatomic, copy) RCTDirectEventBlock onClick; +@property (nonatomic, copy) RCTDirectEventBlock onMouseEnter; +@property (nonatomic, copy) RCTDirectEventBlock onMouseLeave; +@property (nonatomic, copy) RCTDirectEventBlock onDragEnter; +@property (nonatomic, copy) RCTDirectEventBlock onDragLeave; +@property (nonatomic, copy) RCTDirectEventBlock onDrop; +#endif // ]TODO(macOS ISS#2323203) @end diff --git a/Libraries/react-native/react-native-implementation.macos.js b/Libraries/react-native/react-native-implementation.macos.js deleted file mode 100644 index 8b58b16d12b413..00000000000000 --- a/Libraries/react-native/react-native-implementation.macos.js +++ /dev/null @@ -1,400 +0,0 @@ -/** - * Copyright (c) Facebook, Inc. and its affiliates. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -'use strict'; - -const invariant = require('invariant'); -const warnOnce = require('warnOnce'); - -// Export React, plus some native additions. -module.exports = { - // Components - get AccessibilityInfo() { - return require('AccessibilityInfo'); - }, - get ActivityIndicator() { - return require('ActivityIndicator'); - }, - get ART() { - return require('ReactNativeART'); - }, - get Button() { - return require('Button'); - }, - get CheckBox() { - warnOnce( - 'checkBox-moved', - 'CheckBox has been extracted from react-native core and will be removed in a future release. ' + - "It can now be installed and imported from '@react-native-community/checkbox' instead of 'react-native'. " + - 'See https://github.com/react-native-community/react-native-checkbox', - ); - return require('../Components/CheckBox/CheckBox'); - }, - /* - get DatePickerIOS() { - return require('../Components/DatePicker'); - }, - get DrawerLayoutAndroid() { - return require('DrawerLayoutAndroid'); - },*/ - get FlatList() { - return require('FlatList'); - }, - get Image() { - return require('Image'); - }, - get ImageBackground() { - return require('ImageBackground'); - }, - /* - get ImageEditor() { - return require('ImageEditor'); - },*/ - get ImageStore() { - warnOnce( - 'imagestore-deprecation', - 'ImageStore is deprecated and will be removed in a future release. ' + - 'To get a base64-encoded string from a local image use either of the following third-party libraries:' + - "* expo-file-system: `readAsStringAsync(filepath, 'base64')`" + - "* react-native-fs: `readFile(filepath, 'base64')`", - ); - return require('ImageStore'); - }, - /* - get InputAccessoryView() { - return require('InputAccessoryView'); - }, - get KeyboardAvoidingView() { - return require('KeyboardAvoidingView'); - }, - get ListView() { - warnOnce( - 'listview-deprecation', - 'ListView is deprecated and will be removed in a future release. ' + - 'See https://fb.me/nolistview for more information', - ); - return require('ListView'); - },*/ - get MaskedViewIOS() { - warnOnce( - 'maskedviewios-moved', - 'MaskedViewIOS has been extracted from react-native core and will be removed in a future release. ' + - "It can now be installed and imported from '@react-native-community/masked-view' instead of 'react-native'. " + - 'See https://github.com/react-native-community/react-native-masked-view', - ); - return require('MaskedViewIOS'); - }, - /* - get Modal() { - return require('Modal'); - },*/ - get Picker() { - return require('Picker'); - }, - get PickerIOS() { - return require('../Components/Picker/PickerIOS'); - }, - get ProgressBarAndroid() { - return require('ProgressBarAndroid'); - }, - get ProgressViewIOS() { - return require('ProgressViewIOS'); - }, - get SafeAreaView() { - return require('SafeAreaView'); - }, - get ScrollView() { - return require('ScrollView'); - }, - get SectionList() { - return require('SectionList'); - }, - get SegmentedControlIOS() { - return require('SegmentedControlIOS'); - }, - get Slider() { - warnOnce( - 'slider-moved', - 'Slider has been extracted from react-native core and will be removed in a future release. ' + - "It can now be installed and imported from '@react-native-community/slider' instead of 'react-native'. " + - 'See https://github.com/react-native-community/react-native-slider', - ); - return require('Slider'); - }, - get Switch() { - return require('Switch'); - }, - /* - get RefreshControl() { - return require('RefreshControl'); - },*/ - get StatusBar() { - return require('StatusBar'); - }, - /* - get SwipeableFlatList() { - return require('SwipeableFlatList'); - },*/ - get Text() { - return require('Text'); - }, - get TextInput() { - return require('TextInput'); - }, - /* - get ToolbarAndroid() { - return require('ToolbarAndroid'); - },*/ - get Touchable() { - return require('Touchable'); - }, - get TouchableHighlight() { - return require('TouchableHighlight'); - }, - get TouchableNativeFeedback() { - return require('TouchableNativeFeedback'); - }, - get TouchableOpacity() { - return require('TouchableOpacity'); - }, - get TouchableWithoutFeedback() { - return require('TouchableWithoutFeedback'); - }, - get View() { - return require('View'); - }, - /* - get ViewPagerAndroid() { - warnOnce( - 'viewpager-moved', - 'ViewPagerAndroid has been extracted from react-native core and will be removed in a future release. ' + - "It can now be installed and imported from '@react-native-community/viewpager' instead of 'react-native'. " + - 'See https://github.com/react-native-community/react-native-viewpager', - ); - return require('ViewPagerAndroid'); - },*/ - get VirtualizedList() { - return require('VirtualizedList'); - }, - get VirtualizedSectionList() { - return require('VirtualizedSectionList'); - }, - - // APIs - get ActionSheetIOS() { - return require('ActionSheetIOS'); - }, - get Alert() { - return require('Alert'); - }, - get AlertMacOS() { - return require('AlertMacOS'); - }, - get Animated() { - return require('Animated'); - }, - get AppRegistry() { - return require('AppRegistry'); - }, - get AppState() { - return require('AppState'); - }, - get AsyncStorage() { - warnOnce( - 'async-storage-moved', - 'Async Storage has been extracted from react-native core and will be removed in a future release. ' + - "It can now be installed and imported from '@react-native-community/async-storage' instead of 'react-native'. " + - 'See https://github.com/react-native-community/react-native-async-storage', - ); - return require('AsyncStorage'); - }, - /* - get BackHandler() { - return require('BackHandler'); - }, - get CameraRoll() { - return require('CameraRoll'); - },*/ - get Clipboard() { - return require('Clipboard'); - }, - /* - get DatePickerAndroid() { - return require(' DatePickerAndroid'); - },*/ - // [TODO(macOS ISS#2323203) - get DatePickerMacOS() { - return require('../Components/DatePickerMacOS/DatePickerMacOS'); - }, // ]TODO(macOS ISS#2323203) - get DeviceInfo() { - return require('DeviceInfo'); - }, - get Dimensions() { - return require('Dimensions'); - }, - get Easing() { - return require('Easing'); - }, - get findNodeHandle() { - return require('ReactNative').findNodeHandle; - }, - get I18nManager() { - return require('I18nManager'); - }, - /* - get ImagePickerIOS() { - return require('ImagePickerIOS'); - },*/ - get InteractionManager() { - return require('InteractionManager'); - }, - /* - get Keyboard() { - return require('Keyboard'); - },*/ - get LayoutAnimation() { - return require('LayoutAnimation'); - }, - get Linking() { - return require('Linking'); - }, - get NativeEventEmitter() { - return require('NativeEventEmitter'); - }, - get PanResponder() { - return require('PanResponder'); - }, - /* - get PermissionsAndroid() { - return require('PermissionsAndroid'); - },*/ - get PixelRatio() { - return require('PixelRatio'); - }, - get PushNotificationIOS() { - warnOnce( - 'pushNotificationIOS-moved', - 'PushNotificationIOS has been extracted from react-native core and will be removed in a future release. ' + - "It can now be installed and imported from '@react-native-community/push-notification-ios' instead of 'react-native'. " + - 'See https://github.com/react-native-community/react-native-push-notification-ios', - ); - return require('PushNotificationIOS'); - }, - get Settings() { - return require('../Settings/Settings'); - }, - /* - get Share() { - return require('Share'); - }, - get StatusBarIOS() { - return require('StatusBarIOS'); - },*/ - get StyleSheet() { - return require('StyleSheet'); - }, - /* - get Systrace() { - return require('Systrace'); - }, - get TimePickerAndroid() { - return require('TimePickerAndroid'); - }, - get ToastAndroid() { - return require('ToastAndroid'); - },*/ - get TurboModuleRegistry() { - return require('TurboModuleRegistry'); - }, - get TVEventHandler() { - return require('TVEventHandler'); - }, - get UIManager() { - return require('UIManager'); - }, - get unstable_batchedUpdates() { - return require('ReactNative').unstable_batchedUpdates; - }, - get UTFSequence() { - return require('UTFSequence'); - }, - /* - get Vibration() { - return require('Vibration'); - }, - get VibrationIOS() { - return require('VibrationIOS'); - },*/ - get YellowBox() { - return require('YellowBox'); - }, - - // Plugins - get DeviceEventEmitter() { - return require('RCTDeviceEventEmitter'); - }, - get NativeAppEventEmitter() { - return require('RCTNativeAppEventEmitter'); - }, - get NativeModules() { - return require('NativeModules'); - }, - get Platform() { - return require('../Utilities/Platform'); - }, - get processColor() { - return require('processColor'); - }, - get requireNativeComponent() { - return require('requireNativeComponent'); - }, - - // Prop Types - get ColorPropType() { - return require('DeprecatedColorPropType'); - }, - get EdgeInsetsPropType() { - return require('DeprecatedEdgeInsetsPropType'); - }, - get PointPropType() { - return require('DeprecatedPointPropType'); - }, - get ViewPropTypes() { - return require('DeprecatedViewPropTypes'); - }, -}; - -if (__DEV__) { - // $FlowFixMe This is intentional: Flow will error when attempting to access ListView. - Object.defineProperty(module.exports, 'ListView', { - configurable: true, - get() { - invariant( - false, - 'ListView has been removed from React Native. ' + - 'See https://fb.me/nolistview for more information or use ' + - '`deprecated-react-native-listview`.', - ); - }, - }); - - // $FlowFixMe This is intentional: Flow will error when attempting to access SwipeableListView. - Object.defineProperty(module.exports, 'SwipeableListView', { - configurable: true, - get() { - invariant( - false, - 'SwipeableListView has been removed from React Native. ' + - 'See https://fb.me/nolistview for more information or use ' + - '`deprecated-react-native-swipeable-listview`.', - ); - }, - }); -} diff --git a/RNTester/Podfile b/RNTester/Podfile index a40fe31254c2c4..9ca1679fd40a5c 100644 --- a/RNTester/Podfile +++ b/RNTester/Podfile @@ -75,9 +75,10 @@ target 'RNTester-macOS' do # Enable TurboModule use_react_native!(path: "..", turbo_modules_enabled: true) - # pod 'React-turbomodule-samples', :path => '../ReactCommon/turbomodule/samples' + pod 'React-turbomodule-samples', :path => '../ReactCommon/turbomodule/samples' # Additional Pods which aren't included in the default Podfile + pod 'React-RCTCameraRoll', :path => '../Libraries/CameraRoll' pod 'React-ART', :path => '../Libraries/ART' pod 'React-RCTPushNotification', :path => '../Libraries/PushNotificationIOS' diff --git a/RNTester/Podfile.lock b/RNTester/Podfile.lock index 8e4ded10230677..a28dbe9419989e 100644 --- a/RNTester/Podfile.lock +++ b/RNTester/Podfile.lock @@ -217,7 +217,7 @@ SPEC CHECKSUMS: glog: b3f6d74f3e2d33396addc0ee724d2b2b79fc3e00 React: 74861516f70acbdca7b2548aa557bf8deee9698d React-ART: 08abf61755c11f2adbc78ae6e2f5b087a403a677 - React-Core: aa142862b5ebdf94e003787e22417865e1c1016c + React-Core: aac897dab7a526739a9a704a712d4e24f25b4045 React-cxxreact: 3e49ca16e0117d19b859450041c7fe4dc9296399 React-DevSupport: 91d8812ad81fbfa8084b06e131e3d80087c665e9 React-fishhook: 1a55e7b86dcab2d0e0db1268681365c3f5eefe0a @@ -228,7 +228,7 @@ SPEC CHECKSUMS: React-RCTActionSheet: c3adb7754a32492fc5e0bcaf2395221006588b6b React-RCTAnimation: ed93d0ae9533f117e0512738338c4c8479a8925e React-RCTBlob: f4387573b7c109b6feed2f7b6453cf326854bfdc - React-RCTCameraRoll: bb4e89e505fddd8a48c76db827e3e43b23b437e3 + React-RCTCameraRoll: 4c8233e7d0d3aee3448faaaa5df90f8168abaeed React-RCTImage: 841010ce5a7a0eb96bc3f22659560a176a254fc9 React-RCTLinking: 4fe50097a4d8c9649b25fd6639257aa475530656 React-RCTNetwork: b7bf49cc581752158e8aeee3e9aae83ab61fbcd0 @@ -241,6 +241,6 @@ SPEC CHECKSUMS: React-turbomodule-samples: 4d9081847444fe313ac06bb6ec604c35e49ba8c7 yoga: fb23117669f477b0f4b3849d6999414cba0c69b7 -PODFILE CHECKSUM: 0fe24de33063625557c3c388037ac21ef86e5057 +PODFILE CHECKSUM: 0b418aae85ecd3476677689ebd88a378a54d0825 COCOAPODS: 1.8.4 diff --git a/RNTester/RNTester-macOS/Info.plist b/RNTester/RNTester-macOS/Info.plist index f62f7ac6e5bf9d..d7887f58cdee79 100644 --- a/RNTester/RNTester-macOS/Info.plist +++ b/RNTester/RNTester-macOS/Info.plist @@ -2,17 +2,6 @@ - CFBundleURLTypes - - - CFBundleURLName - - CFBundleURLSchemes - - rntester - - - CFBundleDevelopmentRegion en CFBundleExecutable @@ -27,21 +16,34 @@ BNDL CFBundleShortVersionString 1.0 + CFBundleURLTypes + + + CFBundleURLName + + CFBundleURLSchemes + + rntester + + + CFBundleVersion 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) NSAppTransportSecurity NSAllowsArbitraryLoads - LSMinimumSystemVersion - $(MACOSX_DEPLOYMENT_TARGET) + NSPhotoLibraryUsageDescription + Photo library access needed for some tests. NSHumanReadableCopyright Copyright © 2017 Facebook. All rights reserved. - NSMainStoryboardFile - Main NSLocationWhenInUseUsageDescription true + NSMainStoryboardFile + Main NSPrincipalClass NSApplication diff --git a/RNTester/RNTester-macOS/RNTester_macOS.entitlements b/RNTester/RNTester-macOS/RNTester_macOS.entitlements index e69de29bb2d1d6..c3731178b4cfae 100644 --- a/RNTester/RNTester-macOS/RNTester_macOS.entitlements +++ b/RNTester/RNTester-macOS/RNTester_macOS.entitlements @@ -0,0 +1,8 @@ + + + + + com.apple.security.personal-information.photos-library + + + diff --git a/RNTester/RNTesterPods.xcodeproj/project.pbxproj b/RNTester/RNTesterPods.xcodeproj/project.pbxproj index 1f3c3a8a91f554..b97c29b0a0818e 100644 --- a/RNTester/RNTesterPods.xcodeproj/project.pbxproj +++ b/RNTester/RNTesterPods.xcodeproj/project.pbxproj @@ -12,6 +12,9 @@ 272E6B3F1BEA849E001FCF37 /* UpdatePropertiesExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.m */; }; 27F441EC1BEBE5030039B79C /* FlexibleSizeExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F441E81BEBE5030039B79C /* FlexibleSizeExampleView.m */; }; 2DDEF0101F84BF7B00DBDF73 /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 2DDEF00F1F84BF7B00DBDF73 /* Images.xcassets */; }; + 38B2630B2444F5EB006AB4D5 /* UpdatePropertiesExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.m */; }; + 38B2630C2444F628006AB4D5 /* FlexibleSizeExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F441E81BEBE5030039B79C /* FlexibleSizeExampleView.m */; }; + 38CB64352445042D009035CC /* RNTesterTurboModuleProvider.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5CB07C99226467E60039471C /* RNTesterTurboModuleProvider.mm */; }; 3D13F8481D6F6AF900E69E0E /* ImageInBundle.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D13F8441D6F6AF200E69E0E /* ImageInBundle.png */; }; 3D13F84A1D6F6AFD00E69E0E /* OtherImages.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 3D13F8451D6F6AF200E69E0E /* OtherImages.xcassets */; }; 3D2AFAF51D646CF80089D1A3 /* legacy_image@2x.png in Resources */ = {isa = PBXBuildFile; fileRef = 3D2AFAF41D646CF80089D1A3 /* legacy_image@2x.png */; }; @@ -662,7 +665,10 @@ files = ( 5101985A23AD9F5B00118BF1 /* ViewController.m in Sources */, 9F153467233AB2C7006DFE44 /* main.m in Sources */, + 38CB64352445042D009035CC /* RNTesterTurboModuleProvider.mm in Sources */, 9F15345F233AB2C4006DFE44 /* AppDelegate.m in Sources */, + 38B2630C2444F628006AB4D5 /* FlexibleSizeExampleView.m in Sources */, + 38B2630B2444F5EB006AB4D5 /* UpdatePropertiesExampleView.m in Sources */, ); runOnlyForDeploymentPostprocessing = 0; }; diff --git a/RNTester/js/ActionSheetMacOSExample.js b/RNTester/js/ActionSheetMacOSExample.js deleted file mode 100644 index 562f5d7ee229ba..00000000000000 --- a/RNTester/js/ActionSheetMacOSExample.js +++ /dev/null @@ -1,132 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - */ -'use strict'; - -var React = require('react'); -var ReactNative = require('react-native'); -var { - ActionSheetIOS, - StyleSheet, - Text, - View, - findNodeHandle, -} = ReactNative; - -var BUTTONS = [ - 'Option 0', - 'Option 1', - 'Option 2', - 'Delete', - 'Cancel', -]; -var DESTRUCTIVE_INDEX = 3; -var CANCEL_INDEX = 4; - -class ActionSheetExample extends React.Component<{}, $FlowFixMeState> { - state = { - clicked: 'none', - }; - - anchorRef = React.createRef(); - - render() { - return ( - - - Click to show the ActionSheet - - - Clicked button: {this.state.clicked} - - - ); - } - - showActionSheet = () => { - ActionSheetIOS.showActionSheetWithOptions({ - options: BUTTONS, - cancelButtonIndex: CANCEL_INDEX, - anchor: this.anchorRef.current - ? findNodeHandle(this.anchorRef.current) - : undefined, - destructiveButtonIndex: DESTRUCTIVE_INDEX, - }, - (buttonIndex) => { - this.setState({ clicked: BUTTONS[buttonIndex] }); - }); - }; -} - -class ShareActionSheetExample extends React.Component<$FlowFixMeProps, $FlowFixMeState> { - state = { - text: '', - }; - - render() { - return ( - - - Click to show the Share ActionSheet - - - {this.state.text} - - - ); - } - - showShareActionSheet = () => { - ActionSheetIOS.showShareActionSheetWithOptions({ - url: this.props.url, - message: 'message to go with the shared url', - subject: 'a subject to go in the email heading', - excludedActivityTypes: [ - 'com.apple.share.Twitter.post', - ], - }, - (error) => alert(error), - (completed, method) => { - var text; - if (completed) { - text = `Shared via ${method}`; - } else { - text = 'You didn\'t share'; - } - this.setState({text}); - }); - }; -} - -var style = StyleSheet.create({ - button: { - marginBottom: 10, - fontWeight: '500', - }, -}); - -exports.title = 'ActionSheetIOS'; -exports.description = 'Interface to show iOS\' action sheets'; -exports.examples = [ - { - title: 'Show Action Sheet', - render(): React.Element { return ; }, - }, - { - title: 'Show Share Action Sheet', - render(): React.Element { - return ; - }, - }, - { - title: 'Share Local Image', - render(): React.Element { - return ; - }, - }, -]; diff --git a/RNTester/js/AlertMacOSExample.js b/RNTester/js/AlertMacOSExample.js deleted file mode 100644 index 0bcab1d61a9c2f..00000000000000 --- a/RNTester/js/AlertMacOSExample.js +++ /dev/null @@ -1,294 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - */ -'use strict'; - -var React = require('react'); -var ReactNative = require('react-native'); -var { - StyleSheet, - View, - Text, - TouchableHighlight, - AlertMacOS, -} = ReactNative; - -var { SimpleAlertExampleBlock } = require('./AlertExample'); - -exports.framework = 'React'; -exports.title = 'AlertMacOS'; -exports.description = 'macOS alerts'; -exports.examples = [{ - title: 'Alerts', - render() { - return ; - }, -}, -{ - title: 'Prompt Options', - render(): React.Element { - return ; - }, -}, -{ - title: 'Prompt Types', - render() { - return ( - - AlertMacOS.prompt('Plain Text Entry')}> - - - - plain-text - - - - - AlertMacOS.prompt('Secure Text', null, null, 'secure-text')}> - - - - secure-text - - - - - AlertMacOS.prompt( - 'Login & Password', - null, - null, - 'login-password', - [ - {default: '', placeholder: 'login'}, - {default: '', placeholder: 'Password'}, - ], - )}> - - - - login-password - - - - - - ); - }, -}, -{ - title: 'Prompt Presentation', - render() { - return ( - - AlertMacOS.prompt( - 'Default sheet', - null, - null, - 'default', - [ - {default: '', placeholder: ''}, - ], - false - )}> - - - - Default sheet - - - - - AlertMacOS.prompt( - 'Modal', - null, - null, - 'default', - [ - {default: '', placeholder: ''}, - ], - true - )}> - - - - Modal - - - - - - ); - }, -}, -{ - title: 'Prompt Style', - render() { - return ( - - AlertMacOS.prompt( - 'Default warning style', - null, - null, - 'default' - )}> - - - - Default warning style - - - - - AlertMacOS.prompt( - 'Critical', - null, - null, - 'default', - [ - {default: '', placeholder: ''}, - ], - false, - true) - }> - - - - Critical - - - - - - ); - }, -}, -]; - -class PromptOptions extends React.Component<$FlowFixMeProps, any> { - state: any; - customButtons: Array; - - constructor(props) { - super(props); - - // $FlowFixMe this seems to be a Flow bug, `saveResponse` is defined below - this.saveResponse = this.saveResponse.bind(this); - - this.customButtons = [{ - text: 'Custom OK', - onPress: this.saveResponse, - }, { - text: 'Custom Cancel', - style: 'cancel', - }]; - - this.state = { - promptValue: undefined, - }; - } - - render() { - return ( - - - Prompt value: {this.state.promptValue} - - - AlertMacOS.prompt('Type a value', null, this.saveResponse)}> - - - - prompt with title & callback - - - - - AlertMacOS.prompt('Type a value', null, this.customButtons)}> - - - - prompt with title & custom buttons - - - - - AlertMacOS.prompt( - 'Type a value', - null, - this.saveResponse, - undefined, - [ - {default: 'Default value', placeholder: ''}, - ], - )}> - - - - prompt with title, callback & default inputs - - - - - AlertMacOS.prompt( - 'Type a value', - null, - this.customButtons, - 'login-password', - [ - {default: 'admin@site.com', placeholder: 'login'}, - {default: '', placeholder: 'password'}, - ], - )}> - - - - prompt with title, custom buttons, login/password & default inputs - - - - - ); - } - - saveResponse(promptValue) { - this.setState({ promptValue: JSON.stringify(promptValue) }); - } -} - -var styles = StyleSheet.create({ - wrapper: { - borderRadius: 5, - marginBottom: 5, - }, - button: { - backgroundColor: '#eeeeee', - padding: 10, - }, -}); diff --git a/RNTester/js/AnimatedExampleMacOS.js b/RNTester/js/AnimatedExampleMacOS.js deleted file mode 100644 index 872f91176a1f20..00000000000000 --- a/RNTester/js/AnimatedExampleMacOS.js +++ /dev/null @@ -1,186 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @flow - */ -'use strict'; - -var React = require('react'); -var ReactNative = require('react-native'); -var { - Animated, - Easing, - StyleSheet, - Text, - View, -} = ReactNative; -var RNTesterButton = require('./RNTesterButton'); - -exports.framework = 'React'; -exports.title = 'Animated - Examples'; -exports.description = 'Animated provides a powerful ' + - 'and easy-to-use API for building modern, ' + - 'interactive user experiences.'; - -exports.examples = [ - { - title: 'FadeInView', - description: 'Uses a simple timing animation to ' + - 'bring opacity from 0 to 1 when the component ' + - 'mounts.', - render: function() { - class FadeInView extends React.Component<$FlowFixMeProps, any> { - state: any; - - constructor(props) { - super(props); - this.state = { - fadeAnim: new Animated.Value(0), // opacity 0 - }; - } - componentDidMount() { - Animated.timing( // Uses easing functions - this.state.fadeAnim, // The value to drive - { - toValue: 1, // Target - duration: 2000, // Configuration - }, - ).start(); // Don't forget start! - } - render() { - return ( - - {this.props.children} - - ); - } - } - class FadeInExample extends React.Component<$FlowFixMeProps, any> { - state: any; - /* $FlowFixMe(>=0.85.0 site=react_native_fb) This comment suppresses an - * error found when Flow v0.85 was deployed. To see the error, delete - * this comment and run Flow. */ - constructor(props) { - super(props); - this.state = { - show: true, - }; - } - render() { - return ( - - { - this.setState((state) => ( - {show: !state.show} - )); - }}> - Press to {this.state.show ? - 'Hide' : 'Show'} - - {this.state.show && - - FadeInView - - } - - ); - } - } - return ; - }, - }, - { - title: 'Composite Animations with Easing', - description: 'Sequence, parallel, delay, and ' + - 'stagger with different easing functions.', - render: function() { - this.anims = this.anims || [1,2,3].map( - () => new Animated.Value(0) - ); - return ( - - { - var timing = Animated.timing; - Animated.sequence([ // One after the other - timing(this.anims[0], { - toValue: 200, - easing: Easing.linear, - }), - Animated.delay(400), // Use with sequence - timing(this.anims[0], { - toValue: 0, - easing: Easing.elastic(2), // Springy - }), - Animated.delay(400), - Animated.stagger(200, - this.anims.map((anim) => timing( - anim, {toValue: 200} - )).concat( - this.anims.map((anim) => timing( - anim, {toValue: 0} - ))), - ), - Animated.delay(400), - Animated.parallel([ - Easing.inOut(Easing.quad), // Symmetric - Easing.back(1.5), // Goes backwards first - Easing.ease, // Default bezier - ].map((easing, ii) => ( - timing(this.anims[ii], { - toValue: 320, easing, duration: 3000, - }) - ))), - Animated.delay(400), - Animated.stagger(200, - this.anims.map((anim) => timing(anim, { - toValue: 0, - easing: Easing.bounce, // Like a ball - duration: 2000, - })), - ), - ]).start(); }}> - Press to Animate - - {['Composite', 'Easing', 'Animations!'].map( - (text, ii) => ( - - {text} - - ) - )} - - ); - }, - }, - { - title: 'Continuous Interactions', - description: 'Gesture events, chaining, 2D ' + - 'values, interrupting and transitioning ' + - 'animations, etc.', - render: () => ( - Checkout the Gratuitous Animation App! - ), - }, -]; - -var styles = StyleSheet.create({ - content: { - backgroundColor: 'deepskyblue', - borderWidth: 1, - borderColor: 'dodgerblue', - padding: 20, - margin: 20, - borderRadius: 10, - alignItems: 'center', - }, -}); diff --git a/RNTester/js/RNTesterList.macos.js b/RNTester/js/RNTesterList.macos.js index 01720e0ceeb982..28fb138cb3513b 100644 --- a/RNTester/js/RNTesterList.macos.js +++ b/RNTester/js/RNTesterList.macos.js @@ -33,11 +33,17 @@ const ComponentExamples: Array = [ module: require('./DarkModeExample'), supportsTVOS: false, }, + { + key: 'DatePickerIOSExample', + module: require('./DatePickerIOSExample'), + supportsTVOS: false, + }, + // [TODO(OSS Candidate ISS#2710739) { key: 'DatePickerMacOSExample', module: require('./DatePickerMacOSExample'), supportsTVOS: false, - }, + }, // ]TODO(OSS Candidate ISS#2710739) { key: 'FlatListExample', module: require('./FlatListExample'), @@ -54,11 +60,11 @@ const ComponentExamples: Array = [ module: require('./ImageExample'), supportsTVOS: true, }, - { + /* iOS Only Component { key: 'InputAccessoryViewExample', module: require('./InputAccessoryViewExample'), supportsTVOS: true, - }, + }, */ { key: 'KeyboardAvoidingViewExample', module: require('./KeyboardAvoidingViewExample'), @@ -74,11 +80,11 @@ const ComponentExamples: Array = [ module: require('./MaskedViewExample'), supportsTVOS: true, }, - /* { + { key: 'ModalExample', module: require('./ModalExample'), supportsTVOS: true, - }, */ + }, { key: 'MultiColumnExample', module: require('./MultiColumnExample'), @@ -94,11 +100,11 @@ const ComponentExamples: Array = [ module: require('./PickerExample'), supportsTVOS: false, }, - /* { + { key: 'PickerIOSExample', module: require('./PickerIOSExample'), supportsTVOS: false, - }, */ + }, { key: 'ProgressViewIOSExample', module: require('./ProgressViewIOSExample'), @@ -139,11 +145,11 @@ const ComponentExamples: Array = [ module: require('./SliderExample'), supportsTVOS: false, }, - /* { Depends on Modal which is not implemented for macOS + { key: 'StatusBarExample', module: require('./StatusBarExample'), supportsTVOS: false, - }, */ + }, { key: 'SwitchExample', module: require('./SwitchExample'), @@ -151,7 +157,7 @@ const ComponentExamples: Array = [ }, { key: 'TextExample', - module: require('./TextExample.macos'), + module: require('./TextExample.ios'), supportsTVOS: true, }, { @@ -189,17 +195,17 @@ const APIExamples: Array = [ }, { key: 'ActionSheetIOSExample', - module: require('./ActionSheetMacOSExample'), + module: require('./ActionSheetIOSExample'), supportsTVOS: true, }, { - key: 'AnimatedExampleMacOS', - module: require('./AnimatedExampleMacOS'), + key: 'AlertIOSExample', + module: require('./AlertIOSExample'), supportsTVOS: true, }, { - key: 'AlertExample', - module: require('./AlertExample').AlertExample, + key: 'AnimatedExample', + module: require('./AnimatedExample'), supportsTVOS: true, }, { @@ -208,8 +214,8 @@ const APIExamples: Array = [ supportsTVOS: true, }, { - key: 'AlertMacOSExample', - module: require('./AlertMacOSExample'), + key: 'AppStateExample', + module: require('./AppStateExample'), supportsTVOS: true, }, { @@ -322,7 +328,7 @@ const APIExamples: Array = [ module: require('./TransformExample'), supportsTVOS: true, }, - /* { + { key: 'TurboModuleExample', module: require('./TurboModuleExample'), supportsTVOS: false, @@ -336,17 +342,17 @@ const APIExamples: Array = [ key: 'VibrationExample', module: require('./VibrationExample'), supportsTVOS: false, - }, */ + }, { key: 'WebSocketExample', module: require('./WebSocketExample'), supportsTVOS: true, }, - /* { + { key: 'XHRExample', module: require('./XHRExample'), supportsTVOS: true, - }, */ + }, ]; const Modules = {}; diff --git a/RNTester/js/TextExample.macos.js b/RNTester/js/TextExample.macos.js deleted file mode 100644 index 5fdaf7b3d09314..00000000000000 --- a/RNTester/js/TextExample.macos.js +++ /dev/null @@ -1,865 +0,0 @@ -/** - * Copyright (c) 2015-present, Facebook, Inc. - * - * This source code is licensed under the MIT license found in the - * LICENSE file in the root directory of this source tree. - * - * @format - * @flow - */ - -// TODO(macOS ISS#2323203) Copied from TextExample.ios.js - -'use strict'; - -import Platform from '../../Libraries/Utilities/Platform'; // TODO(OSS Candidate ISS#2710739) -var React = require('react'); -var createReactClass = require('create-react-class'); -var ReactNative = require('react-native'); -var {Text, TextInput, View, LayoutAnimation, Button} = ReactNative; - -type TextAlignExampleRTLState = {| - isRTL: boolean, -|}; - -class TextAlignRTLExample extends React.Component<*, TextAlignExampleRTLState> { - constructor(...args: Array<*>) { - super(...args); - - this.state = { - isRTL: false, - }; - } - - render() { - const {isRTL} = this.state; - const toggleRTL = () => this.setState({isRTL: !isRTL}); - return ( - - auto (default) - english LTR - - {'\u0623\u062D\u0628 \u0627\u0644\u0644\u063A\u0629 ' + - '\u0627\u0644\u0639\u0631\u0628\u064A\u0629 auto (default) - arabic RTL'} - - - left left left left left left left left left left left left left left - left - - - center center center center center center center center center center - center - - - right right right right right right right right right right right - right right - - - justify: this text component{"'"}s contents are laid out with - "textAlign: justify" and as you can see all of the lines except the - last one span the available width of the parent container. - -