Get Cocoapods build building for test targets, make macOS API surface equivalent to iOS and Android (#305)

* Update scripts to publish react-native-macos-init

* Clean up merge markers

* Restored ios:macos RNTester parity except for InputAccessoryView.

* Add InputAccessoryView for mac

* iOS tests pass via Pods

* IntegrationTests passing

* All targets building

* Removed unused file.

* Preserve building in both static xcodeproj and cocoapods.

* Missed a diff comment

* Elliminstated RCTTest #ifdefs

* Align with upstream changes post .60

* Fix Flow check and minor ESLint whitespace

* Make .gitignore align with changes upstream.
This commit is contained in:
Tom Underhill 2020-04-15 15:24:55 -07:00 коммит произвёл GitHub
Родитель d9b7a7d283
Коммит 6639248252
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
50 изменённых файлов: 1248 добавлений и 3163 удалений

5
.gitignore поставляемый
Просмотреть файл

@ -41,6 +41,11 @@ buck-out
/ReactAndroid/src/main/jni/prebuilt/lib/x86/
/ReactAndroid/src/main/gen
# Android Studio
.project
.settings
.classpath
# Watchman
.watchmanconfig

Просмотреть файл

@ -28,7 +28,7 @@ Pod::Spec.new do |s|
s.source = source
s.source_files = "*.{h,m,mm}"
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
s.header_dir = "React"
s.header_dir = "RCTBlob"
s.dependency "React-Core", version
s.dependency "React-RCTNetwork", version

Просмотреть файл

@ -9,11 +9,13 @@
#import <CoreLocation/CoreLocation.h>
#import <Foundation/Foundation.h>
#import <UIKit/UIKit.h>
#import <React/RCTUIKit.h> // TODO(macOS ISS#2323203)
#import <Photos/Photos.h>
#import <dlfcn.h>
#import <objc/runtime.h>
#if !TARGET_OS_OSX // TODO(macOS ISS#2323203)
#import <MobileCoreServices/UTType.h>
#endif // TODO(macOS ISS#2323203)
#import <React/RCTBridge.h>
#import <React/RCTConvert.h>
@ -318,6 +320,7 @@ RCT_EXPORT_METHOD(deletePhotos:(NSArray<NSString *>*)assets
resolve:(RCTPromiseResolveBlock)resolve
reject:(RCTPromiseRejectBlock)reject)
{
#if !TARGET_OS_OSX // TODO(macOS ISS#2323203)
NSArray<NSURL *> *assets_ = [RCTConvert NSURLArray:assets];
[[PHPhotoLibrary sharedPhotoLibrary] performChanges:^{
PHFetchResult<PHAsset *> *fetched =
@ -333,6 +336,10 @@ RCT_EXPORT_METHOD(deletePhotos:(NSArray<NSString *>*)assets
}
}
];
#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()

Просмотреть файл

@ -45,9 +45,11 @@ RCT_EXPORT_MODULE()
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];

Просмотреть файл

@ -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

Просмотреть файл

@ -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

Просмотреть файл

@ -28,7 +28,7 @@ Pod::Spec.new do |s|
s.source = source
s.source_files = "{Drivers/*,Nodes/*,*}.{h,m}"
s.preserve_paths = "package.json", "LICENSE", "LICENSE-docs"
s.header_dir = "React"
s.header_dir = "RCTAnimation"
s.dependency "React-Core", version
end

Просмотреть файл

@ -32,6 +32,4 @@ Pod::Spec.new do |s|
s.header_dir = "React"
s.dependency "React-Core", version
s.osx.exclude_files = "TextInput/RCTInputAccessory{,Shadow}View*.{h,m}"
end

Просмотреть файл

@ -14,7 +14,9 @@
- (void)insertReactSubview:(RCTShadowView *)subview atIndex:(NSInteger)atIndex
{
[super insertReactSubview:subview atIndex:atIndex];
#if !TARGET_OS_OSX // TODO(macOS ISS#2323203)
subview.width = (YGValue) { RCTScreenSize().width, YGUnitPoint };
#endif // TODO(macOS ISS#2323203)
}
@end

Просмотреть файл

@ -16,7 +16,7 @@
@interface RCTInputAccessoryView()
// Overriding `inputAccessoryView` to `readwrite`.
@property (nonatomic, readwrite, retain) UIView *inputAccessoryView;
@property (nonatomic, readwrite, retain) RCTUIView *inputAccessoryView; // TODO(macOS ISS#2323203)
@end
@ -50,13 +50,13 @@
}
}
- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)index
- (void)insertReactSubview:(RCTUIView *)subview atIndex:(NSInteger)index // TODO(macOS ISS#2323203)
{
[super insertReactSubview:subview atIndex:index];
[_inputAccessoryView insertReactSubview:subview atIndex:index];
}
- (void)removeReactSubview:(UIView *)subview
- (void)removeReactSubview:(RCTUIView *)subview // TODO(macOS ISS#2323203)
{
[super removeReactSubview:subview];
[_inputAccessoryView removeReactSubview:subview];

Просмотреть файл

@ -11,14 +11,14 @@
@implementation RCTInputAccessoryViewContent
{
UIView *_safeAreaContainer;
RCTUIView *_safeAreaContainer; // TODO(macOS ISS#2323203)
NSLayoutConstraint *_heightConstraint;
}
- (instancetype)init
{
if (self = [super init]) {
_safeAreaContainer = [UIView new];
_safeAreaContainer = [RCTUIView new]; // TODO(macOS ISS#2323203)
[self addSubview:_safeAreaContainer];
// Use autolayout to position the view properly and take into account
@ -30,17 +30,21 @@
_heightConstraint = [_safeAreaContainer.heightAnchor constraintEqualToConstant:0];
_heightConstraint.active = YES;
#if !TARGET_OS_OSX // TODO(macOS ISS#2323203)
if (@available(iOS 11.0, *)) {
[_safeAreaContainer.bottomAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.bottomAnchor].active = YES;
[_safeAreaContainer.topAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.topAnchor].active = YES;
[_safeAreaContainer.leadingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.leadingAnchor].active = YES;
[_safeAreaContainer.trailingAnchor constraintEqualToAnchor:self.safeAreaLayoutGuide.trailingAnchor].active = YES;
} else {
#endif // TODO(macOS ISS#2323203)
[_safeAreaContainer.bottomAnchor constraintEqualToAnchor:self.bottomAnchor].active = YES;
[_safeAreaContainer.topAnchor constraintEqualToAnchor:self.topAnchor].active = YES;
[_safeAreaContainer.leadingAnchor constraintEqualToAnchor:self.leadingAnchor].active = YES;
[_safeAreaContainer.trailingAnchor constraintEqualToAnchor:self.trailingAnchor].active = YES;
#if !TARGET_OS_OSX // TODO(macOS ISS#2323203)
}
#endif // TODO(macOS ISS#2323203)
}
return self;
}
@ -64,13 +68,13 @@
[self layoutIfNeeded];
}
- (void)insertReactSubview:(UIView *)subview atIndex:(NSInteger)index
- (void)insertReactSubview:(RCTUIView *)subview atIndex:(NSInteger)index // TODO(macOS ISS#2323203)
{
[super insertReactSubview:subview atIndex:index];
[_safeAreaContainer insertSubview:subview atIndex:index];
}
- (void)removeReactSubview:(UIView *)subview
- (void)removeReactSubview:(RCTUIView *)subview // TODO(macOS ISS#2323203)
{
[super removeReactSubview:subview];
[subview removeFromSuperview];

Просмотреть файл

@ -19,7 +19,7 @@ RCT_EXPORT_MODULE()
return NO;
}
- (UIView *)view
- (RCTUIView *)view // TODO(macOS ISS#2323203)
{
return [[RCTInputAccessoryView alloc] initWithBridge:self.bridge];
}

Просмотреть файл

