Lock down constrain writes in some directories

Summary: Changelog: [internal]

Reviewed By: gkz

Differential Revision: D36214426

fbshipit-source-id: 8498ef0f646d8a38e5d523f4fd2deacf1b649fd2
This commit is contained in:
Sam Zhou
2022-05-06 15:53:13 -07:00
committed by Facebook GitHub Bot
parent 6b6adcc111
commit 23a160ebf6
8 changed files with 22 additions and 26 deletions
+1 -1
View File
@@ -207,7 +207,7 @@ class AsyncStorageTest extends React.Component<{...}, $FlowFixMeState> {
this.setState({done: true}, () => {
TestModule.markTestCompleted();
});
updateMessage = msg => {
updateMessage = (msg: string) => {
this.setState({messages: this.state.messages.concat('\n' + msg)});
DEBUG && console.log(msg);
};
+3 -3
View File
@@ -123,7 +123,7 @@ export type ImageComponentStatics = $ReadOnly<{|
*
* See https://reactnative.dev/docs/image
*/
let Image = (props: ImagePropsType, forwardedRef) => {
const BaseImage = (props: ImagePropsType, forwardedRef) => {
let source = resolveAssetSource(props.source);
const defaultSource = resolveAssetSource(props.defaultSource);
const loadingIndicatorSource = resolveAssetSource(
@@ -221,11 +221,11 @@ let Image = (props: ImagePropsType, forwardedRef) => {
);
};
Image = React.forwardRef<
let Image = React.forwardRef<
ImagePropsType,
| React.ElementRef<typeof TextInlineImageNativeComponent>
| React.ElementRef<typeof ImageViewNativeComponent>,
>(Image);
>(BaseImage);
if (ImageInjection.unstable_createImageComponent != null) {
Image = ImageInjection.unstable_createImageComponent(Image);
+4 -3
View File
@@ -102,7 +102,7 @@ export type ImageComponentStatics = $ReadOnly<{|
*
* See https://reactnative.dev/docs/image
*/
let Image = (props: ImagePropsType, forwardedRef) => {
const BaseImage = (props: ImagePropsType, forwardedRef) => {
const source = resolveAssetSource(props.source) || {
uri: undefined,
width: undefined,
@@ -158,11 +158,12 @@ let Image = (props: ImagePropsType, forwardedRef) => {
);
};
Image = React.forwardRef<
const ImageForwardRef = React.forwardRef<
ImagePropsType,
React.ElementRef<typeof ImageViewNativeComponent>,
>(Image);
>(BaseImage);
let Image = ImageForwardRef;
if (ImageInjection.unstable_createImageComponent != null) {
Image = ImageInjection.unstable_createImageComponent(Image);
}
+5 -5
View File
@@ -1875,15 +1875,15 @@ class VirtualizedList extends React.PureComponent<Props, State> {
'Tried to get frame for out of range index ' + index,
);
const item = getItem(data, index);
let frame = item && this._frames[this._keyExtractor(item, index)];
const frame = item && this._frames[this._keyExtractor(item, index)];
if (!frame || frame.index !== index) {
if (getItemLayout) {
frame = getItemLayout(data, index);
/* $FlowFixMe[prop-missing] (>=0.63.0 site=react_native_fb) This comment
* suppresses an error found when Flow v0.63 was deployed. To see the error
* delete this comment and run Flow. */
return getItemLayout(data, index);
}
}
/* $FlowFixMe[prop-missing] (>=0.63.0 site=react_native_fb) This comment
* suppresses an error found when Flow v0.63 was deployed. To see the error
* delete this comment and run Flow. */
return frame;
};
+1 -1
View File
@@ -316,7 +316,7 @@ export function parseLogBoxLog(args: $ReadOnlyArray<mixed>): {|
|} {
const message = args[0];
let argsWithoutComponentStack = [];
let componentStack = [];
let componentStack: ComponentStack = [];
// Extract component stack from warnings like "Some warning%s".
if (
+1 -1
View File
@@ -39,7 +39,7 @@ if (__DEV__) {
let originalConsoleError;
let originalConsoleWarn;
let consoleErrorImpl;
let consoleWarnImpl;
let consoleWarnImpl: (...args: Array<mixed>) => void;
let isLogBoxInstalled: boolean = false;
@@ -17,8 +17,8 @@ const ReactTestRenderer = require('react-test-renderer');
const setAndForwardRef = require('../setAndForwardRef');
describe('setAndForwardRef', () => {
let innerFuncCalled = false;
let outerFuncCalled = false;
let innerFuncCalled: ?boolean = false;
let outerFuncCalled: ?boolean = false;
class ForwardedComponent extends React.Component<{||}> {
testFunc() {
@@ -47,15 +47,10 @@ const styles = StyleSheet.create({
justifyContent: 'space-between',
},
});
/* $FlowFixMe[cannot-reassign-export] (>=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. */
// $FlowFixMe[cannot-reassign]
RNTesterSettingSwitchRow = RNTesterStatePersister.createContainer(
RNTesterSettingSwitchRow,
{
const RNTesterSettingSwitchRowContainer: React.ComponentType<$FlowFixMeProps> =
RNTesterStatePersister.createContainer(RNTesterSettingSwitchRow, {
cacheKeySuffix: ({label}) => 'Switch:' + label,
getInitialState: ({initialValue}) => initialValue,
},
);
module.exports = RNTesterSettingSwitchRow;
});
module.exports = RNTesterSettingSwitchRowContainer;