File tree 6 files changed +77
-60
lines changed
6 files changed +77
-60
lines changed Original file line number Diff line number Diff line change 30
30
31
31
[libs]
32
32
Libraries/react-native/react-native-interface.js
33
- Examples/UIExplorer/ImageMocks.js
34
33
35
34
[options]
36
35
module.system=haste
37
36
38
37
munge_underscores=true
39
38
39
+ module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
40
+ module.name_mapper='^[./a-zA-Z0-9$_-]+\.png$' -> 'RelativeImageStub'
41
+
40
42
suppress_type=$FlowIssue
41
43
suppress_type=$FlowFixMe
42
44
suppress_type=$FixMe
Original file line number Diff line number Diff line change @@ -34,6 +34,9 @@ module.system=haste
34
34
35
35
munge_underscores=true
36
36
37
+ module.name_mapper='^image![a-zA-Z0-9$_-]+$' -> 'GlobalImageStub'
38
+ module.name_mapper='^[./a-zA-Z0-9$_-]+\.png$' -> 'RelativeImageStub'
39
+
37
40
suppress_type=$FlowIssue
38
41
suppress_type=$FlowFixMe
39
42
suppress_type=$FixMe
Load Diff This file was deleted.
Original file line number Diff line number Diff line change 2
2
* Copyright 2004-present Facebook. All Rights Reserved.
3
3
*
4
4
* @providesModule AssetRegistry
5
+ * @flow
5
6
*/
6
7
'use strict' ;
7
8
8
- var assets = [ ] ;
9
+ export type PackagerAsset = {
10
+ __packager_asset : boolean ,
11
+ fileSystemLocation : string ,
12
+ httpServerLocation : string ,
13
+ width : number ,
14
+ height : number ,
15
+ scales : Array < number > ,
16
+ hash : string ,
17
+ name : string ,
18
+ type : string ,
19
+ } ;
9
20
10
- function registerAsset ( asset ) {
21
+
22
+ var assets : Array < PackagerAsset > = [];
23
+
24
+ function registerAsset(asset: PackagerAsset): number {
11
25
// `push` returns new array length, so the first asset will
12
26
// get id 1 (not 0) to make the value truthy
13
27
return assets . push ( asset ) ;
14
28
}
15
29
16
- function getAssetByID ( assetId ) {
30
+ function getAssetByID(assetId: number): PackagerAsset {
17
31
return assets [ assetId - 1 ] ;
18
32
}
19
33
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ * @providesModule GlobalImageStub
10
+ * @flow
11
+ */
12
+ 'use strict' ;
13
+
14
+ // This is a stub for flow to make it understand require('image!icon')
15
+ // See packager/react-packager/src/Bundler/index.js
16
+
17
+ module . exports = {
18
+ __packager_asset : true ,
19
+ isStatic : true ,
20
+ path : '/full/path/to/something.png' ,
21
+ uri : 'icon' ,
22
+ width : 100 ,
23
+ height : 100 ,
24
+ deprecated : true ,
25
+ } ;
Original file line number Diff line number Diff line change
1
+ /**
2
+ * Copyright (c) 2015-present, Facebook, Inc.
3
+ * All rights reserved.
4
+ *
5
+ * This source code is licensed under the BSD-style license found in the
6
+ * LICENSE file in the root directory of this source tree. An additional grant
7
+ * of patent rights can be found in the PATENTS file in the same directory.
8
+ *
9
+ * @providesModule RelativeImageStub
10
+ * @flow
11
+ */
12
+ 'use strict' ;
13
+
14
+ // This is a stub for flow to make it understand require('./icon.png')
15
+ // See packager/react-packager/src/Bundler/index.js
16
+
17
+ var AssetRegistry = require ( 'AssetRegistry' ) ;
18
+
19
+ module . exports = AssetRegistry . registerAsset ( {
20
+ __packager_asset : true ,
21
+ fileSystemLocation : '/full/path/to/directory' ,
22
+ httpServerLocation : '/assets/full/path/to/directory' ,
23
+ width : 100 ,
24
+ height : 100 ,
25
+ scales : [ 1 , 2 , 3 ] ,
26
+ hash : 'nonsense' ,
27
+ name : 'icon' ,
28
+ type : 'png' ,
29
+ } ) ;
You can’t perform that action at this time.
0 commit comments