@ -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`.',
);
},
});
}

Просмотреть файл

@ -43,8 +43,7 @@ require_relative '../scripts/autolink-ios'
install! 'cocoapods', :deterministic_uuids => false
# TODO(macOS GH#214)
target 'RNTester' do
platform :ios, '9.0'
def pods()
# Uncomment for Swift
# use_frameworks!
@ -65,24 +64,37 @@ target 'RNTester' do
# use_react_native!(path: "..", turbo_modules_enabled: true, fabric_enabled: true)
end
target 'RNTester' do
platform :ios, '9.0'
pods()
end
target 'RNTesterUnitTests' do
platform :ios, '9.0'
pods()
pod 'React-RCTTest', :path => "./RCTTest"
end
target 'RNTesterIntegrationTests' do
platform :ios, '9.0'
pods()
pod 'React-RCTTest', :path => "./RCTTest"
end
# TODO(macOS GH#214)
target 'RNTester-macOS' do
platform :osx, '10.14'
# Uncomment for Swift
# use_frameworks!
project 'RNTesterPods.xcodeproj'
# Enable TurboModule
use_react_native!(path: "..", turbo_modules_enabled: true)
# pod 'React-turbomodule-samples', :path => '../ReactCommon/turbomodule/samples'
# Additional Pods which aren't included in the default Podfile
pod 'React-ART', :path => '../Libraries/ART'
pod 'React-RCTPushNotification', :path => '../Libraries/PushNotificationIOS'
# Additional Pods which are classed as unstable
#
# To use fabric: add `fabric_enabled` option to the use_react_native method above, like below
# use_react_native!(path: "..", turbo_modules_enabled: true, fabric_enabled: true)
pods()
end
target 'RNTester-macOSUnitTests' do
platform :osx, '10.14'
pods()
pod 'React-RCTTest', :path => "./RCTTest"
end
target 'RNTester-macOSIntegrationTests' do
platform :osx, '10.14'
pods()
pod 'React-RCTTest', :path => "./RCTTest"
end

Просмотреть файл

@ -84,6 +84,8 @@ PODS:
- React-Core (= 1000.0.0)
- React-RCTSettings (1000.0.0):
- React-Core (= 1000.0.0)
- React-RCTTest (1000.0.0):
- React-Core (= 1000.0.0)
- React-RCTText (1000.0.0):
- React-Core (= 1000.0.0)
- React-RCTVibration (1000.0.0):
@ -143,6 +145,7 @@ DEPENDENCIES:
- React-RCTNetwork (from `../Libraries/Network`)
- React-RCTPushNotification (from `../Libraries/PushNotificationIOS`)
- React-RCTSettings (from `../Libraries/Settings`)
- React-RCTTest (from `./RCTTest`)
- React-RCTText (from `../Libraries/Text`)
- React-RCTVibration (from `../Libraries/Vibration`)
- React-RCTWebSocket (from `../Libraries/WebSocket`)
@ -197,6 +200,8 @@ EXTERNAL SOURCES:
:path: "../Libraries/PushNotificationIOS"
React-RCTSettings:
:path: "../Libraries/Settings"
React-RCTTest:
:path: "./RCTTest"
React-RCTText:
:path: "../Libraries/Text"
React-RCTVibration:
@ -217,7 +222,7 @@ SPEC CHECKSUMS:
glog: b3f6d74f3e2d33396addc0ee724d2b2b79fc3e00
React: 74861516f70acbdca7b2548aa557bf8deee9698d
React-ART: 08abf61755c11f2adbc78ae6e2f5b087a403a677
React-Core: aa142862b5ebdf94e003787e22417865e1c1016c
React-Core: 06246a75cdb32beacf777cda87c61c13276b4271
React-cxxreact: 3e49ca16e0117d19b859450041c7fe4dc9296399
React-DevSupport: 91d8812ad81fbfa8084b06e131e3d80087c665e9
React-fishhook: 1a55e7b86dcab2d0e0db1268681365c3f5eefe0a
@ -226,21 +231,22 @@ SPEC CHECKSUMS:
React-jsiexecutor: 9af31e4fb3c7157d6437d11a4686974ffd5310b7
React-jsinspector: bd0f3d1d100ec90008bdceeecc3b2ccde15f349c
React-RCTActionSheet: c3adb7754a32492fc5e0bcaf2395221006588b6b
React-RCTAnimation: ed93d0ae9533f117e0512738338c4c8479a8925e
React-RCTBlob: f4387573b7c109b6feed2f7b6453cf326854bfdc
React-RCTCameraRoll: bb4e89e505fddd8a48c76db827e3e43b23b437e3
React-RCTAnimation: ae01c6e813366aef34ebe182f007ca42365b5f47
React-RCTBlob: 4c36d6a42e2d2ad5deff4b2182ffcf4c6ff0c048
React-RCTCameraRoll: 4c8233e7d0d3aee3448faaaa5df90f8168abaeed
React-RCTImage: 841010ce5a7a0eb96bc3f22659560a176a254fc9
React-RCTLinking: 4fe50097a4d8c9649b25fd6639257aa475530656
React-RCTNetwork: b7bf49cc581752158e8aeee3e9aae83ab61fbcd0
React-RCTPushNotification: 79cbb2aaf51f65b94e844c876f462ec07be33ac5
React-RCTSettings: 1ad264bf310d7cf7f2b29c94836b84e5a0ca1561
React-RCTText: 21e57ebc1cc19db1b74cf40280c3a0360f760dcb
React-RCTTest: 6621c76066fa0c1293149d06c2bf2d5b06be6956
React-RCTText: fc8369e3ce7c9a474efc539d84b4f9bdc921bc0a
React-RCTVibration: d9a3da17bd5d3f4d8b57a40e3e7fb842f7e62694
React-RCTWebSocket: 7bb0868fafa9e8ed961a8f87879e2d2bf7946b3d
React-turbomodule-core: 970dd38c0e59a09b5919e0a097abdd099c4ae9a7
React-turbomodule-samples: 4d9081847444fe313ac06bb6ec604c35e49ba8c7
yoga: fb23117669f477b0f4b3849d6999414cba0c69b7
PODFILE CHECKSUM: 0fe24de33063625557c3c388037ac21ef86e5057
PODFILE CHECKSUM: d10549a91f1ecde1496088874e41348b2cd79f9f
COCOAPODS: 1.8.4

Просмотреть файл

@ -8,7 +8,7 @@
#import <QuartzCore/QuartzCore.h>
#import <UIKit/UIKit.h>
#import <React/RCTUIKit.h> // TODO(macOS ISS#2323203)
#import <XCTest/XCTest.h>
@ -38,7 +38,7 @@
@param error An error to log in an XCTAssert() macro if the method fails (missing reference image, images differ, etc).
@returns YES if the comparison (or saving of the reference image) succeeded.
*/
- (BOOL)compareSnapshotOfView:(UIView *)view
- (BOOL)compareSnapshotOfView:(RCTUIView *)view // TODO(macOS ISS#2323203)
referenceImagesDirectory:(NSString *)referenceImagesDirectory
identifier:(NSString *)identifier
error:(NSError **)errorPtr;

Просмотреть файл

@ -40,7 +40,7 @@
self.snapshotController.recordMode = recordMode;
}
- (BOOL)compareSnapshotOfView:(UIView *)view
- (BOOL)compareSnapshotOfView:(RCTUIView *)view // TODO(macOS ISS#2323203)
referenceImagesDirectory:(NSString *)referenceImagesDirectory
identifier:(NSString *)identifier
error:(NSError **)errorPtr

Просмотреть файл

@ -24,12 +24,12 @@ Pod::Spec.new do |s|
s.homepage = "http://facebook.github.io/react-native/"
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"
s.framework = "XCTest"
s.header_dir = "React"
s.header_dir = "RCTTest"
s.dependency "React-Core", version
end

Просмотреть файл

@ -2,17 +2,6 @@
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string></string>
<key>CFBundleURLSchemes</key>
<array>
<string>rntester</string>
</array>
</dict>
</array>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
@ -27,21 +16,34 @@
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleURLTypes</key>
<array>
<dict>
<key>CFBundleURLName</key>
<string></string>
<key>CFBundleURLSchemes</key>
<array>
<string>rntester</string>
</array>
</dict>
</array>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSAppTransportSecurity</key>
<dict>
<key>NSAllowsArbitraryLoads</key>
<true/>
</dict>
<key>LSMinimumSystemVersion</key>
<string>$(MACOSX_DEPLOYMENT_TARGET)</string>
<key>NSPhotoLibraryUsageDescription</key>
<string>Photo library access needed for some tests.</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2017 Facebook. All rights reserved.</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>NSLocationWhenInUseUsageDescription</key>
<string>true</string>
<key>NSMainStoryboardFile</key>
<string>Main</string>
<key>NSPrincipalClass</key>
<string>NSApplication</string>
</dict>

Просмотреть файл

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>com.apple.security.personal-information.photos-library</key>
<true/>
</dict>
</plist>

Просмотреть файл

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
@ -13,7 +13,7 @@
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleVersion</key>

Просмотреть файл

@ -137,6 +137,8 @@
3578590A1B28D2CF00341EDB /* libRCTLinking.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 357859011B28D2C500341EDB /* libRCTLinking.a */; };
383C517F243447EC00CCBC30 /* UpdatePropertiesExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 272E6B3C1BEA849E001FCF37 /* UpdatePropertiesExampleView.m */; };
383C51A624344A4600CCBC30 /* FlexibleSizeExampleView.m in Sources */ = {isa = PBXBuildFile; fileRef = 27F441E81BEBE5030039B79C /* FlexibleSizeExampleView.m */; };
3860669D24461CDF007E7C32 /* RCTNativeSampleTurboModuleSpec.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C2B71152267DB1A0066069E /* RCTNativeSampleTurboModuleSpec.mm */; };
386066C424461CE3007E7C32 /* RCTSampleTurboModule.mm in Sources */ = {isa = PBXBuildFile; fileRef = 5C2B711A2267DB1A0066069E /* RCTSampleTurboModule.mm */; };
38C500E222D3CF2E00BCD999 /* RCTConvert_UIColorTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 38C500E122D3CF2E00BCD999 /* RCTConvert_UIColorTests.m */; };
39AA31A41DC1DFDC000F7EBB /* RCTUnicodeDecodeTests.m in Sources */ = {isa = PBXBuildFile; fileRef = 39AA31A31DC1DFDC000F7EBB /* RCTUnicodeDecodeTests.m */; };
3D05746D1DE6008900184BB4 /* libRCTPushNotification-tvOS.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3D05746C1DE6008900184BB4 /* libRCTPushNotification-tvOS.a */; };
@ -3129,11 +3131,13 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
3860669D24461CDF007E7C32 /* RCTNativeSampleTurboModuleSpec.mm in Sources */,
18FC77901EF4770B002B3F17 /* ViewController.m in Sources */,
18FC778D1EF4770B002B3F17 /* main.m in Sources */,
18FC778A1EF4770B002B3F17 /* AppDelegate.m in Sources */,
383C51A624344A4600CCBC30 /* FlexibleSizeExampleView.m in Sources */,
383C517F243447EC00CCBC30 /* UpdatePropertiesExampleView.m in Sources */,
386066C424461CE3007E7C32 /* RCTSampleTurboModule.mm in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
};

Просмотреть файл

@ -1,28 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
<string>$(PRODUCT_BUNDLE_IDENTIFIER)</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2016 Facebook. All rights reserved.</string>
<key>NSPrincipalClass</key>
<string></string>
</dict>
</plist>

Просмотреть файл

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
@ -13,11 +13,9 @@
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -0,0 +1,128 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1120"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9F15345A233AB2C4006DFE44"
BuildableName = "RNTester-macOS.app"
BlueprintName = "RNTester-macOS"
ReferencedContainer = "container:RNTesterPods.xcodeproj">
</BuildableReference>
</BuildActionEntry>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "NO"
buildForProfiling = "NO"
buildForArchiving = "NO"
buildForAnalyzing = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9F15346C233AB2C7006DFE44"
BuildableName = "RNTester-macOSUnitTests.xctest"
BlueprintName = "RNTester-macOSUnitTests"
ReferencedContainer = "container:RNTesterPods.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "NO">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9F15345A233AB2C4006DFE44"
BuildableName = "RNTester-macOS.app"
BlueprintName = "RNTester-macOS"
ReferencedContainer = "container:RNTesterPods.xcodeproj">
</BuildableReference>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "CI_USE_PACKAGER"
value = "1"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9F15346C233AB2C7006DFE44"
BuildableName = "RNTester-macOSUnitTests.xctest"
BlueprintName = "RNTester-macOSUnitTests"
ReferencedContainer = "container:RNTesterPods.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9F153477233AB2C7006DFE44"
BuildableName = "RNTester-macOSIntegrationTests.xctest"
BlueprintName = "RNTester-macOSIntegrationTests"
ReferencedContainer = "container:RNTesterPods.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9F15345A233AB2C4006DFE44"
BuildableName = "RNTester-macOS.app"
BlueprintName = "RNTester-macOS"
ReferencedContainer = "container:RNTesterPods.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "9F15345A233AB2C4006DFE44"
BuildableName = "RNTester-macOS.app"
BlueprintName = "RNTester-macOS"
ReferencedContainer = "container:RNTesterPods.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

Просмотреть файл

@ -0,0 +1,114 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1120"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "RNTester.app"
BlueprintName = "RNTester"
ReferencedContainer = "container:RNTesterPods.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "NO">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "RNTester.app"
BlueprintName = "RNTester"
ReferencedContainer = "container:RNTesterPods.xcodeproj">
</BuildableReference>
</MacroExpansion>
<EnvironmentVariables>
<EnvironmentVariable
key = "CI_USE_PACKAGER"
value = "1"
isEnabled = "YES">
</EnvironmentVariable>
</EnvironmentVariables>
<Testables>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "38A937FA244531670025DABB"
BuildableName = "RNTesterUnitTests.xctest"
BlueprintName = "RNTesterUnitTests"
ReferencedContainer = "container:RNTesterPods.xcodeproj">
</BuildableReference>
</TestableReference>
<TestableReference
skipped = "NO">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "38E0B2B524456B0700EF053A"
BuildableName = "RNTesterIntegrationTests.xctest"
BlueprintName = "RNTesterIntegrationTests"
ReferencedContainer = "container:RNTesterPods.xcodeproj">
</BuildableReference>
</TestableReference>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "RNTester.app"
BlueprintName = "RNTester"
ReferencedContainer = "container:RNTesterPods.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<BuildableProductRunnable
runnableDebuggingMode = "0">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "13B07F861A680F5B00A75B9A"
BuildableName = "RNTester.app"
BlueprintName = "RNTester"
ReferencedContainer = "container:RNTesterPods.xcodeproj">
</BuildableReference>
</BuildableProductRunnable>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

Просмотреть файл

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1120"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5101986123ADA0FC00118BF1"
BuildableName = "RNTesterBundle-macOS.bundle"
BlueprintName = "RNTesterBundle-macOS"
ReferencedContainer = "container:RNTesterPods.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "5101986123ADA0FC00118BF1"
BuildableName = "RNTesterBundle-macOS.bundle"
BlueprintName = "RNTesterBundle-macOS"
ReferencedContainer = "container:RNTesterPods.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

Просмотреть файл

@ -0,0 +1,67 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1120"
version = "1.3">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES">
<BuildActionEntries>
<BuildActionEntry
buildForTesting = "YES"
buildForRunning = "YES"
buildForProfiling = "YES"
buildForArchiving = "YES"
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3D13F83D1D6F6AE000E69E0E"
BuildableName = "RNTesterBundle.bundle"
BlueprintName = "RNTesterBundle"
ReferencedContainer = "container:RNTesterPods.xcodeproj">
</BuildableReference>
</BuildActionEntry>
</BuildActionEntries>
</BuildAction>
<TestAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
shouldUseLaunchSchemeArgsEnv = "YES">
<Testables>
</Testables>
</TestAction>
<LaunchAction
buildConfiguration = "Debug"
selectedDebuggerIdentifier = "Xcode.DebuggerFoundation.Debugger.LLDB"
selectedLauncherIdentifier = "Xcode.DebuggerFoundation.Launcher.LLDB"
launchStyle = "0"
useCustomWorkingDirectory = "NO"
ignoresPersistentStateOnLaunch = "NO"
debugDocumentVersioning = "YES"
debugServiceExtension = "internal"
allowLocationSimulation = "YES">
</LaunchAction>
<ProfileAction
buildConfiguration = "Release"
shouldUseLaunchSchemeArgsEnv = "YES"
savedToolIdentifier = ""
useCustomWorkingDirectory = "NO"
debugDocumentVersioning = "YES">
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "3D13F83D1D6F6AE000E69E0E"
BuildableName = "RNTesterBundle.bundle"
BlueprintName = "RNTesterBundle"
ReferencedContainer = "container:RNTesterPods.xcodeproj">
</BuildableReference>
</MacroExpansion>
</ProfileAction>
<AnalyzeAction
buildConfiguration = "Debug">
</AnalyzeAction>
<ArchiveAction
buildConfiguration = "Release"
revealArchiveInOrganizer = "YES">
</ArchiveAction>
</Scheme>

Просмотреть файл

@ -3,7 +3,7 @@
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<string>$(DEVELOPMENT_LANGUAGE)</string>
<key>CFBundleExecutable</key>
<string>$(EXECUTABLE_NAME)</string>
<key>CFBundleIdentifier</key>
@ -13,11 +13,9 @@
<key>CFBundleName</key>
<string>$(PRODUCT_NAME)</string>
<key>CFBundlePackageType</key>
<string>BNDL</string>
<string>$(PRODUCT_BUNDLE_PACKAGE_TYPE)</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
</dict>

Просмотреть файл

@ -9,11 +9,7 @@
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#if !TARGET_OS_OSX // TODO(macOS ISS#2323203), to run Mac tests
#import <RCTTest/RCTTestRunner.h>
#else
#import "../RCTTest/RCTTestRunner.h"
#endif // TODO(macOS ISS#2323203)
#import <React/RCTBridge+Private.h>
#import <React/RCTBridge.h>
#import <React/RCTModuleMethod.h>

Просмотреть файл

@ -8,11 +8,7 @@
#import <XCTest/XCTest.h>
#if !TARGET_OS_OSX // TODO(macOS ISS#2323203), to run Mac tests
#import <RCTTest/RCTTestRunner.h>
#else
#import "../RCTTest/RCTTestRunner.h"
#endif // TODO(macOS ISS#2323203)
#import <React/RCTRootShadowView.h>
#import <React/RCTShadowView.h>
#import <React/RCTUIManager.h>

Просмотреть файл

@ -8,11 +8,7 @@
#import <XCTest/XCTest.h>
#if !TARGET_OS_OSX // TODO(macOS ISS#2323203), to run Mac tests
#import <RCTTest/RCTTestRunner.h>
#else
#import "../RCTTest/RCTTestRunner.h"
#endif // TODO(macOS ISS#2323203)
#import <React/RCTNetworking.h>
#import <React/RCTUtils.h>

Просмотреть файл

@ -10,7 +10,11 @@
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#if __has_include(<React/RCTImageUtils.h>) // TODO(macOS ISS#2323203)
#import <React/RCTImageUtils.h>
#else // [TODO(macOS ISS#2323203)
#import <RCTImage/RCTImageUtils.h>
#endif // ]TODO(macOS ISS#2323203)
#define RCTAssertEqualPoints(a, b) { \
XCTAssertEqual(a.x, b.x); \

Просмотреть файл

@ -9,11 +9,7 @@
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#if !TARGET_OS_OSX // TODO(macOS ISS#2323203), to run Mac tests
#import <RCTTest/RCTTestRunner.h>
#else
#import "../RCTTest/RCTTestRunner.h"
#endif // TODO(macOS ISS#2323203)
#import <React/RCTBridge.h>
#import <React/RCTBridgeModule.h>
#import <React/RCTJavaScriptExecutor.h>

Просмотреть файл

@ -9,11 +9,7 @@
#import <Foundation/Foundation.h>
#import <XCTest/XCTest.h>
#if !TARGET_OS_OSX // TODO(macOS ISS#2323203), to run Mac tests
#import <RCTTest/RCTTestRunner.h>
#else
#import "../RCTTest/RCTTestRunner.h"
#endif // TODO(macOS ISS#2323203)
#import <React/RCTBridge+Private.h>
#import <React/RCTBridge.h>
#import <React/RCTBridgeModule.h>

Просмотреть файл

@ -6,7 +6,7 @@
*
*/
#import <React/RCTUIKit.h>
#import <React/RCTUIKit.h> // TODO(macOS ISS#2323203)
#import <XCTest/XCTest.h>
#import <React/RCTBridgeModule.h>

Просмотреть файл

@ -21,6 +21,7 @@ static const NSTimeInterval FRAME_LENGTH = 1.0 / 60.0;
@end
@implementation RCTFakeDisplayLink
{
NSTimeInterval _timestamp;

Просмотреть файл

@ -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 (
<View>
<Text onPress={this.showActionSheet} style={style.button} ref={this.anchorRef}>
Click to show the ActionSheet
</Text>
<Text>
Clicked button: {this.state.clicked}
</Text>
</View>
);
}
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 (
<View>
<Text onPress={this.showShareActionSheet} style={style.button}>
Click to show the Share ActionSheet
</Text>
<Text>
{this.state.text}
</Text>
</View>
);
}
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<any> { return <ActionSheetExample />; },
},
{
title: 'Show Share Action Sheet',
render(): React.Element<any> {
return <ShareActionSheetExample url="https://code.facebook.com" />;
},
},
{
title: 'Share Local Image',
render(): React.Element<any> {
return <ShareActionSheetExample url="bunny.png" />;
},
},
];

Просмотреть файл

@ -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 <SimpleAlertExampleBlock />;
},
},
{
title: 'Prompt Options',
render(): React.Element<any> {
return <PromptOptions />;
},
},
{
title: 'Prompt Types',
render() {
return (
<View>
<TouchableHighlight
style={styles.wrapper}
onPress={() => AlertMacOS.prompt('Plain Text Entry')}>
<View style={styles.button}>
<Text>
plain-text
</Text>
</View>
</TouchableHighlight>
<TouchableHighlight
style={styles.wrapper}
onPress={() => AlertMacOS.prompt('Secure Text', null, null, 'secure-text')}>
<View style={styles.button}>
<Text>
secure-text
</Text>
</View>
</TouchableHighlight>
<TouchableHighlight
style={styles.wrapper}
onPress={() => AlertMacOS.prompt(
'Login & Password',
null,
null,
'login-password',
[
{default: '', placeholder: 'login'},
{default: '', placeholder: 'Password'},
],
)}>
<View style={styles.button}>
<Text>
login-password
</Text>
</View>
</TouchableHighlight>
</View>
);
},
},
{
title: 'Prompt Presentation',
render() {
return (
<View>
<TouchableHighlight
style={styles.wrapper}
onPress={() => AlertMacOS.prompt(
'Default sheet',
null,
null,
'default',
[
{default: '', placeholder: ''},
],
false
)}>
<View style={styles.button}>
<Text>
Default sheet
</Text>
</View>
</TouchableHighlight>
<TouchableHighlight
style={styles.wrapper}
onPress={() => AlertMacOS.prompt(
'Modal',
null,
null,
'default',
[
{default: '', placeholder: ''},
],
true
)}>
<View style={styles.button}>
<Text>
Modal
</Text>
</View>
</TouchableHighlight>
</View>
);
},
},
{
title: 'Prompt Style',
render() {
return (
<View>
<TouchableHighlight
style={styles.wrapper}
onPress={() => AlertMacOS.prompt(
'Default warning style',
null,
null,
'default'
)}>
<View style={styles.button}>
<Text>
Default warning style
</Text>
</View>
</TouchableHighlight>
<TouchableHighlight
style={styles.wrapper}
onPress={() => AlertMacOS.prompt(
'Critical',
null,
null,
'default',
[
{default: '', placeholder: ''},
],
false,
true)
}>
<View style={styles.button}>
<Text>
Critical
</Text>
</View>
</TouchableHighlight>
</View>
);
},
},
];
class PromptOptions extends React.Component<$FlowFixMeProps, any> {
state: any;
customButtons: Array<Object>;
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 (
<View>
<Text style={{marginBottom: 10}}>
<Text style={{fontWeight: 'bold'}}>Prompt value:</Text> {this.state.promptValue}
</Text>
<TouchableHighlight
style={styles.wrapper}
onPress={() => AlertMacOS.prompt('Type a value', null, this.saveResponse)}>
<View style={styles.button}>
<Text>
prompt with title & callback
</Text>
</View>
</TouchableHighlight>
<TouchableHighlight
style={styles.wrapper}
onPress={() => AlertMacOS.prompt('Type a value', null, this.customButtons)}>
<View style={styles.button}>
<Text>
prompt with title & custom buttons
</Text>
</View>
</TouchableHighlight>
<TouchableHighlight
style={styles.wrapper}
onPress={() => AlertMacOS.prompt(
'Type a value',
null,
this.saveResponse,
undefined,
[
{default: 'Default value', placeholder: ''},
],
)}>
<View style={styles.button}>
<Text>
prompt with title, callback & default inputs
</Text>
</View>
</TouchableHighlight>
<TouchableHighlight
style={styles.wrapper}
onPress={() => AlertMacOS.prompt(
'Type a value',
null,
this.customButtons,
'login-password',
[
{default: 'admin@site.com', placeholder: 'login'},
{default: '', placeholder: 'password'},
],
)}>
<View style={styles.button}>
<Text>
prompt with title, custom buttons, login/password & default inputs
</Text>
</View>
</TouchableHighlight>
</View>
);
}
saveResponse(promptValue) {
this.setState({ promptValue: JSON.stringify(promptValue) });
}
}
var styles = StyleSheet.create({
wrapper: {
borderRadius: 5,
marginBottom: 5,
},
button: {
backgroundColor: '#eeeeee',
padding: 10,
},
});

Просмотреть файл

@ -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 (
<Animated.View // Special animatable View
style={{
opacity: this.state.fadeAnim, // Binds
}}>
{this.props.children}
</Animated.View>
);
}
}
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 (
<View>
<RNTesterButton onPress={() => {
this.setState((state) => (
{show: !state.show}
));
}}>
Press to {this.state.show ?
'Hide' : 'Show'}
</RNTesterButton>
{this.state.show && <FadeInView>
<View style={styles.content}>
<Text>FadeInView</Text>
</View>
</FadeInView>}
</View>
);
}
}
return <FadeInExample />;
},
},
{
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 (
<View>
<RNTesterButton onPress={() => {
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
</RNTesterButton>
{['Composite', 'Easing', 'Animations!'].map(
(text, ii) => (
<Animated.View
key={text}
style={[styles.content, {
left: this.anims[ii],
}]}>
<Text>{text}</Text>
</Animated.View>
)
)}
</View>
);
},
},
{
title: 'Continuous Interactions',
description: 'Gesture events, chaining, 2D ' +
'values, interrupting and transitioning ' +
'animations, etc.',
render: () => (
<Text>Checkout the Gratuitous Animation App!</Text>
),
},
];
var styles = StyleSheet.create({
content: {
backgroundColor: 'deepskyblue',
borderWidth: 1,
borderColor: 'dodgerblue',
padding: 20,
margin: 20,
borderRadius: 10,
alignItems: 'center',
},
});

Просмотреть файл

@ -33,11 +33,17 @@ const ComponentExamples: Array<RNTesterExample> = [
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'),
@ -74,11 +80,11 @@ const ComponentExamples: Array<RNTesterExample> = [
module: require('./MaskedViewExample'),
supportsTVOS: true,
},
/* {
{
key: 'ModalExample',
module: require('./ModalExample'),
supportsTVOS: true,
}, */
},
{
key: 'MultiColumnExample',
module: require('./MultiColumnExample'),
@ -94,11 +100,11 @@ const ComponentExamples: Array<RNTesterExample> = [
module: require('./PickerExample'),
supportsTVOS: false,
},
/* {
{
key: 'PickerIOSExample',
module: require('./PickerIOSExample'),
supportsTVOS: false,
}, */
},
{
key: 'ProgressViewIOSExample',
module: require('./ProgressViewIOSExample'),
@ -139,11 +145,11 @@ const ComponentExamples: Array<RNTesterExample> = [
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,12 +157,14 @@ const ComponentExamples: Array<RNTesterExample> = [
},
{
key: 'TextExample',
module: require('./TextExample.macos'),
/* $FlowFixMe allow macOS to share iOS test */
module: require('./TextExample.ios'),
supportsTVOS: true,
},
{
key: 'TextInputExample',
module: require('./TextInputExample.macos'),
/* $FlowFixMe allow macOS to share iOS test */
module: require('./TextInputExample.ios'),
supportsTVOS: true,
},
{
@ -189,17 +197,17 @@ const APIExamples: Array<RNTesterExample> = [
},
{
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 +216,8 @@ const APIExamples: Array<RNTesterExample> = [
supportsTVOS: true,
},
{
key: 'AlertMacOSExample',
module: require('./AlertMacOSExample'),
key: 'AppStateExample',
module: require('./AppStateExample'),
supportsTVOS: true,
},
{
@ -322,7 +330,7 @@ const APIExamples: Array<RNTesterExample> = [
module: require('./TransformExample'),
supportsTVOS: true,
},
/* {
{
key: 'TurboModuleExample',
module: require('./TurboModuleExample'),
supportsTVOS: false,
@ -336,17 +344,17 @@ const APIExamples: Array<RNTesterExample> = [
key: 'VibrationExample',
module: require('./VibrationExample'),
supportsTVOS: false,
}, */
},
{
key: 'WebSocketExample',
module: require('./WebSocketExample'),
supportsTVOS: true,
},
/* {
{
key: 'XHRExample',
module: require('./XHRExample'),
supportsTVOS: true,
}, */
},
];
const Modules = {};

Просмотреть файл

@ -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 (
<View style={{direction: isRTL ? 'rtl' : 'ltr'}}>
<Text>auto (default) - english LTR</Text>
<Text>
{'\u0623\u062D\u0628 \u0627\u0644\u0644\u063A\u0629 ' +
'\u0627\u0644\u0639\u0631\u0628\u064A\u0629 auto (default) - arabic RTL'}
</Text>
<Text style={{textAlign: 'left'}}>
left left left left left left left left left left left left left left
left
</Text>
<Text style={{textAlign: 'center'}}>
center center center center center center center center center center
center
</Text>
<Text style={{textAlign: 'right'}}>
right right right right right right right right right right right
right right
</Text>
<Text style={{textAlign: 'justify'}}>
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.
</Text>
<Button
onPress={toggleRTL}
title={`Switch to ${isRTL ? 'LTR' : 'RTL'}`}
/>
</View>
);
}
}
class Entity extends React.Component<$FlowFixMeProps> {
render() {
return (
<Text style={{fontWeight: '500', color: '#527fe4'}}>
{this.props.children}
</Text>
);
}
}
class AttributeToggler extends React.Component<{}, $FlowFixMeState> {
state = {fontWeight: 'bold', fontSize: 15};
toggleWeight = () => {
this.setState({
fontWeight: this.state.fontWeight === 'bold' ? 'normal' : 'bold',
});
};
increaseSize = () => {
this.setState({
fontSize: this.state.fontSize + 1,
});
};
render() {
var curStyle = {
fontWeight: this.state.fontWeight,
fontSize: this.state.fontSize,
};
return (
<View>
<Text style={curStyle}>
Tap the controls below to change attributes.
</Text>
<Text>
<Text>
See how it will even work on{' '}
<Text style={curStyle}>this nested text</Text>
</Text>
</Text>
<Text
style={{backgroundColor: '#ffaaaa', marginTop: 5}}
onPress={this.toggleWeight}>
Toggle Weight
</Text>
<Text
style={{backgroundColor: '#aaaaff', marginTop: 5}}
onPress={this.increaseSize}>
Increase Size
</Text>
</View>
);
}
}
var AdjustingFontSize = createReactClass({
displayName: 'AdjustingFontSize',
getInitialState: function() {
return {dynamicText: '', shouldRender: true};
},
reset: function() {
LayoutAnimation.easeInEaseOut();
this.setState({
shouldRender: false,
});
setTimeout(() => {
LayoutAnimation.easeInEaseOut();
this.setState({
dynamicText: '',
shouldRender: true,
});
}, 300);
},
addText: function() {
this.setState({
dynamicText:
this.state.dynamicText +
(Math.floor((Math.random() * 10) % 2) ? ' foo' : ' bar'),
});
},
removeText: function() {
this.setState({
dynamicText: this.state.dynamicText.slice(
0,
this.state.dynamicText.length - 4,
),
});
},
render: function() {
if (!this.state.shouldRender) {
return <View />;
}
return (
<View>
<Text
ellipsizeMode="tail"
numberOfLines={1}
style={{fontSize: 36, marginVertical: 6}}>
Truncated text is baaaaad.
</Text>
<Text
numberOfLines={1}
adjustsFontSizeToFit={true}
style={{fontSize: 40, marginVertical: 6}}>
Shrinking to fit available space is much better!
</Text>
<Text
adjustsFontSizeToFit={true}
numberOfLines={1}
style={{fontSize: 30, marginVertical: 6}}>
{'Add text to me to watch me shrink!' + ' ' + this.state.dynamicText}
</Text>
<Text
adjustsFontSizeToFit={true}
numberOfLines={4}
style={{fontSize: 20, marginVertical: 6}}>
{'Multiline text component shrinking is supported, watch as this reeeeaaaally loooooong teeeeeeext grooooows and then shriiiinks as you add text to me! ioahsdia soady auydoa aoisyd aosdy ' +
' ' +
this.state.dynamicText}
</Text>
<Text
adjustsFontSizeToFit={true}
numberOfLines={1}
style={{marginVertical: 6}}>
<Text style={{fontSize: 14}}>
{'Differently sized nested elements will shrink together. '}
</Text>
<Text style={{fontSize: 20}}>
{'LARGE TEXT! ' + this.state.dynamicText}
</Text>
</Text>
<View
style={{
flexDirection: 'row',
justifyContent: 'space-around',
marginTop: 5,
marginVertical: 6,
}}>
<Text style={{backgroundColor: '#ffaaaa'}} onPress={this.reset}>
Reset
</Text>
<Text style={{backgroundColor: '#aaaaff'}} onPress={this.removeText}>
Remove Text
</Text>
<Text style={{backgroundColor: '#aaffaa'}} onPress={this.addText}>
Add Text
</Text>
</View>
</View>
);
},
});
class TextBaseLineLayoutExample extends React.Component<*, *> {
render() {
var texts = [];
for (var i = 9; i >= 0; i--) {
texts.push(
<Text key={i} style={{fontSize: 8 + i * 5, backgroundColor: '#eee'}}>
{i}
</Text>,
);
}
const marker = (
<View style={{width: 20, height: 20, backgroundColor: 'gray'}} />
);
const subtitleStyle = {fontSize: 16, marginTop: 8, fontWeight: 'bold'};
return (
<View>
<Text style={subtitleStyle}>{'Nested <Text/>s:'}</Text>
<View style={{flexDirection: 'row', alignItems: 'baseline'}}>
{marker}
<Text>{texts}</Text>
{marker}
</View>
<Text style={subtitleStyle}>{'Array of <Text/>s in <View>:'}</Text>
<View style={{flexDirection: 'row', alignItems: 'baseline'}}>
{marker}
{texts}
{marker}
</View>
<Text style={subtitleStyle}>{'<TextInput/>:'}</Text>
<View style={{flexDirection: 'row', alignItems: 'baseline'}}>
{marker}
<TextInput style={{margin: 0, padding: 0}}>{texts}</TextInput>
{marker}
</View>
<Text style={subtitleStyle}>{'<TextInput multiline/>:'}</Text>
<View style={{flexDirection: 'row', alignItems: 'baseline'}}>
{marker}
<TextInput multiline={true} style={{margin: 0, padding: 0}}>
{texts}
</TextInput>
{marker}
</View>
</View>
);
}
}
exports.title = '<Text>';
exports.description = 'Base component for rendering styled text.';
exports.displayName = 'TextExample';
exports.examples = [
{
title: 'Wrap',
render: function() {
return (
<Text>
The text should wrap if it goes on multiple lines. See, this is going
to the next line.
</Text>
);
},
},
{
title: 'Padding',
render: function() {
return (
<Text style={{padding: 10}}>
This text is indented by 10px padding on all sides.
</Text>
);
},
},
{
title: 'Font Family',
render: function() {
return (
<View>
<Text style={{fontFamily: Platform.isTV ? 'Times' : 'Cochin'}}>
Cochin
</Text>
<Text
style={{
fontFamily: Platform.isTV ? 'Times' : 'Cochin',
fontWeight: 'bold',
}}>
Cochin bold
</Text>
<Text style={{fontFamily: 'Helvetica'}}>Helvetica</Text>
<Text style={{fontFamily: 'Helvetica', fontWeight: 'bold'}}>
Helvetica bold
</Text>
<Text style={{fontFamily: Platform.isTV ? 'Courier' : 'Verdana'}}>
Verdana
</Text>
<Text
style={{
fontFamily: Platform.isTV ? 'Courier' : 'Verdana',
fontWeight: 'bold',
}}>
Verdana bold
</Text>
</View>
);
},
},
{
title: 'Font Size',
render: function() {
return (
<View>
<Text style={{fontSize: 23}}>Size 23</Text>
<Text style={{fontSize: 8}}>Size 8</Text>
</View>
);
},
},
{
title: 'Color',
render: function() {
return (
<View>
<Text style={{color: 'red'}}>Red color</Text>
<Text style={{color: 'blue'}}>Blue color</Text>
</View>
);
},
},
{
title: 'Font Weight',
render: function() {
return (
<View>
<Text style={{fontSize: 20, fontWeight: '100'}}>
Move fast and be ultralight
</Text>
<Text style={{fontSize: 20, fontWeight: '200'}}>
Move fast and be light
</Text>
<Text style={{fontSize: 20, fontWeight: 'normal'}}>
Move fast and be normal
</Text>
<Text style={{fontSize: 20, fontWeight: 'bold'}}>
Move fast and be bold
</Text>
<Text style={{fontSize: 20, fontWeight: '900'}}>
Move fast and be ultrabold
</Text>
</View>
);
},
},
{
title: 'Font Style',
render: function() {
return (
<View>
<Text style={{fontStyle: 'normal'}}>Normal text</Text>
<Text style={{fontStyle: 'italic'}}>Italic text</Text>
</View>
);
},
},
{
title: 'Selectable',
render: function() {
return (
<View>
<Text selectable={true}>
This text is <Text style={{fontWeight: 'bold'}}>selectable</Text> if
you click-and-hold.
</Text>
</View>
);
},
},
{
title: 'Text Decoration',
render: function() {
return (
<View>
<Text
style={{
textDecorationLine: 'underline',
textDecorationStyle: 'solid',
}}>
Solid underline
</Text>
<Text
style={{
textDecorationLine: 'underline',
textDecorationStyle: 'double',
textDecorationColor: '#ff0000',
}}>
Double underline with custom color
</Text>
<Text
style={{
textDecorationLine: 'underline',
textDecorationStyle: 'dashed',
textDecorationColor: '#9CDC40',
}}>
Dashed underline with custom color
</Text>
<Text
style={{
textDecorationLine: 'underline',
textDecorationStyle: 'dotted',
textDecorationColor: 'blue',
}}>
Dotted underline with custom color
</Text>
<Text style={{textDecorationLine: 'none'}}>None textDecoration</Text>
<Text
style={{
textDecorationLine: 'line-through',
textDecorationStyle: 'solid',
}}>
Solid line-through
</Text>
<Text
style={{
textDecorationLine: 'line-through',
textDecorationStyle: 'double',
textDecorationColor: '#ff0000',
}}>
Double line-through with custom color
</Text>
<Text
style={{
textDecorationLine: 'line-through',
textDecorationStyle: 'dashed',
textDecorationColor: '#9CDC40',
}}>
Dashed line-through with custom color
</Text>
<Text
style={{
textDecorationLine: 'line-through',
textDecorationStyle: 'dotted',
textDecorationColor: 'blue',
}}>
Dotted line-through with custom color
</Text>
<Text style={{textDecorationLine: 'underline line-through'}}>
Both underline and line-through
</Text>
</View>
);
},
},
{
title: 'Nested',
description:
'Nested text components will inherit the styles of their ' +
'parents (only backgroundColor is inherited from non-Text parents). ' +
'<Text> only supports other <Text> and raw text (strings) as children.',
render: function() {
return (
<View>
<Text>
(Normal text,
<Text style={{fontWeight: 'bold'}}>
(and bold
<Text style={{fontSize: 11, color: '#527fe4'}}>
(and tiny inherited bold blue)
</Text>
)
</Text>
)
</Text>
<Text style={{opacity: 0.7}}>
(opacity
<Text>
(is inherited
<Text style={{opacity: 0.7}}>
(and accumulated
<Text style={{backgroundColor: '#ffaaaa'}}>
(and also applies to the background)
</Text>
)
</Text>
)
</Text>
)
</Text>
<Text style={{fontSize: 12}}>
<Entity>Entity Name</Entity>
</Text>
</View>
);
},
},
{
title: 'Text Align',
render: function() {
return (
<View>
<Text>auto (default) - english LTR</Text>
<Text>
{'\u0623\u062D\u0628 \u0627\u0644\u0644\u063A\u0629 ' +
'\u0627\u0644\u0639\u0631\u0628\u064A\u0629 auto (default) - arabic ' +
'RTL'}
</Text>
<Text style={{textAlign: 'left'}}>
left left left left left left left left left left left left left
left left
</Text>
<Text style={{textAlign: 'center'}}>
center center center center center center center center center
center center
</Text>
<Text style={{textAlign: 'right'}}>
right right right right right right right right right right right
right right
</Text>
<Text style={{textAlign: 'justify'}}>
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.
</Text>
</View>
);
},
},
{
title: 'Letter Spacing',
render: function() {
return (
<View>
<Text style={{letterSpacing: 0}}>letterSpacing = 0</Text>
<Text style={{letterSpacing: 2, marginTop: 5}}>
letterSpacing = 2
</Text>
<Text style={{letterSpacing: 9, marginTop: 5}}>
letterSpacing = 9
</Text>
<View style={{flexDirection: 'row'}}>
<Text
style={{
fontSize: 12,
letterSpacing: 2,
backgroundColor: 'fuchsia',
marginTop: 5,
}}>
With size and background color
</Text>
</View>
<Text style={{letterSpacing: -1, marginTop: 5}}>
letterSpacing = -1
</Text>
<Text
style={{
letterSpacing: 3,
backgroundColor: '#dddddd',
marginTop: 5,
}}>
[letterSpacing = 3]
<Text style={{letterSpacing: 0, backgroundColor: '#bbbbbb'}}>
[Nested letterSpacing = 0]
</Text>
<Text style={{letterSpacing: 6, backgroundColor: '#eeeeee'}}>
[Nested letterSpacing = 6]
</Text>
</Text>
</View>
);
},
},
{
title: 'Spaces',
render: function() {
return (
<Text>
A {'generated'} {'string'} and some &nbsp;&nbsp;&nbsp; spaces
</Text>
);
},
},
{
title: 'Line Height',
render: function() {
return (
<Text>
<Text style={{lineHeight: 35}}>
A lot of space between the lines of this long passage that should
wrap once.
</Text>
</Text>
);
},
},
{
title: 'Empty Text',
description: "It's ok to have Text with zero or null children.",
render: function() {
return <Text />;
},
},
{
title: 'Toggling Attributes',
render: function(): React.Element<any> {
return <AttributeToggler />;
},
},
{
title: 'backgroundColor attribute',
description: 'backgroundColor is inherited from all types of views.',
render: function() {
return (
<Text style={{backgroundColor: 'yellow'}}>
Yellow container background,
<Text style={{backgroundColor: '#ffaaaa'}}>
{' '}
red background,
<Text style={{backgroundColor: '#aaaaff'}}>
{' '}
blue background,
<Text>
{' '}
inherited blue background,
<Text style={{backgroundColor: '#aaffaa'}}>
{' '}
nested green background.
</Text>
</Text>
</Text>
</Text>
</Text>
);
},
},
{
title: 'numberOfLines attribute',
render: function() {
return (
<View>
<Text numberOfLines={1}>
Maximum of one line, no matter how much I write here. If I keep
writing, it{"'"}ll just truncate after one line.
</Text>
<Text numberOfLines={2} style={{marginTop: 20}}>
Maximum of two lines, no matter how much I write here. If I keep
writing, it{"'"}ll just truncate after two lines.
</Text>
<Text style={{marginTop: 20}}>
No maximum lines specified, no matter how much I write here. If I
keep writing, it{"'"}ll just keep going and going.
</Text>
</View>
);
},
},
{
title: 'Text highlighting (tap the link to see highlight)',
render: function() {
return (
<View>
<Text>
Lorem ipsum dolor sit amet,{' '}
<Text
suppressHighlighting={false}
style={{
backgroundColor: 'white',
textDecorationLine: 'underline',
color: 'blue',
}}
onPress={() => null}>
consectetur adipiscing elit, sed do eiusmod tempor incididunt ut
labore et dolore magna aliqua. Ut enim ad minim veniam, quis
nostrud
</Text>{' '}
exercitation ullamco laboris nisi ut aliquip ex ea commodo
consequat.
</Text>
</View>
);
},
},
{
title: 'allowFontScaling attribute',
render: function() {
return (
<View>
<Text>
By default, text will respect Text Size accessibility setting on
iOS. It means that all font sizes will be increased or descreased
depending on the value of Text Size setting in{' '}
<Text style={{fontWeight: 'bold'}}>
Settings.app - Display & Brightness - Text Size
</Text>
</Text>
<Text style={{marginTop: 10}}>
You can disable scaling for your Text component by passing {'"'}
allowFontScaling={'{'}false{'}"'} prop.
</Text>
<Text allowFontScaling={false} style={{marginTop: 20}}>
This text will not scale.
</Text>
</View>
);
},
},
{
title: 'Text shadow',
render: function() {
return (
<View>
<Text
style={{
fontSize: 20,
textShadowOffset: {width: 2, height: 2},
textShadowRadius: 1,
textShadowColor: '#00cccc',
}}>
Demo text shadow
</Text>
</View>
);
},
},
{
title: 'Ellipsize mode',
render: function() {
return (
<View>
<Text numberOfLines={1}>
This very long text should be truncated with dots in the end.
</Text>
<Text ellipsizeMode="middle" numberOfLines={1}>
This very long text should be truncated with dots in the middle.
</Text>
<Text ellipsizeMode="head" numberOfLines={1}>
This very long text should be truncated with dots in the beginning.
</Text>
<Text ellipsizeMode="clip" numberOfLines={1}>
This very looooooooooooooooooooooooooooong text should be clipped.
</Text>
</View>
);
},
},
{
title: 'Font variants',
render: function() {
return (
<View>
<Text style={{fontVariant: ['small-caps']}}>Small Caps{'\n'}</Text>
<Text
style={{
fontFamily: Platform.isTV ? 'Times' : 'Hoefler Text',
fontVariant: ['oldstyle-nums'],
}}>
Old Style nums 0123456789{'\n'}
</Text>
<Text
style={{
fontFamily: Platform.isTV ? 'Times' : 'Hoefler Text',
fontVariant: ['lining-nums'],
}}>
Lining nums 0123456789{'\n'}
</Text>
<Text style={{fontVariant: ['tabular-nums']}}>
Tabular nums{'\n'}
1111{'\n'}
2222{'\n'}
</Text>
<Text style={{fontVariant: ['proportional-nums']}}>
Proportional nums{'\n'}
1111{'\n'}
2222{'\n'}
</Text>
</View>
);
},
},
{
title: 'Dynamic Font Size Adjustment',
render: function(): React.Element<any> {
return <AdjustingFontSize />;
},
},
{
title: 'Text Align with RTL',
render: function() {
return <TextAlignRTLExample />;
},
},
{
title: "Text `alignItems: 'baseline'` style",
render: function() {
return <TextBaseLineLayoutExample />;
},
},
/* Text textTransform not supported on macOS
{
title: 'Transform',
render: function() {
return (
<View>
<Text style={{textTransform: 'uppercase'}}>
This text should be uppercased.
</Text>
<Text style={{textTransform: 'lowercase'}}>
This TEXT SHOULD be lowercased.
</Text>
<Text style={{textTransform: 'capitalize'}}>
This text should be CAPITALIZED.
</Text>
<Text style={{textTransform: 'capitalize'}}>
Mixed: <Text style={{textTransform: 'uppercase'}}>uppercase </Text>
<Text style={{textTransform: 'lowercase'}}>LoWeRcAsE </Text>
<Text style={{textTransform: 'capitalize'}}>
capitalize each word
</Text>
</Text>
<Text>
Should be "ABC":
<Text style={{textTransform: 'uppercase'}}>
a<Text>b</Text>c
</Text>
</Text>
<Text>
Should be "AbC":
<Text style={{textTransform: 'uppercase'}}>
a<Text style={{textTransform: 'none'}}>b</Text>c
</Text>
</Text>
</View>
);
},
},
*/
];

Разница между файлами не показана из-за своего большого размера Загрузить разницу

Просмотреть файл

@ -361,6 +361,7 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path);
@property (nonatomic, readonly) BOOL canBecomeFirstResponder;
- (BOOL)becomeFirstResponder;
@property(nonatomic, readonly) BOOL isFirstResponder;
@property (nonatomic, getter=isUserInteractionEnabled) BOOL userInteractionEnabled;
@ -372,6 +373,7 @@ CGPathRef UIBezierPathCreateCGPathRef(UIBezierPath *path);
- (void)didMoveToWindow;
- (void)setNeedsLayout;
- (void)layoutIfNeeded;
- (void)layoutSubviews;

Просмотреть файл

@ -256,6 +256,10 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
return [self canBecomeFirstResponder];
}
- (BOOL)isFirstResponder {
return [[self window] firstResponder] == self;
}
- (void)viewDidMoveToWindow
{
[self didMoveToWindow];
@ -372,6 +376,13 @@ static RCTUIView *RCTUIViewCommonInit(RCTUIView *self)
self.needsLayout = YES;
}
- (void)layoutIfNeeded
{
if ([self needsLayout]) {
[self layout];
}
}
- (void)layoutSubviews
{
[super layout];

Просмотреть файл

@ -104,7 +104,7 @@ RCT_EXPORT_VIEW_PROPERTY(minimumTrackTintColor, UIColor);
RCT_EXPORT_VIEW_PROPERTY(maximumTrackTintColor, UIColor);
RCT_EXPORT_VIEW_PROPERTY(onValueChange, RCTBubblingEventBlock);
RCT_EXPORT_VIEW_PROPERTY(onSlidingComplete, RCTDirectEventBlock);
RCT_EXPORT_VIEW_PROPERTY(thumbTintColor, UIColor);
RCT_EXPORT_NOT_OSX_VIEW_PROPERTY(thumbTintColor, UIColor); // TODO(macOS ISS#2323203)
RCT_EXPORT_VIEW_PROPERTY(thumbImage, UIImage);
RCT_CUSTOM_VIEW_PROPERTY(disabled, BOOL, RCTSlider)
{

Просмотреть файл

@ -7,7 +7,7 @@
#import "RCTSampleTurboModule.h"
#import <UIKit/UIKit.h>
#import <React/RCTUIKit.h> // TODO(macOS ISS#2323203)
#ifdef RN_TURBO_MODULE_ENABLED
using namespace facebook::react;
@ -53,8 +53,13 @@ RCT_EXPORT_MODULE()
- (NSDictionary *)getConstants
{
#if !TARGET_OS_OSX // TODO(macOS ISS#2323203)
UIScreen *mainScreen = UIScreen.mainScreen;
CGSize screenSize = mainScreen.bounds.size;
#else // [TODO(macOS ISS#2323203)
NSScreen *mainScreen = NSScreen.mainScreen;
CGSize screenSize = mainScreen.frame.size;
#endif // ]TODO(macOS ISS#2323203)
return @{
@"const1": @YES,

Просмотреть файл

@ -19,8 +19,8 @@ function createDir(destPath) {
/**
* @todo Move this upstream to @react-native-community/cli
*
* @param {string} templatePath
* @param {Record<string, string>} replacements
* @param {string} templatePath
* @param {Record<string, string>} replacements
*/
function replaceInPath(templatePath, replacements) {
let result = templatePath;
@ -59,7 +59,7 @@ function copyAndReplaceWithChangedCallback(srcPath, destRoot, relativeDestPath,
* @param {string} destPath
* @param {string} relativeDestDir
* @param {Record<string, string>} replacements
* @param {boolean} alwaysOverwrite
* @param {boolean} alwaysOverwrite
*/
function copyAndReplaceAll(srcPath, destPath, relativeDestDir, replacements, alwaysOverwrite) {
walk(srcPath).forEach(absoluteSrcFilePath => {

Просмотреть файл

@ -19,7 +19,7 @@ const oldProjectName = 'HelloWorld';
* @param {string} srcRootPath
* @param {string} destPath
* @param {string} newProjectName
* @param {{ overwrite?: boolean }} options
* @param {{ overwrite?: boolean }} options
*/
function copyProjectTemplateAndReplace(
srcRootPath,
@ -75,16 +75,16 @@ function copyProjectTemplateAndReplace(
}
/**
* @param {string} basename
* @param {"iOS" | "macOS"} platform
* @param {string} basename
* @param {"iOS" | "macOS"} platform
*/
function projectName(basename, platform) {
return basename + '-' + platform;
}
/**
* @param {string} basename
* @param {"iOS" | "macOS"} platform
* @param {string} basename
* @param {"iOS" | "macOS"} platform
*/
function srcDirPath(basename, platform) {
return path.join(macOSDir, projectName(basename, platform));
@ -120,7 +120,7 @@ function schemesPath(basename) {
/**
* @param {string} basename
* @param {"iOS" | "macOS"} platform
* @param {"iOS" | "macOS"} platform
*/
function schemePath(basename, platform) {
return path.join(schemesPath(basename), projectName(basename, platform) + '.xcscheme');