Skip to content

Commit 23a160e

Browse files
SamChou19815facebook-github-bot
authored andcommitted
Lock down constrain writes in some directories
Summary: Changelog: [internal] Reviewed By: gkz Differential Revision: D36214426 fbshipit-source-id: 8498ef0f646d8a38e5d523f4fd2deacf1b649fd2
1 parent 6b6adcc commit 23a160e

File tree

8 files changed

+22
-26
lines changed

8 files changed

+22
-26
lines changed

IntegrationTests/AsyncStorageTest.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -207,7 +207,7 @@ class AsyncStorageTest extends React.Component<{...}, $FlowFixMeState> {
207207
this.setState({done: true}, () => {
208208
TestModule.markTestCompleted();
209209
});
210-
updateMessage = msg => {
210+
updateMessage = (msg: string) => {
211211
this.setState({messages: this.state.messages.concat('\n' + msg)});
212212
DEBUG && console.log(msg);
213213
};

Libraries/Image/Image.android.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ export type ImageComponentStatics = $ReadOnly<{|
123123
*
124124
* See https://reactnative.dev/docs/image
125125
*/
126-
let Image = (props: ImagePropsType, forwardedRef) => {
126+
const BaseImage = (props: ImagePropsType, forwardedRef) => {
127127
let source = resolveAssetSource(props.source);
128128
const defaultSource = resolveAssetSource(props.defaultSource);
129129
const loadingIndicatorSource = resolveAssetSource(
@@ -221,11 +221,11 @@ let Image = (props: ImagePropsType, forwardedRef) => {
221221
);
222222
};
223223

224-
Image = React.forwardRef<
224+
let Image = React.forwardRef<
225225
ImagePropsType,
226226
| React.ElementRef<typeof TextInlineImageNativeComponent>
227227
| React.ElementRef<typeof ImageViewNativeComponent>,
228-
>(Image);
228+
>(BaseImage);
229229

230230
if (ImageInjection.unstable_createImageComponent != null) {
231231
Image = ImageInjection.unstable_createImageComponent(Image);

Libraries/Image/Image.ios.js

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ export type ImageComponentStatics = $ReadOnly<{|
102102
*
103103
* See https://reactnative.dev/docs/image
104104
*/
105-
let Image = (props: ImagePropsType, forwardedRef) => {
105+
const BaseImage = (props: ImagePropsType, forwardedRef) => {
106106
const source = resolveAssetSource(props.source) || {
107107
uri: undefined,
108108
width: undefined,
@@ -158,11 +158,12 @@ let Image = (props: ImagePropsType, forwardedRef) => {
158158
);
159159
};
160160

161-
Image = React.forwardRef<
161+
const ImageForwardRef = React.forwardRef<
162162
ImagePropsType,
163163
React.ElementRef<typeof ImageViewNativeComponent>,
164-
>(Image);
164+
>(BaseImage);
165165

166+
let Image = ImageForwardRef;
166167
if (ImageInjection.unstable_createImageComponent != null) {
167168
Image = ImageInjection.unstable_createImageComponent(Image);
168169
}

Libraries/Lists/VirtualizedList.js

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1875,15 +1875,15 @@ class VirtualizedList extends React.PureComponent<Props, State> {
18751875
'Tried to get frame for out of range index ' + index,
18761876
);
18771877
const item = getItem(data, index);
1878-
let frame = item && this._frames[this._keyExtractor(item, index)];
1878+
const frame = item && this._frames[this._keyExtractor(item, index)];
18791879
if (!frame || frame.index !== index) {
18801880
if (getItemLayout) {
1881-
frame = getItemLayout(data, index);
1881+
/* $FlowFixMe[prop-missing] (>=0.63.0 site=react_native_fb) This comment
1882+
* suppresses an error found when Flow v0.63 was deployed. To see the error
1883+
* delete this comment and run Flow. */
1884+
return getItemLayout(data, index);
18821885
}
18831886
}
1884-
/* $FlowFixMe[prop-missing] (>=0.63.0 site=react_native_fb) This comment
1885-
* suppresses an error found when Flow v0.63 was deployed. To see the error
1886-
* delete this comment and run Flow. */
18871887
return frame;
18881888
};
18891889

Libraries/LogBox/Data/parseLogBoxLog.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -316,7 +316,7 @@ export function parseLogBoxLog(args: $ReadOnlyArray<mixed>): {|
316316
|} {
317317
const message = args[0];
318318
let argsWithoutComponentStack = [];
319-
let componentStack = [];
319+
let componentStack: ComponentStack = [];
320320

321321
// Extract component stack from warnings like "Some warning%s".
322322
if (

Libraries/LogBox/LogBox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ if (__DEV__) {
3939
let originalConsoleError;
4040
let originalConsoleWarn;
4141
let consoleErrorImpl;
42-
let consoleWarnImpl;
42+
let consoleWarnImpl: (...args: Array<mixed>) => void;
4343

4444
let isLogBoxInstalled: boolean = false;
4545

Libraries/Utilities/__tests__/setAndForwardRef-test.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,8 @@ const ReactTestRenderer = require('react-test-renderer');
1717
const setAndForwardRef = require('../setAndForwardRef');
1818

1919
describe('setAndForwardRef', () => {
20-
let innerFuncCalled = false;
21-
let outerFuncCalled = false;
20+
let innerFuncCalled: ?boolean = false;
21+
let outerFuncCalled: ?boolean = false;
2222

2323
class ForwardedComponent extends React.Component<{||}> {
2424
testFunc() {

packages/rn-tester/js/components/RNTesterSettingSwitchRow.js

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,10 @@ const styles = StyleSheet.create({
4747
justifyContent: 'space-between',
4848
},
4949
});
50-
/* $FlowFixMe[cannot-reassign-export] (>=0.85.0 site=react_native_fb) This
51-
* comment suppresses an error found when Flow v0.85 was deployed. To see the
52-
* error, delete this comment and run Flow. */
53-
// $FlowFixMe[cannot-reassign]
54-
RNTesterSettingSwitchRow = RNTesterStatePersister.createContainer(
55-
RNTesterSettingSwitchRow,
56-
{
50+
51+
const RNTesterSettingSwitchRowContainer: React.ComponentType<$FlowFixMeProps> =
52+
RNTesterStatePersister.createContainer(RNTesterSettingSwitchRow, {
5753
cacheKeySuffix: ({label}) => 'Switch:' + label,
5854
getInitialState: ({initialValue}) => initialValue,
59-
},
60-
);
61-
module.exports = RNTesterSettingSwitchRow;
55+
});
56+
module.exports = RNTesterSettingSwitchRowContainer;

0 commit comments

Comments
 (0)