mirror of
https://github.com/facebook/react-native.git
synced 2025-11-01 09:14:26 +00:00
Compare commits
28
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
1eb7d4aef7 | ||
|
|
4481d09865 | ||
|
|
ed237b4792 | ||
|
|
5c09b3fb5b | ||
|
|
2ba3ef5b19 | ||
|
|
52129b235a | ||
|
|
eb85d1dbd1 | ||
|
|
fffa4d1ae6 | ||
|
|
15f2413be6 | ||
|
|
d823aef9ee | ||
|
|
d8a0a9b1d0 | ||
|
|
a99676ed6c | ||
|
|
d197e95893 | ||
|
|
cda29d2124 | ||
|
|
e2be26a68f | ||
|
|
9f0f8a5345 | ||
|
|
0117077b95 | ||
|
|
017dc45c62 | ||
|
|
f7d0b83492 | ||
|
|
65003d7436 | ||
|
|
727d755441 | ||
|
|
e79ecb5122 | ||
|
|
9f49f8a0f1 | ||
|
|
68110d4ab3 | ||
|
|
0f5fb5ebc0 | ||
|
|
fb2991e3e7 | ||
|
|
06fedcd32d | ||
|
|
2313d45da9 |
@@ -789,13 +789,15 @@ workflows:
|
||||
run_unit_tests: true
|
||||
requires:
|
||||
- setup_ios
|
||||
- test_ios:
|
||||
name: test_ios_unit_frameworks_hermes
|
||||
use_hermes: true
|
||||
use_frameworks: true
|
||||
run_unit_tests: true
|
||||
requires:
|
||||
- setup_ios
|
||||
# Hermes doesn't support dynamic frameworks right now.
|
||||
# The following configuration will fail.
|
||||
# - test_ios:
|
||||
# name: test_ios_unit_frameworks_hermes
|
||||
# use_hermes: true
|
||||
# use_frameworks: true
|
||||
# run_unit_tests: true
|
||||
# requires:
|
||||
# - setup_ios
|
||||
# - test_ios:
|
||||
# name: test_ios_detox
|
||||
# run_detox_tests: true
|
||||
|
||||
@@ -103,7 +103,6 @@ package-lock.json
|
||||
/Libraries/FBReactNativeSpec/FBReactNativeSpec
|
||||
/packages/react-native-codegen/lib
|
||||
/ReactCommon/fabric/components/rncore/
|
||||
/schema-native-modules.json
|
||||
/schema-rncore.json
|
||||
|
||||
# Visual studio
|
||||
|
||||
@@ -33,6 +33,7 @@ const ActionSheetIOS = {
|
||||
* - `destructiveButtonIndex` (int or array of ints) - index or indices of destructive buttons in `options`
|
||||
* - `title` (string) - a title to show above the action sheet
|
||||
* - `message` (string) - a message to show below the title
|
||||
* - `disabledButtonIndices` (array of numbers) - a list of button indices which should be disabled
|
||||
*
|
||||
* The 'callback' function takes one parameter, the zero-based index
|
||||
* of the selected item.
|
||||
@@ -49,6 +50,7 @@ const ActionSheetIOS = {
|
||||
+anchor?: ?number,
|
||||
+tintColor?: ColorValue | ProcessedColorValue,
|
||||
+userInterfaceStyle?: string,
|
||||
+disabledButtonIndices?: Array<number>,
|
||||
|},
|
||||
callback: (buttonIndex: number) => void,
|
||||
) {
|
||||
|
||||
@@ -25,6 +25,7 @@ export interface Spec extends TurboModule {
|
||||
+anchor?: ?number,
|
||||
+tintColor?: ?number,
|
||||
+userInterfaceStyle?: ?string,
|
||||
+disabledButtonIndices?: Array<number>,
|
||||
|},
|
||||
callback: (buttonIndex: number) => void,
|
||||
) => void;
|
||||
|
||||
@@ -97,13 +97,16 @@ class KeyboardAvoidingView extends React.Component<Props, State> {
|
||||
};
|
||||
|
||||
_onLayout = (event: ViewLayoutEvent) => {
|
||||
const wasFrameNull = this._frame == null;
|
||||
this._frame = event.nativeEvent.layout;
|
||||
if (!this._initialFrameHeight) {
|
||||
// save the initial frame height, before the keyboard is visible
|
||||
this._initialFrameHeight = this._frame.height;
|
||||
}
|
||||
|
||||
this._updateBottomIfNecesarry();
|
||||
if (wasFrameNull) {
|
||||
this._updateBottomIfNecesarry();
|
||||
}
|
||||
};
|
||||
|
||||
_updateBottomIfNecesarry = () => {
|
||||
|
||||
@@ -1,17 +1,17 @@
|
||||
/**
|
||||
* @generated by scripts/bump-oss-version.js
|
||||
*
|
||||
* 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
|
||||
* @generated by scripts/bump-oss-version.js
|
||||
* @flow strict
|
||||
*/
|
||||
|
||||
exports.version = {
|
||||
major: 0,
|
||||
minor: 0,
|
||||
minor: 64,
|
||||
patch: 0,
|
||||
prerelease: null,
|
||||
prerelease: 'rc.2',
|
||||
};
|
||||
|
||||
@@ -9,13 +9,23 @@ package = JSON.parse(File.read(File.join(__dir__, "..", "..", "package.json")))
|
||||
version = package['version']
|
||||
|
||||
source = { :git => 'https://github.com/facebook/react-native.git' }
|
||||
codegen_path_prefix = ".."
|
||||
if version == '1000.0.0'
|
||||
# This is an unpublished version, use the latest commit hash of the react-native repo, which we’re presumably in.
|
||||
source[:commit] = `git rev-parse HEAD`.strip
|
||||
codegen_path_prefix = "packages"
|
||||
else
|
||||
source[:tag] = "v#{version}"
|
||||
end
|
||||
|
||||
react_native_path = File.join(__dir__, "..", "..")
|
||||
srcs_dir = File.join(__dir__, "..")
|
||||
codegen_script_path = File.join(react_native_path, "scripts", "generate-native-modules-specs.sh")
|
||||
codegen_path = File.join(react_native_path, codegen_path_prefix, "react-native-codegen")
|
||||
output_dir = File.join(__dir__, "FBReactNativeSpec")
|
||||
generated_files = [File.join(output_dir, "FBReactNativeSpec.h"), File.join(output_dir, "FBReactNativeSpec-generated.mm")]
|
||||
codegen_command = "CODEGEN_PATH=#{codegen_path} sh '#{codegen_script_path}' | tee \"${SCRIPT_OUTPUT_FILE_0}\""
|
||||
|
||||
folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
|
||||
folly_version = '2020.01.13.00'
|
||||
|
||||
@@ -44,4 +54,13 @@ Pod::Spec.new do |s|
|
||||
s.dependency "React-Core", version
|
||||
s.dependency "React-jsi", version
|
||||
s.dependency "ReactCommon/turbomodule/core", version
|
||||
|
||||
s.prepare_command = "mkdir -p #{output_dir} && touch #{generated_files.reduce() { |str, file| str + " " + file }}"
|
||||
s.script_phase = {
|
||||
:name => 'Generate Native Modules Code',
|
||||
:input_files => [srcs_dir],
|
||||
:output_files => ["$(DERIVED_FILE_DIR)/FBReactNativeSpec-codegen.log"],
|
||||
:script => codegen_command,
|
||||
:execution_position => :before_compile
|
||||
}
|
||||
end
|
||||
|
||||
@@ -12,6 +12,9 @@
|
||||
|
||||
const AppContainer = require('../ReactNative/AppContainer');
|
||||
const I18nManager = require('../ReactNative/I18nManager');
|
||||
import NativeEventEmitter from '../EventEmitter/NativeEventEmitter';
|
||||
import NativeModalManager from './NativeModalManager';
|
||||
const Platform = require('../Utilities/Platform');
|
||||
const React = require('react');
|
||||
const ScrollView = require('../Components/ScrollView/ScrollView');
|
||||
const StyleSheet = require('../StyleSheet/StyleSheet');
|
||||
@@ -26,6 +29,11 @@ import type {DirectEventHandler} from '../Types/CodegenTypes';
|
||||
import {type EventSubscription} from '../vendor/emitter/EventEmitter';
|
||||
import RCTModalHostView from './RCTModalHostViewNativeComponent';
|
||||
|
||||
const ModalEventEmitter =
|
||||
Platform.OS === 'ios' && NativeModalManager != null
|
||||
? new NativeEventEmitter(NativeModalManager)
|
||||
: null;
|
||||
|
||||
/**
|
||||
* The Modal component is a simple way to present content above an enclosing view.
|
||||
*
|
||||
@@ -161,9 +169,22 @@ class Modal extends React.Component<Props> {
|
||||
this._identifier = uniqueModalIdentifier++;
|
||||
}
|
||||
|
||||
componentDidMount() {
|
||||
if (ModalEventEmitter) {
|
||||
this._eventSubscription = ModalEventEmitter.addListener(
|
||||
'modalDismissed',
|
||||
event => {
|
||||
if (event.modalID === this._identifier && this.props.onDismiss) {
|
||||
this.props.onDismiss();
|
||||
}
|
||||
},
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
componentWillUnmount() {
|
||||
if (this.props.onDismiss != null) {
|
||||
this.props.onDismiss();
|
||||
if (this._eventSubscription) {
|
||||
this._eventSubscription.remove();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -15,6 +15,7 @@ import type {HostComponent} from '../Renderer/shims/ReactNativeTypes';
|
||||
import type {
|
||||
WithDefault,
|
||||
DirectEventHandler,
|
||||
BubblingEventHandler,
|
||||
Int32,
|
||||
} from '../Types/CodegenTypes';
|
||||
|
||||
@@ -86,6 +87,14 @@ type NativeProps = $ReadOnly<{|
|
||||
*/
|
||||
onShow?: ?DirectEventHandler<null>,
|
||||
|
||||
/**
|
||||
* The `onDismiss` prop allows passing a function that will be called once
|
||||
* the modal has been dismissed.
|
||||
*
|
||||
* See https://reactnative.dev/docs/modal.html#ondismiss
|
||||
*/
|
||||
onDismiss?: ?BubblingEventHandler<null>,
|
||||
|
||||
/**
|
||||
* Deprecated. Use the `animationType` prop instead.
|
||||
*/
|
||||
|
||||
@@ -21,11 +21,11 @@ NSDictionary* RCTGetReactNativeVersion(void)
|
||||
static dispatch_once_t onceToken;
|
||||
dispatch_once(&onceToken, ^(void){
|
||||
__rnVersion = @{
|
||||
RCTVersionMajor: @(0),
|
||||
RCTVersionMinor: @(0),
|
||||
RCTVersionPatch: @(0),
|
||||
RCTVersionPrerelease: [NSNull null],
|
||||
};
|
||||
RCTVersionMajor: @(0),
|
||||
RCTVersionMinor: @(64),
|
||||
RCTVersionPatch: @(0),
|
||||
RCTVersionPrerelease: @"rc.2",
|
||||
};
|
||||
});
|
||||
return __rnVersion;
|
||||
}
|
||||
|
||||
@@ -73,9 +73,15 @@ RCT_EXPORT_METHOD(showActionSheetWithOptions
|
||||
NSArray<NSString *> *buttons = RCTConvertOptionalVecToArray(options.options(), ^id(NSString *element) {
|
||||
return element;
|
||||
});
|
||||
NSArray<NSNumber *> *disabledButtonIndices;
|
||||
NSInteger cancelButtonIndex =
|
||||
options.cancelButtonIndex() ? [RCTConvert NSInteger:@(*options.cancelButtonIndex())] : -1;
|
||||
NSArray<NSNumber *> *destructiveButtonIndices;
|
||||
if (options.disabledButtonIndices()) {
|
||||
disabledButtonIndices = RCTConvertVecToArray(*options.disabledButtonIndices(), ^id(double element) {
|
||||
return @(element);
|
||||
});
|
||||
}
|
||||
if (options.destructiveButtonIndices()) {
|
||||
destructiveButtonIndices = RCTConvertVecToArray(*options.destructiveButtonIndices(), ^id(double element) {
|
||||
return @(element);
|
||||
@@ -98,6 +104,7 @@ RCT_EXPORT_METHOD(showActionSheetWithOptions
|
||||
@"destructiveButtonIndices" : destructiveButtonIndices,
|
||||
@"anchor" : anchor,
|
||||
@"tintColor" : tintColor,
|
||||
@"disabledButtonIndices" : disabledButtonIndices,
|
||||
});
|
||||
return;
|
||||
}
|
||||
@@ -132,6 +139,17 @@ RCT_EXPORT_METHOD(showActionSheetWithOptions
|
||||
index++;
|
||||
}
|
||||
|
||||
if (disabledButtonIndices) {
|
||||
for (NSNumber *disabledButtonIndex in disabledButtonIndices) {
|
||||
if ([disabledButtonIndex integerValue] < buttons.count) {
|
||||
[alertController.actions[[disabledButtonIndex integerValue]] setEnabled:false];
|
||||
} else {
|
||||
RCTLogError(@"Index %@ from `disabledButtonIndices` is out of bounds. Maximum index value is %@.", @([disabledButtonIndex integerValue]), @(buttons.count - 1));
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
alertController.view.tintColor = tintColor;
|
||||
#if defined(__IPHONE_OS_VERSION_MAX_ALLOWED) && defined(__IPHONE_13_0) && \
|
||||
__IPHONE_OS_VERSION_MAX_ALLOWED >= __IPHONE_13_0
|
||||
|
||||
@@ -10,6 +10,7 @@
|
||||
#import "RCTBridge.h"
|
||||
#import "RCTModalHostView.h"
|
||||
#import "RCTModalHostViewController.h"
|
||||
#import "RCTModalManager.h"
|
||||
#import "RCTShadowView.h"
|
||||
#import "RCTUtils.h"
|
||||
|
||||
@@ -46,8 +47,6 @@ RCT_ENUM_CONVERTER(
|
||||
|
||||
@interface RCTModalHostViewManager () <RCTModalHostViewInteractor>
|
||||
|
||||
@property (nonatomic, copy) dispatch_block_t dismissWaitingBlock;
|
||||
|
||||
@end
|
||||
|
||||
@implementation RCTModalHostViewManager {
|
||||
@@ -79,16 +78,9 @@ RCT_EXPORT_MODULE()
|
||||
if (_presentationBlock) {
|
||||
_presentationBlock([modalHostView reactViewController], viewController, animated, completionBlock);
|
||||
} else {
|
||||
__weak typeof(self) weakself = self;
|
||||
[[modalHostView reactViewController] presentViewController:viewController
|
||||
animated:animated
|
||||
completion:^{
|
||||
!completionBlock ?: completionBlock();
|
||||
__strong typeof(weakself) strongself = weakself;
|
||||
!strongself.dismissWaitingBlock
|
||||
?: strongself.dismissWaitingBlock();
|
||||
strongself.dismissWaitingBlock = nil;
|
||||
}];
|
||||
completion:completionBlock];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,16 +88,15 @@ RCT_EXPORT_MODULE()
|
||||
withViewController:(RCTModalHostViewController *)viewController
|
||||
animated:(BOOL)animated
|
||||
{
|
||||
if (_dismissalBlock) {
|
||||
_dismissalBlock([modalHostView reactViewController], viewController, animated, nil);
|
||||
} else {
|
||||
self.dismissWaitingBlock = ^{
|
||||
[viewController.presentingViewController dismissViewControllerAnimated:animated completion:nil];
|
||||
};
|
||||
if (viewController.presentingViewController) {
|
||||
self.dismissWaitingBlock();
|
||||
self.dismissWaitingBlock = nil;
|
||||
dispatch_block_t completionBlock = ^{
|
||||
if (modalHostView.identifier) {
|
||||
[[self.bridge moduleForClass:[RCTModalManager class]] modalDismissed:modalHostView.identifier];
|
||||
}
|
||||
};
|
||||
if (_dismissalBlock) {
|
||||
_dismissalBlock([modalHostView reactViewController], viewController, animated, completionBlock);
|
||||
} else {
|
||||
[viewController.presentingViewController dismissViewControllerAnimated:animated completion:completionBlock];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#import <UIKit/UIKit.h>
|
||||
|
||||
#import <React/RCTBridgeModule.h>
|
||||
#import <React/RCTEventEmitter.h>
|
||||
|
||||
@interface RCTModalManager : RCTEventEmitter <RCTBridgeModule>
|
||||
|
||||
- (void)modalDismissed:(NSNumber *)modalID;
|
||||
|
||||
@end
|
||||
@@ -0,0 +1,42 @@
|
||||
/*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#import "RCTModalManager.h"
|
||||
|
||||
@interface RCTModalManager ()
|
||||
|
||||
@property BOOL shouldEmit;
|
||||
|
||||
@end
|
||||
|
||||
@implementation RCTModalManager
|
||||
|
||||
RCT_EXPORT_MODULE();
|
||||
|
||||
- (NSArray<NSString *> *)supportedEvents
|
||||
{
|
||||
return @[ @"modalDismissed" ];
|
||||
}
|
||||
|
||||
- (void)startObserving
|
||||
{
|
||||
_shouldEmit = YES;
|
||||
}
|
||||
|
||||
- (void)stopObserving
|
||||
{
|
||||
_shouldEmit = NO;
|
||||
}
|
||||
|
||||
- (void)modalDismissed:(NSNumber *)modalID
|
||||
{
|
||||
if (_shouldEmit) {
|
||||
[self sendEventWithName:@"modalDismissed" body:@{@"modalID" : modalID}];
|
||||
}
|
||||
}
|
||||
|
||||
@end
|
||||
@@ -1,4 +1,4 @@
|
||||
VERSION_NAME=1000.0.0-master
|
||||
VERSION_NAME=0.64.0-rc.2
|
||||
GROUP=com.facebook.react
|
||||
|
||||
POM_NAME=ReactNative
|
||||
|
||||
@@ -73,12 +73,12 @@ if (JavaVersion.current().isJava8Compatible()) {
|
||||
|
||||
afterEvaluate { project ->
|
||||
|
||||
task androidJavadoc(type: Javadoc) {
|
||||
task androidJavadoc(type: Javadoc, dependsOn: generateReleaseBuildConfig) {
|
||||
source = android.sourceSets.main.java.srcDirs
|
||||
classpath += files(android.bootClasspath)
|
||||
classpath += files(project.getConfigurations().getByName("compile").asList())
|
||||
classpath += files("$buildDir/generated/source/buildConfig/release")
|
||||
include("**/*.java")
|
||||
exclude("**/ReactBuildConfig.java")
|
||||
}
|
||||
|
||||
task androidJavadocJar(type: Jar, dependsOn: androidJavadoc) {
|
||||
|
||||
+2
-2
@@ -16,7 +16,7 @@ import java.util.Map;
|
||||
public class ReactNativeVersion {
|
||||
public static final Map<String, Object> VERSION = MapBuilder.<String, Object>of(
|
||||
"major", 0,
|
||||
"minor", 0,
|
||||
"minor", 64,
|
||||
"patch", 0,
|
||||
"prerelease", null);
|
||||
"prerelease", "rc.2");
|
||||
}
|
||||
|
||||
+7
@@ -129,6 +129,13 @@ void ModalHostViewEventEmitter::onShow(OnShow event) const {
|
||||
return payload;
|
||||
});
|
||||
}
|
||||
void ModalHostViewEventEmitter::onDismiss(OnDismiss event) const {
|
||||
dispatchEvent("dismiss", [event=std::move(event)](jsi::Runtime &runtime) {
|
||||
auto payload = jsi::Object(runtime);
|
||||
|
||||
return payload;
|
||||
});
|
||||
}
|
||||
void ModalHostViewEventEmitter::onOrientationChange(OnOrientationChange event) const {
|
||||
dispatchEvent("orientationChange", [event=std::move(event)](jsi::Runtime &runtime) {
|
||||
auto payload = jsi::Object(runtime);
|
||||
|
||||
+6
@@ -196,6 +196,10 @@ class ModalHostViewEventEmitter : public ViewEventEmitter {
|
||||
|
||||
};
|
||||
|
||||
struct OnDismiss {
|
||||
|
||||
};
|
||||
|
||||
enum class OnOrientationChangeOrientation {
|
||||
Portrait,
|
||||
Landscape
|
||||
@@ -216,6 +220,8 @@ class ModalHostViewEventEmitter : public ViewEventEmitter {
|
||||
|
||||
void onShow(OnShow value) const;
|
||||
|
||||
void onDismiss(OnDismiss value) const;
|
||||
|
||||
void onOrientationChange(OnOrientationChange value) const;
|
||||
};
|
||||
|
||||
|
||||
@@ -16,9 +16,9 @@ namespace facebook::react {
|
||||
|
||||
constexpr struct {
|
||||
int32_t Major = 0;
|
||||
int32_t Minor = 0;
|
||||
int32_t Minor = 64;
|
||||
int32_t Patch = 0;
|
||||
std::string_view Prerelease = "";
|
||||
std::string_view Prerelease = "rc.2";
|
||||
} ReactNativeVersion;
|
||||
|
||||
} // namespace facebook::react
|
||||
|
||||
@@ -131,7 +131,7 @@ module.exports = {
|
||||
'DatePickerIOS-merged',
|
||||
'DatePickerIOS has been merged with DatePickerAndroid and will be removed in a future release. ' +
|
||||
"It can now be installed and imported from '@react-native-community/datetimepicker' instead of 'react-native'. " +
|
||||
'See https://github.com/react-native-community/datetimepicker',
|
||||
'See https://github.com/react-native-datetimepicker/datetimepicker',
|
||||
);
|
||||
return require('./Libraries/Components/DatePicker/DatePickerIOS');
|
||||
},
|
||||
@@ -158,8 +158,8 @@ module.exports = {
|
||||
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',
|
||||
"It can now be installed and imported from '@react-native-masked-view/masked-view' instead of 'react-native'. " +
|
||||
'See https://github.com/react-native-masked-view/react-native-masked-view',
|
||||
);
|
||||
return require('./Libraries/Components/MaskedView/MaskedViewIOS');
|
||||
},
|
||||
@@ -170,8 +170,8 @@ module.exports = {
|
||||
warnOnce(
|
||||
'picker-moved',
|
||||
'Picker 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/picker' instead of 'react-native'. " +
|
||||
'See https://github.com/react-native-community/react-native-picker',
|
||||
"It can now be installed and imported from '@react-native-picker/picker' instead of 'react-native'. " +
|
||||
'See https://github.com/react-native-picker/react-native-picker',
|
||||
);
|
||||
return require('./Libraries/Components/Picker/Picker');
|
||||
},
|
||||
@@ -180,8 +180,8 @@ module.exports = {
|
||||
warnOnce(
|
||||
'pickerios-moved',
|
||||
'PickerIOS 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/picker' instead of 'react-native'. " +
|
||||
'See https://github.com/react-native-community/react-native-picker',
|
||||
"It can now be installed and imported from '@react-native-picker/picker' instead of 'react-native'. " +
|
||||
'See https://github.com/react-native-picker/react-native-picker',
|
||||
);
|
||||
return require('./Libraries/Components/Picker/PickerIOS');
|
||||
},
|
||||
@@ -194,7 +194,7 @@ module.exports = {
|
||||
'progress-bar-android-moved',
|
||||
'ProgressBarAndroid 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/progress-bar-android' instead of 'react-native'. " +
|
||||
'See https://github.com/react-native-community/progress-bar-android',
|
||||
'See https://github.com/react-native-progress-view/progress-bar-android',
|
||||
);
|
||||
return require('./Libraries/Components/ProgressBarAndroid/ProgressBarAndroid');
|
||||
},
|
||||
@@ -204,7 +204,7 @@ module.exports = {
|
||||
'progress-view-ios-moved',
|
||||
'ProgressViewIOS 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/progress-view' instead of 'react-native'. " +
|
||||
'See https://github.com/react-native-community/progress-view',
|
||||
'See https://github.com/react-native-progress-view/progress-view',
|
||||
);
|
||||
return require('./Libraries/Components/ProgressViewIOS/ProgressViewIOS');
|
||||
},
|
||||
@@ -226,7 +226,7 @@ module.exports = {
|
||||
'segmented-control-ios-moved',
|
||||
'SegmentedControlIOS 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/segmented-control' instead of 'react-native'. " +
|
||||
'See https://github.com/react-native-community/segmented-control',
|
||||
'See https://github.com/react-native-segmented-control/segmented-control',
|
||||
);
|
||||
return require('./Libraries/Components/SegmentedControlIOS/SegmentedControlIOS');
|
||||
},
|
||||
@@ -235,7 +235,7 @@ module.exports = {
|
||||
'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',
|
||||
'See https://github.com/callstack/react-native-slider',
|
||||
);
|
||||
return require('./Libraries/Components/Slider/Slider');
|
||||
},
|
||||
@@ -300,8 +300,8 @@ module.exports = {
|
||||
warnOnce(
|
||||
'async-storage-moved',
|
||||
'AsyncStorage 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/async-storage',
|
||||
"It can now be installed and imported from '@react-native-async-storage/async-storage' instead of 'react-native'. " +
|
||||
'See https://github.com/react-native-async-storage/async-storage',
|
||||
);
|
||||
return require('./Libraries/Storage/AsyncStorage');
|
||||
},
|
||||
@@ -313,7 +313,7 @@ module.exports = {
|
||||
'clipboard-moved',
|
||||
'Clipboard 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/clipboard' instead of 'react-native'. " +
|
||||
'See https://github.com/react-native-community/clipboard',
|
||||
'See https://github.com/react-native-clipboard/clipboard',
|
||||
);
|
||||
return require('./Libraries/Components/Clipboard/Clipboard');
|
||||
},
|
||||
@@ -322,7 +322,7 @@ module.exports = {
|
||||
'DatePickerAndroid-merged',
|
||||
'DatePickerAndroid has been merged with DatePickerIOS and will be removed in a future release. ' +
|
||||
"It can now be installed and imported from '@react-native-community/datetimepicker' instead of 'react-native'. " +
|
||||
'See https://github.com/react-native-community/datetimepicker',
|
||||
'See https://github.com/react-native-datetimepicker/datetimepicker',
|
||||
);
|
||||
return require('./Libraries/Components/DatePickerAndroid/DatePickerAndroid');
|
||||
},
|
||||
@@ -350,7 +350,7 @@ module.exports = {
|
||||
'ImagePickerIOS has been extracted from react-native core and will be removed in a future release. ' +
|
||||
"Please upgrade to use either '@react-native-community/react-native-image-picker' or 'expo-image-picker'. " +
|
||||
"If you cannot upgrade to a different library, please install the deprecated '@react-native-community/image-picker-ios' package. " +
|
||||
'See https://github.com/react-native-community/react-native-image-picker-ios',
|
||||
'See https://github.com/rnc-archive/react-native-image-picker-ios',
|
||||
);
|
||||
return require('./Libraries/Image/ImagePickerIOS');
|
||||
},
|
||||
@@ -393,7 +393,7 @@ module.exports = {
|
||||
'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/push-notification-ios',
|
||||
'See https://github.com/react-native-push-notification-ios/push-notification-ios',
|
||||
);
|
||||
return require('./Libraries/PushNotificationIOS/PushNotificationIOS');
|
||||
},
|
||||
@@ -512,7 +512,7 @@ if (__DEV__) {
|
||||
false,
|
||||
'ART has been removed from React Native. ' +
|
||||
"It can now be installed and imported from '@react-native-community/art' instead of 'react-native'. " +
|
||||
'See https://github.com/react-native-community/art',
|
||||
'See https://github.com/react-native-art/art',
|
||||
);
|
||||
},
|
||||
});
|
||||
@@ -551,7 +551,7 @@ if (__DEV__) {
|
||||
false,
|
||||
'WebView has been removed from React Native. ' +
|
||||
"It can now be installed and imported from 'react-native-webview' instead of 'react-native'. " +
|
||||
'See https://github.com/react-native-community/react-native-webview',
|
||||
'See https://github.com/react-native-webview/react-native-webview',
|
||||
);
|
||||
},
|
||||
});
|
||||
@@ -564,7 +564,7 @@ if (__DEV__) {
|
||||
false,
|
||||
'NetInfo has been removed from React Native. ' +
|
||||
"It can now be installed and imported from '@react-native-community/netinfo' instead of 'react-native'. " +
|
||||
'See https://github.com/react-native-community/react-native-netinfo',
|
||||
'See https://github.com/react-native-netinfo/react-native-netinfo',
|
||||
);
|
||||
},
|
||||
});
|
||||
@@ -577,7 +577,7 @@ if (__DEV__) {
|
||||
false,
|
||||
'CameraRoll has been removed from React Native. ' +
|
||||
"It can now be installed and imported from '@react-native-community/cameraroll' instead of 'react-native'. " +
|
||||
'See https://github.com/react-native-community/react-native-cameraroll',
|
||||
'See https://github.com/react-native-cameraroll/react-native-cameraroll',
|
||||
);
|
||||
},
|
||||
});
|
||||
@@ -604,7 +604,7 @@ if (__DEV__) {
|
||||
false,
|
||||
'ImageEditor has been removed from React Native. ' +
|
||||
"It can now be installed and imported from '@react-native-community/image-editor' instead of 'react-native'. " +
|
||||
'See https://github.com/react-native-community/react-native-image-editor',
|
||||
'See https://github.com/callstack/react-native-image-editor',
|
||||
);
|
||||
},
|
||||
});
|
||||
@@ -617,7 +617,7 @@ if (__DEV__) {
|
||||
false,
|
||||
'TimePickerAndroid has been removed from React Native. ' +
|
||||
"It can now be installed and imported from '@react-native-community/datetimepicker' instead of 'react-native'. " +
|
||||
'See https://github.com/react-native-community/datetimepicker',
|
||||
'See https://github.com/react-native-datetimepicker/datetimepicker',
|
||||
);
|
||||
},
|
||||
});
|
||||
@@ -630,7 +630,7 @@ if (__DEV__) {
|
||||
false,
|
||||
'ToolbarAndroid has been removed from React Native. ' +
|
||||
"It can now be installed and imported from '@react-native-community/toolbar-android' instead of 'react-native'. " +
|
||||
'See https://github.com/react-native-community/toolbar-android',
|
||||
'See https://github.com/react-native-toolbar-android/toolbar-android',
|
||||
);
|
||||
},
|
||||
});
|
||||
@@ -643,7 +643,7 @@ if (__DEV__) {
|
||||
false,
|
||||
'ViewPagerAndroid has been removed from React Native. ' +
|
||||
"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',
|
||||
'See https://github.com/callstack/react-native-viewpager',
|
||||
);
|
||||
},
|
||||
});
|
||||
@@ -656,7 +656,7 @@ if (__DEV__) {
|
||||
false,
|
||||
'CheckBox has been removed from React Native. ' +
|
||||
"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',
|
||||
'See https://github.com/react-native-checkbox/react-native-checkbox',
|
||||
);
|
||||
},
|
||||
});
|
||||
|
||||
+12
-14
@@ -1,7 +1,6 @@
|
||||
{
|
||||
"name": "react-native",
|
||||
"private": true,
|
||||
"version": "1000.0.0",
|
||||
"version": "0.64.0-rc.2",
|
||||
"bin": "./cli.js",
|
||||
"description": "A framework for building native apps using React",
|
||||
"license": "MIT",
|
||||
@@ -17,6 +16,7 @@
|
||||
"!template/node_modules",
|
||||
"!template/package-lock.json",
|
||||
"!template/yarn.lock",
|
||||
"android",
|
||||
"cli.js",
|
||||
"flow",
|
||||
"flow-typed",
|
||||
@@ -37,6 +37,7 @@
|
||||
"README.md",
|
||||
"rn-get-polyfills.js",
|
||||
"scripts/compose-source-maps.js",
|
||||
"scripts/generate-native-modules-specs.sh",
|
||||
"scripts/generate-native-modules-specs-cli.js",
|
||||
"scripts/ios-configure-glog.sh",
|
||||
"scripts/launchPackager.bat",
|
||||
@@ -77,18 +78,14 @@
|
||||
"test-ios-e2e": "detox test -c ios.sim.release packages/rn-tester/e2e",
|
||||
"test-ios": "./scripts/objc-test.sh test"
|
||||
},
|
||||
"workspaces": [
|
||||
"packages/!(eslint-config-react-native-community)",
|
||||
"repo-config"
|
||||
],
|
||||
"peerDependencies": {
|
||||
"react": "17.0.1"
|
||||
},
|
||||
"dependencies": {
|
||||
"@jest/create-cache-key-function": "^26.5.0",
|
||||
"@react-native-community/cli": "^4.13.0",
|
||||
"@react-native-community/cli-platform-android": "^4.13.0",
|
||||
"@react-native-community/cli-platform-ios": "^4.13.0",
|
||||
"@react-native-community/cli": "^5.0.1-alpha.0",
|
||||
"@react-native-community/cli-platform-android": "^5.0.1-alpha.0",
|
||||
"@react-native-community/cli-platform-ios": "^5.0.1-alpha.0",
|
||||
"@react-native/assets": "1.0.0",
|
||||
"@react-native/normalize-color": "1.0.0",
|
||||
"@react-native/polyfills": "1.0.0",
|
||||
@@ -99,10 +96,10 @@
|
||||
"hermes-engine": "~0.7.0",
|
||||
"invariant": "^2.2.4",
|
||||
"jsc-android": "^245459.0.0",
|
||||
"metro-babel-register": "0.63.0",
|
||||
"metro-react-native-babel-transformer": "0.63.0",
|
||||
"metro-runtime": "0.63.0",
|
||||
"metro-source-map": "0.63.0",
|
||||
"metro-babel-register": "0.64.0",
|
||||
"metro-react-native-babel-transformer": "0.64.0",
|
||||
"metro-runtime": "0.64.0",
|
||||
"metro-source-map": "0.64.0",
|
||||
"nullthrows": "^1.1.1",
|
||||
"pretty-format": "^26.5.2",
|
||||
"promise": "^8.0.3",
|
||||
@@ -111,6 +108,7 @@
|
||||
"react-refresh": "^0.4.0",
|
||||
"regenerator-runtime": "^0.13.2",
|
||||
"scheduler": "^0.20.1",
|
||||
"shelljs": "^0.8.4",
|
||||
"stacktrace-parser": "^0.1.3",
|
||||
"use-subscription": "^1.0.0",
|
||||
"whatwg-fetch": "^3.0.0",
|
||||
@@ -157,4 +155,4 @@
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,6 @@
|
||||
{
|
||||
"name": "react-native-codegen",
|
||||
"version": "0.0.5",
|
||||
"version": "0.0.6",
|
||||
"description": "⚛️ Code generation tools for React Native",
|
||||
"homepage": "https://github.com/facebook/react-native/tree/master/packages/react-native-codegen",
|
||||
"repository": {
|
||||
|
||||
@@ -11,9 +11,41 @@ THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOUR
|
||||
set -e
|
||||
set -u
|
||||
|
||||
pushd "$THIS_DIR/../.." >/dev/null
|
||||
CODEGEN_DIR="$THIS_DIR/../.."
|
||||
|
||||
yarn install 2> >(grep -v '^warning' 1>&2)
|
||||
yarn run build
|
||||
rm -rf "${CODEGEN_DIR:?}/lib" "${CODEGEN_DIR:?}/node_modules"
|
||||
|
||||
popd >/dev/null
|
||||
# Fallback to npm if yarn is not available
|
||||
if [ -x "$(command -v yarn)" ]; then
|
||||
YARN_OR_NPM=$(command -v yarn)
|
||||
else
|
||||
YARN_OR_NPM=$(command -v npm)
|
||||
fi
|
||||
YARN_BINARY="${YARN_BINARY:-$YARN_OR_NPM}"
|
||||
|
||||
if [[ ${FBSOURCE_ENV:-0} -eq 1 ]]; then
|
||||
# Custom FB-specific setup
|
||||
pushd "$CODEGEN_DIR" >/dev/null
|
||||
|
||||
"$YARN_BINARY" install 2> >(grep -v '^warning' 1>&2)
|
||||
# Note: Within FBSOURCE_ENV, this has to explicitly run build.
|
||||
"$YARN_BINARY" run build
|
||||
|
||||
popd >/dev/null
|
||||
else
|
||||
# Run yarn install in a separate tmp dir to avoid conflict with the rest of the repo.
|
||||
# Note: OSS-only.
|
||||
TMP_DIR=$(mktemp -d)
|
||||
|
||||
cp -R "$CODEGEN_DIR/." "$TMP_DIR"
|
||||
|
||||
pushd "$TMP_DIR" >/dev/null
|
||||
|
||||
# Note: this automatically runs build as well.
|
||||
"$YARN_BINARY" install 2> >(grep -v '^warning' 1>&2)
|
||||
|
||||
popd >/dev/null
|
||||
|
||||
mv "$TMP_DIR/lib" "$TMP_DIR/node_modules" "$CODEGEN_DIR"
|
||||
rm -rf "$TMP_DIR"
|
||||
fi
|
||||
|
||||
@@ -60,16 +60,6 @@ def frameworks_pre_install(installer)
|
||||
end
|
||||
end
|
||||
|
||||
pre_install do |installer|
|
||||
frameworks_pre_install(installer) if ENV['USE_FRAMEWORKS'] == '1'
|
||||
if ENV['USE_CODEGEN'] != '0'
|
||||
prefix_path = "../.."
|
||||
codegen_path = "../../packages/react-native-codegen"
|
||||
system("(cd #{codegen_path} && yarn install && yarn run build)")
|
||||
codegen_pre_install(installer, {path:prefix_path, codegen_path:codegen_path})
|
||||
end
|
||||
end
|
||||
|
||||
post_install do |installer|
|
||||
flipper_post_install(installer)
|
||||
end
|
||||
|
||||
@@ -15,12 +15,12 @@ PODS:
|
||||
- Flipper-Folly (~> 2.2)
|
||||
- Flipper-RSocket (~> 1.1)
|
||||
- Flipper-DoubleConversion (1.1.7)
|
||||
- Flipper-Folly (2.2.0):
|
||||
- Flipper-Folly (2.3.0):
|
||||
- boost-for-react-native
|
||||
- CocoaLibEvent (~> 1.0)
|
||||
- Flipper-DoubleConversion
|
||||
- Flipper-Glog
|
||||
- OpenSSL-Universal (= 1.0.2.19)
|
||||
- OpenSSL-Universal (= 1.0.2.20)
|
||||
- Flipper-Glog (0.3.6)
|
||||
- Flipper-PeerTalk (0.0.4)
|
||||
- Flipper-RSocket (1.1.0):
|
||||
@@ -58,9 +58,9 @@ PODS:
|
||||
- FlipperKit/Core
|
||||
- FlipperKit/FlipperKitNetworkPlugin
|
||||
- glog (0.3.5)
|
||||
- OpenSSL-Universal (1.0.2.19):
|
||||
- OpenSSL-Universal/Static (= 1.0.2.19)
|
||||
- OpenSSL-Universal/Static (1.0.2.19)
|
||||
- OpenSSL-Universal (1.0.2.20):
|
||||
- OpenSSL-Universal/Static (= 1.0.2.20)
|
||||
- OpenSSL-Universal/Static (1.0.2.20)
|
||||
- RCT-Folly (2020.01.13.00):
|
||||
- boost-for-react-native
|
||||
- DoubleConversion
|
||||
@@ -490,16 +490,16 @@ SPEC CHECKSUMS:
|
||||
CocoaLibEvent: 2fab71b8bd46dd33ddb959f7928ec5909f838e3f
|
||||
DoubleConversion: cde416483dac037923206447da6e1454df403714
|
||||
FBLazyVector: fe973c09b2299b5e8154186ecf1f6554b4f70987
|
||||
FBReactNativeSpec: 20a9345af9157362b51ab0258d842cb7bb347d19
|
||||
FBReactNativeSpec: 77f376d6af8c6348f0cc6de9a96c7a288f4e03ab
|
||||
Flipper: be611d4b742d8c87fbae2ca5f44603a02539e365
|
||||
Flipper-DoubleConversion: 38631e41ef4f9b12861c67d17cb5518d06badc41
|
||||
Flipper-Folly: c12092ea368353b58e992843a990a3225d4533c3
|
||||
Flipper-Folly: e4493b013c02d9347d5e0cb4d128680239f6c78a
|
||||
Flipper-Glog: 1dfd6abf1e922806c52ceb8701a3599a79a200a6
|
||||
Flipper-PeerTalk: 116d8f857dc6ef55c7a5a75ea3ceaafe878aadc9
|
||||
Flipper-RSocket: 64e7431a55835eb953b0bf984ef3b90ae9fdddd7
|
||||
FlipperKit: ab353d41aea8aae2ea6daaf813e67496642f3d7d
|
||||
glog: 40a13f7840415b9a77023fbcae0f1e6f43192af3
|
||||
OpenSSL-Universal: 8b48cc0d10c1b2923617dfe5c178aa9ed2689355
|
||||
OpenSSL-Universal: ff34003318d5e1163e9529b08470708e389ffcdd
|
||||
RCT-Folly: b39288cedafe50da43317ec7d91bcc8cc0abbf33
|
||||
RCTRequired: d3d4ce60e1e2282864d7560340690a3c8c646de1
|
||||
RCTTypeSafety: 4da4f9f218727257c50fd3bf2683a06cdb4fede3
|
||||
@@ -528,6 +528,6 @@ SPEC CHECKSUMS:
|
||||
Yoga: 69ef0b2bba5387523f793957a9f80dbd61e89631
|
||||
YogaKit: f782866e155069a2cca2517aafea43200b01fd5a
|
||||
|
||||
PODFILE CHECKSUM: 497dba59a3312b3cb22d518b96672409db90460d
|
||||
PODFILE CHECKSUM: 3adfe268d800503789170d1862bde422ee204fe8
|
||||
|
||||
COCOAPODS: 1.10.0
|
||||
|
||||
@@ -25,6 +25,7 @@ const ScreenshotManager = NativeModules.ScreenshotManager;
|
||||
const BUTTONS = ['Option 0', 'Option 1', 'Option 2', 'Delete', 'Cancel'];
|
||||
const DESTRUCTIVE_INDEX = 3;
|
||||
const CANCEL_INDEX = 4;
|
||||
const DISABLED_BUTTON_INDICES = [1, 2];
|
||||
|
||||
type Props = $ReadOnly<{||}>;
|
||||
type State = {|clicked: string|};
|
||||
@@ -138,6 +139,37 @@ class ActionSheetAnchorExample extends React.Component<
|
||||
};
|
||||
}
|
||||
|
||||
class ActionSheetDisabledExample extends React.Component<Props, State> {
|
||||
state = {
|
||||
clicked: 'none',
|
||||
};
|
||||
|
||||
render() {
|
||||
return (
|
||||
<View>
|
||||
<Text onPress={this.showActionSheet} style={style.button}>
|
||||
Click to show the ActionSheet
|
||||
</Text>
|
||||
<Text>Clicked button: {this.state.clicked}</Text>
|
||||
</View>
|
||||
);
|
||||
}
|
||||
|
||||
showActionSheet = () => {
|
||||
ActionSheetIOS.showActionSheetWithOptions(
|
||||
{
|
||||
options: BUTTONS,
|
||||
cancelButtonIndex: CANCEL_INDEX,
|
||||
destructiveButtonIndex: DESTRUCTIVE_INDEX,
|
||||
disabledButtonIndices: DISABLED_BUTTON_INDICES,
|
||||
},
|
||||
buttonIndex => {
|
||||
this.setState({clicked: BUTTONS[buttonIndex]});
|
||||
},
|
||||
);
|
||||
};
|
||||
}
|
||||
|
||||
class ShareActionSheetExample extends React.Component<
|
||||
$FlowFixMeProps,
|
||||
$FlowFixMeState,
|
||||
@@ -316,6 +348,12 @@ exports.examples = [
|
||||
return <ActionSheetAnchorExample />;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Show Action Sheet with disabled buttons',
|
||||
render(): React.Element<any> {
|
||||
return <ActionSheetDisabledExample />;
|
||||
},
|
||||
},
|
||||
{
|
||||
title: 'Show Share Action Sheet',
|
||||
render(): React.Element<any> {
|
||||
|
||||
@@ -4,54 +4,76 @@
|
||||
# This source code is licensed under the MIT license found in the
|
||||
# LICENSE file in the root directory of this source tree.
|
||||
|
||||
# This script collects the JavaScript spec definitions for native
|
||||
# modules, then uses react-native-codegen to generate native code.
|
||||
# The script will copy the generated code to the final location by
|
||||
# default. Optionally, call the script with a path to the desired
|
||||
# output location.
|
||||
# This script collects the JavaScript spec definitions for core
|
||||
# native modules, then uses react-native-codegen to generate
|
||||
# native code.
|
||||
# The script will use the local react-native-codegen package by
|
||||
# default. Optionally, set the CODEGEN_PATH to point to the
|
||||
# desired codegen library (e.g. when using react-native-codegen
|
||||
# from npm).
|
||||
#
|
||||
# Usage:
|
||||
# ./scripts/generate-native-modules-specs.sh [output-dir]
|
||||
# ./scripts/generate-native-modules-specs.sh
|
||||
#
|
||||
# Example:
|
||||
# ./scripts/generate-native-modules-specs.sh ./codegen-out
|
||||
# CODEGEN_PATH=.. ./scripts/generate-native-modules-specs.sh
|
||||
|
||||
# shellcheck disable=SC2038
|
||||
|
||||
set -e
|
||||
|
||||
THIS_DIR=$(cd -P "$(dirname "$(readlink "${BASH_SOURCE[0]}" || echo "${BASH_SOURCE[0]}")")" && pwd)
|
||||
TEMP_DIR=$(mktemp -d /tmp/react-native-codegen-XXXXXXXX)
|
||||
RN_DIR=$(cd "$THIS_DIR/.." && pwd)
|
||||
CODEGEN_DIR=$(cd "$RN_DIR/packages/react-native-codegen" && pwd)
|
||||
OUTPUT_DIR="${1:-$RN_DIR/Libraries/FBReactNativeSpec/FBReactNativeSpec}"
|
||||
SCHEMA_FILE="$RN_DIR/schema-native-modules.json"
|
||||
YARN_BINARY="${YARN_BINARY:-yarn}"
|
||||
CODEGEN_PATH="${CODEGEN_PATH:-$(cd "$RN_DIR/packages/react-native-codegen" && pwd)}"
|
||||
YARN_BINARY="${YARN_BINARY:-$(command -v yarn)}"
|
||||
|
||||
cleanup () {
|
||||
set +e
|
||||
rm -rf "$TEMP_DIR"
|
||||
set -e
|
||||
}
|
||||
|
||||
describe () {
|
||||
printf "\\n\\n>>>>> %s\\n\\n\\n" "$1"
|
||||
}
|
||||
|
||||
step_build_codegen () {
|
||||
describe "Building react-native-codegen package"
|
||||
pushd "$CODEGEN_DIR" >/dev/null || exit
|
||||
"$YARN_BINARY"
|
||||
"$YARN_BINARY" build
|
||||
popd >/dev/null || exit
|
||||
}
|
||||
run_codegen () {
|
||||
SRCS_DIR=$1
|
||||
LIBRARY_NAME=$2
|
||||
OUTPUT_DIR=$3
|
||||
|
||||
SCHEMA_FILE="$TEMP_DIR/schema-$LIBRARY_NAME.json"
|
||||
|
||||
if [ ! -d "$CODEGEN_PATH/lib" ]; then
|
||||
describe "Building react-native-codegen package"
|
||||
pushd "$CODEGEN_PATH" >/dev/null || exit
|
||||
"$YARN_BINARY"
|
||||
"$YARN_BINARY" build
|
||||
popd >/dev/null || exit
|
||||
fi
|
||||
|
||||
step_gen_schema () {
|
||||
describe "Generating schema from flow types"
|
||||
SRCS_DIR=$(cd "$RN_DIR/Libraries" && pwd)
|
||||
"$YARN_BINARY" node "$CODEGEN_DIR/lib/cli/combine/combine-js-to-schema-cli.js" "$SCHEMA_FILE" "$SRCS_DIR"
|
||||
}
|
||||
"$YARN_BINARY" node "$CODEGEN_PATH/lib/cli/combine/combine-js-to-schema-cli.js" "$SCHEMA_FILE" "$SRCS_DIR"
|
||||
|
||||
step_gen_specs () {
|
||||
describe "Generating native code from schema (iOS)"
|
||||
pushd "$RN_DIR" >/dev/null || exit
|
||||
"$YARN_BINARY" --silent node scripts/generate-native-modules-specs-cli.js ios "$SCHEMA_FILE" "$OUTPUT_DIR"
|
||||
popd >/dev/null || exit
|
||||
}
|
||||
|
||||
step_build_codegen
|
||||
step_gen_schema
|
||||
step_gen_specs
|
||||
# Handle Core Modules
|
||||
run_codegen_core_modules () {
|
||||
LIBRARY_NAME="FBReactNativeSpec"
|
||||
SRCS_DIR=$(cd "$RN_DIR/Libraries" && pwd)
|
||||
OUTPUT_DIR="$SRCS_DIR/$LIBRARY_NAME/$LIBRARY_NAME"
|
||||
|
||||
run_codegen "$SRCS_DIR" "$LIBRARY_NAME" "$OUTPUT_DIR"
|
||||
}
|
||||
|
||||
main() {
|
||||
run_codegen_core_modules
|
||||
}
|
||||
|
||||
trap cleanup EXIT
|
||||
main "$@"
|
||||
|
||||
+28
-6
@@ -126,12 +126,34 @@ if (nightlyBuild) {
|
||||
releaseVersion = tagsWithVersion[tagsWithVersion.length - 1].slice(1);
|
||||
}
|
||||
|
||||
// -------- Generating Android Artifacts with JavaDoc
|
||||
if (exec('./gradlew :ReactAndroid:installArchives').code) {
|
||||
echo('Could not generate artifacts');
|
||||
exit(1);
|
||||
const buildAndroid = (rebuildOnError) => {
|
||||
// -------- Generating Android Artifacts with JavaDoc
|
||||
if (exec('./gradlew :ReactAndroid:installArchives').code) {
|
||||
echo('Could not generate artifacts.');
|
||||
exit(1);
|
||||
}
|
||||
|
||||
const aarLocation = `android/com/facebook/react/react-native/${releaseVersion}/react-native-${releaseVersion}.aar`;
|
||||
|
||||
// -------- Check if Android artifact contains all the files
|
||||
const {stdout: aarContent} = exec(`unzip -l ${aarLocation} | grep libfbjni.so`);
|
||||
if ((aarContent.match(/libfbjni.so/g) || []).length === 4) {
|
||||
echo(`Artifacts validated, continuing.`);
|
||||
return;
|
||||
}
|
||||
|
||||
// -------- Temporary fix for broken Android artifact is to build with Gradle once again
|
||||
if (rebuildOnError) {
|
||||
echo(`${aarLocation} is missing contents. Rebuilding with Gradle again in an effort to try to fix it.`);
|
||||
buildAndroid(false);
|
||||
} else {
|
||||
echo(`${aarLocation} is missing contents. Rebuilding did not fix the issue.`);
|
||||
exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
buildAndroid(true);
|
||||
|
||||
// undo uncommenting javadoc setting
|
||||
exec('git checkout ReactAndroid/gradle.properties');
|
||||
|
||||
@@ -157,8 +179,8 @@ artifacts.forEach(name => {
|
||||
const tagFlag = nightlyBuild
|
||||
? '--tag nightly'
|
||||
: releaseVersion.indexOf('-rc') === -1
|
||||
? ''
|
||||
: '--tag next';
|
||||
? ''
|
||||
: '--tag next';
|
||||
|
||||
// use otp from envvars if available
|
||||
const otpFlag = otp ? `--otp ${otp}` : '';
|
||||
|
||||
@@ -63,7 +63,7 @@ def use_react_native! (options={})
|
||||
|
||||
if hermes_enabled
|
||||
pod 'React-Core/Hermes', :path => "#{prefix}/"
|
||||
pod 'hermes-engine'
|
||||
pod 'hermes-engine', '~> 0.7.2'
|
||||
pod 'libevent', :podspec => "#{prefix}/third-party-podspecs/libevent.podspec"
|
||||
end
|
||||
end
|
||||
@@ -98,6 +98,10 @@ def use_flipper!(versions = {}, configurations: ['Debug'])
|
||||
pod 'FlipperKit/FlipperKitNetworkPlugin', versions['Flipper'], :configurations => configurations
|
||||
end
|
||||
|
||||
def has_pod(installer, name)
|
||||
installer.pods_project.pod_group(name) != nil
|
||||
end
|
||||
|
||||
# Post Install processing for Flipper
|
||||
def flipper_post_install(installer)
|
||||
installer.pods_project.targets.each do |target|
|
||||
@@ -109,16 +113,34 @@ def flipper_post_install(installer)
|
||||
end
|
||||
end
|
||||
|
||||
# Pre Install processing for Native Modules
|
||||
def codegen_pre_install(installer, options={})
|
||||
prefix = options[:path] ||= "../node_modules/react-native"
|
||||
codegen_path = options[:codegen_path] ||= "../node_modules/react-native-codegen"
|
||||
def exclude_architectures(installer)
|
||||
projects = installer.aggregate_targets
|
||||
.map{ |t| t.user_project }
|
||||
.uniq{ |p| p.path }
|
||||
.push(installer.pods_project)
|
||||
|
||||
Dir.mktmpdir do |dir|
|
||||
native_module_spec_name = "FBReactNativeSpec"
|
||||
schema_file = dir + "/schema-#{native_module_spec_name}.json"
|
||||
srcs_dir = "#{prefix}/Libraries"
|
||||
schema_generated = system("node #{codegen_path}/lib/cli/combine/combine-js-to-schema-cli.js #{schema_file} #{srcs_dir}")
|
||||
specs_generated = system("node #{prefix}/scripts/generate-native-modules-specs-cli.js ios #{schema_file} #{srcs_dir}/#{native_module_spec_name}/#{native_module_spec_name}")
|
||||
arm_value = `/usr/sbin/sysctl -n hw.optional.arm64 2>&1`.to_i
|
||||
|
||||
# Hermes does not support `i386` architecture
|
||||
excluded_archs_default = has_pod(installer, 'hermes-engine') ? "i386" : ""
|
||||
|
||||
projects.each do |project|
|
||||
project.build_configurations.each do |config|
|
||||
if arm_value == 1 then
|
||||
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = excluded_archs_default
|
||||
else
|
||||
config.build_settings["EXCLUDED_ARCHS[sdk=iphonesimulator*]"] = "arm64 " + excluded_archs_default
|
||||
end
|
||||
end
|
||||
|
||||
project.save()
|
||||
end
|
||||
end
|
||||
|
||||
def react_native_post_install(installer)
|
||||
if has_pod(installer, 'Flipper')
|
||||
flipper_post_install(installer)
|
||||
end
|
||||
|
||||
exclude_architectures(installer)
|
||||
end
|
||||
|
||||
+10
-9
@@ -6,23 +6,24 @@ platform :ios, '10.0'
|
||||
target 'HelloWorld' do
|
||||
config = use_native_modules!
|
||||
|
||||
use_react_native!(:path => config[:reactNativePath])
|
||||
use_react_native!(
|
||||
:path => config[:reactNativePath],
|
||||
# to enable hermes on iOS, change `false` to `true` and then install pods
|
||||
:hermes_enabled => false
|
||||
)
|
||||
|
||||
target 'HelloWorldTests' do
|
||||
inherit! :complete
|
||||
# Pods for testing
|
||||
end
|
||||
|
||||
pre_install do |installer|
|
||||
codegen_pre_install(installer)
|
||||
end
|
||||
|
||||
# Enables Flipper.
|
||||
#
|
||||
# Note that if you have use_frameworks! enabled, Flipper will not work and
|
||||
# you should disable these next few lines.
|
||||
use_flipper!
|
||||
# you should disable the next line.
|
||||
use_flipper!()
|
||||
|
||||
post_install do |installer|
|
||||
flipper_post_install(installer)
|
||||
react_native_post_install(installer)
|
||||
end
|
||||
end
|
||||
end
|
||||
+10
-10
@@ -11,18 +11,18 @@
|
||||
},
|
||||
"dependencies": {
|
||||
"react": "17.0.1",
|
||||
"react-native": "1000.0.0"
|
||||
"react-native": "0.64.0-rc.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/core": "^7.8.4",
|
||||
"@babel/runtime": "^7.8.4",
|
||||
"@react-native-community/eslint-config": "^1.1.0",
|
||||
"babel-jest": "^25.1.0",
|
||||
"eslint": "^6.5.1",
|
||||
"jest": "^25.1.0",
|
||||
"metro-react-native-babel-preset": "^0.63.0",
|
||||
"react-test-renderer": "17.0.1",
|
||||
"react-native-codegen": "0.0.4"
|
||||
"@babel/core": "^7.12.9",
|
||||
"@babel/runtime": "^7.12.5",
|
||||
"@react-native-community/eslint-config": "^2.0.0",
|
||||
"babel-jest": "^26.6.3",
|
||||
"eslint": "7.14.0",
|
||||
"jest": "^26.6.3",
|
||||
"metro-react-native-babel-preset": "^0.64.0",
|
||||
"react-native-codegen": "^0.0.6",
|
||||
"react-test-renderer": "17.0.1"
|
||||
},
|
||||
"jest": {
|
||||
"preset": "react-native"
|
||||
|
||||
Reference in New Issue
Block a user